[cfe-dev] Pragma message in Clang?
Matt Joiner
anacrolix at gmail.com
Sun Sep 26 23:24:35 PDT 2010
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.
Thanks everyone for your time!
On Mon, Sep 27, 2010 at 2:03 PM, Chris Lattner <clattner at apple.com> wrote:
>
> On Sep 26, 2010, at 6:51 PM, Matt Joiner wrote:
>
>> Hi, patch works. However using pragma message will generate a warning traceback:
>>
>> data.c:447:1: warning: TODO: i need to do X
>> TODO("i need to do X")
>> ^
>> In file included from data.c:1:
>> In file included from ./data.h:2:
>> In file included from ./types.h:3:
>> ./utility.h:70:20: note: instantiated from:
>> #define TODO(todo) MESSAGE("TODO: " todo)
>> ^
>> ./utility.h:68:22: note: instantiated from:
>> #define MESSAGE(msg) MESSAGE2(message(msg))
>> ^
>> ./utility.h:67:25: note: instantiated from:
>> #define MESSAGE2(pslit) _Pragma(#pslit)
>> ^
>> <scratch space>:237:2: note: instantiated from:
>> message("TODO: " "i need to do X")
>> ^
>>
>> Where GCC only generates a single line:
>> data.c:447: note: #pragma message: TODO: i need to do X
>
> I think that this is a feature, not a bug. Making all the diagnostics consistent is good for simplicity of the code.
>
> -Chris
More information about the cfe-dev
mailing list