[cfe-dev] Pragma message in Clang?

Chris Lattner clattner at apple.com
Mon Sep 27 09:11:08 PDT 2010


On Sep 27, 2010, at 5:58 AM, John McCall wrote:

> 
> On Sep 27, 2010, at 7:33 AM, Michael Spencer wrote:
> 
>> On Mon, Sep 27, 2010 at 2:24 AM, Matt Joiner <anacrolix at gmail.com> wrote:
>>> Perhaps, but #pragma message is hijacking the warning machinery,
>>> rather than generating a "note" as in GCC and MSVC. For code with many
>>> such messages, this would be irritating. If "message" isn't
>>> standardized however, I can understand your lack of interest in it.
>> 
>> I originally tried to emit a note, but I couldn't get clang to print
>> it. Implementing this was actually my first patch to clang, so I never
>> tried to figure out exactly how to get that working.
> 
> A note wouldn't be appropriate;  notes are always subordinate to other diagnostics.

Right, GCC doesn't have a lot of structure or regularity to its diagnostics.  In clang, a "note" is always part of the diagnostic before it.  This is why trying to emit a note as the first diagnostic doesn't work.  If a note comes out after a warning that is disabled, the note is disabled as well.

-Chris



More information about the cfe-dev mailing list