Thanks John,<div><br></div><div>Committed, with support for other pragma annotation tokens as well, in r167363.</div><div><br></div><div>Cheers,</div><div>Lang.</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Thu, Nov 1, 2012 at 12:51 PM, John McCall <span dir="ltr"><<a href="mailto:rjmccall@apple.com" target="_blank">rjmccall@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div><div class="h5"><div>On Oct 25, 2012, at 1:39 PM, Lang Hames wrote:</div><blockquote type="cite"><div>Tim Northover pointed out that there's a flaw in my recent FP_CONTRACT patch (r166383). That patch restricted FP_CONTRACT (or rather tok::annot_pragma_fp_contract) to appearing as the first token in a compound statement. The problem with my patch is that it prohibits things like:</div>

<div><br></div><div><font face="courier new, monospace">void foo() {</font></div><div><font face="courier new, monospace">  #pragma MS_STRUCT ON</font></div><div><font face="courier new, monospace">  #pragma STDC FP_CONTRACT ON</font></div>

<div><font face="courier new, monospace">  // ...</font></div><div><font face="courier new, monospace">}</font></div><div><br></div><div>Which isn't prohibited by the C99 spec, and I think seems reasonable.</div><div>

<br></div><div>A simple solution to the problem is to loop at the start of a compound statement parsing tokens that can reasonably appear there (FP_CONTRACT, MS_STRUCT, maybe others?), then break out of that look when an unhandled token encountered. Attached is a patch that implements this approach, processing FP_CONTRACT and MS_STRUCT pragmas at the start of compound statements before falling through.</div>

<div><br></div><div>Not being a language lawyer, is what else should be handled in this loop? </div></blockquote><div><br></div></div></div>Other pragmas, maybe.  You could potentially check for all the pragma annotation tokens.</div>
<div class="im"><div><br><blockquote type="cite"><div>Does this seem like a reasonable approach?</div></blockquote><br></div></div><div>It seems fine.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>John.</div>
<br></font></span></div>
</blockquote></div><br></div>