Looks great! It'd be nice for the 'isKnownToGCC' thing to look at the spelling that was used, but that can wait (I don't think we have attributes where it matters yet).<br><br><div>+class FlattenedSpelling {</div>
<div>+ std::string V, N, NS;</div><div>+ bool K;</div><div>+</div><div>+public:</div><div>+ FlattenedSpelling(const std::string &Variety, const std::string &Name,</div><div>+ const std::string &Namespace, bool KnownToGCC) :</div>
<div>+ V(Variety), N(Name), NS(Namespace), K(KnownToGCC) {}</div><div>+ explicit FlattenedSpelling(const Record &Spelling) :</div><div>+ V(Spelling.getValueAsString("Variety")),</div><div>+ N(Spelling.getValueAsString("Name")) {</div>
<div><br></div><div>Maybe assert that V is not "GCC" here?</div><div><br></div><div>+ if (V == "CXX11")</div><div>+ NS = Spelling.getValueAsString("Namespace");</div><div>+ bool Unset;</div>
<div>+ K = Spelling.getValueAsBitOrUnset("KnownToGCC", Unset);</div><div>+ }</div><div>+ FlattenedSpelling(const FlattenedSpelling &RHS) : V(RHS.V), N(RHS.N),</div><div>+ NS(RHS.NS), K(RHS.K) {}</div>
<div>+</div><div>+ FlattenedSpelling& operator=(const FlattenedSpelling &RHS) {</div><div>+ if (&RHS != this) {</div><div>+ V = RHS.V;</div><div>+ N = RHS.N;</div><div>+ NS = RHS.NS;</div><div>
+ K = RHS.K;</div><div>+ }</div><div>+ return *this;</div><div>+ }</div><div><br></div><div>Can you just use the implicit copy operations?</div><div><br></div><div>+ const std::string& Variety() const { return V; }<br>
</div><div>+ const std::string& Name() const { return N; }</div><div>+ const std::string& Namespace() const { return NS; }</div><div><br></div><div>& on the right, please, and start function names with lowercase.</div>
<div><br></div><div>+ bool KnownToGCC() const { return K; }</div><div>+};</div><div><br></div><div>On Mon Jan 27 2014 at 10:36:48 AM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>> wrote:</div>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch is meant to replace one added by r199676. The goal of that<br>
commit was to remove some specialness from thread safety attributes,<br>
but as Richard had pointed out in IRC, there is a more correct<br>
solution to be had: we need to encode knowledge of which attributes<br>
are known to GCC. We already allow GNU-style attributes on function<br>
definitions as an extension to GCC, which is what we were really<br>
trying to (incompletely) encode with the thread-safety attribute<br>
whitelist.<br>
<br>
This patch adds a new meta-spelling called "GCC" -- it widens into<br>
being a GNU spelling, and a CXX11 spelling with the namespace "gnu".<br>
It also sets a bit on the spelling certifying that it is known to GCC.<br>
>From this, we can warn about the extension appropriately. As a<br>
consequence, the FunctionDefinition functionality is completely<br>
removed.<br>
<br>
~Aaron<br>
</blockquote>