cfe-dev Digest, Vol 39, Issue 100

Sorry I used the term “note” as that’s the text GCC prepends, I wasn’t
aware of internal Clang construct by that name.
Regardless of the machinery used, MSVC (and GCC to a lesser degree),
attempt to implement these messages as unconfrontational notices, they
don’t generate alarm bells or macro pasting tracebacks.

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

What worries me with this new pragma message is that compiling with “-Werror” is no longer an option as long as there is one header with a message, am I right ?

Matthieu.