r179771 - Dropped the parentheses for #pragma message and its kin in the -E output generator.

Jordan Rose jordan_rose at apple.com
Thu Apr 18 15:12:03 PDT 2013


On Apr 18, 2013, at 11:54 , Andy Gibbs <andyg1001 at hotmail.co.uk> wrote:

> On Thursday, April 18, 2013 8:10 PM, Jordan Rose wrote:
> 
>> No, that's not correct either. Microsoft's #pragma message requires
>> parens, while #pragma GCC (error|warning) apparently requires no
>> parens. (GCC's #pragma message seems to be MS-inspired, as it has no
>> GCC namespace and optionally allows parens.)
>> http://msdn.microsoft.com/en-us/library/x7dkzch2(v=vs.80).aspx
>> http://gcc.gnu.org/onlinedocs/cpp/Pragmas.html
>> http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
> 
> I admit I did miss the bit where MS requires the parenthesis (I'm not
> completely sure this is the case, actually, but I haven't got access to
> an MS compiler just now to check).
> 
> Regarding #pragma message, I think gcc has made this deprecated since
> they don't have a #pragma GCC message variant and their documentation
> states that those not moved forward to the new format are henceforth
> deprecated.  This is an excerpt from the gcc docs:
> 
> "For backward compatibility, pragmas which were recognized by
> previous versions are still recognized without the GCC prefix, but
> that usage is deprecated. Some older pragmas are deprecated in their
> entirety. They are not recognized with the GCC prefix."
> 
> Also, although this is an aside, clang doesn't support #pragma
> message in a 100% compatible way since clang technically makes the
> message a warning, which is not the case either on MS (again this is
> from memory) or gcc.
> 
>> I'm okay with not really striving for source fidelity here; since
>> there's no #pragma GCC message, it's probably safe to just
>> parenthesize message all the time.
> 
> So... I'll roll back that particular change, shall I?  I don't think
> there is much advantage to passing down whether the #pragma was
> parenthesized or not -- additional overhead for negligible gain IMHO.

The particular change is that "#pragma GCC warning" should not have parentheses, because GCC would choke on that.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130418/2c137cae/attachment.html>


More information about the cfe-commits mailing list