[cfe-dev] Pragma message in Clang?

Matt Joiner anacrolix at gmail.com
Sun Sep 26 06:12:09 PDT 2010


Thanks very much! I'll be watching the trunk with special interest.

On Sun, Sep 26, 2010 at 10:42 PM, Michael Spencer <bigcheesegs at gmail.com> wrote:
> On Sun, Sep 26, 2010 at 8:25 AM, Matt Joiner <anacrolix at gmail.com> wrote:
>> It does, enabling it however seems to drop recognition (I assume C99
>> is out the window) of _Bool:
>>
>> ./cpfs.h(27) :  error: unknown type name '_Bool'
>>
>> subprocess.CalledProcessError: Command '['clang', '-c', 'bitmap.c',
>> '-o', '/tmp/bitmap.c.o.mbECeS', '-fms-extensions', '-Winline',
>> '-Wshadow', '-Wextra', '-Wmissing-format-attribute', '-Wall',
>> '-Wfloat-equal', '-fdiagnostics-show-option',
>> '-Werror-implicit-function-declaration', '-Werror=return-type',
>> '-fno-exceptions', '-std=gnu99', '-D_GNU_SOURCE',
>> '-D_FILE_OFFSET_BITS=64', '-DCPFS_SIMD_ALIGNED', '-DCPFS_USE_SSSE3',
>> '-DFUSE_USE_VERSION=28', '-O3', '-g', '-DNDEBUG',
>> '-DCPFS_LOG_LEVEL=WARNING']' returned non-zero exit status 1
>>
>> I don't imagine this is intentional, or -fms-extensions is sneakily
>> switching language to C++, or clobbering the C standard in use.
>
> The reason for this is because MSVC doesn't support _Bool and actually
> typedefs it in some headers. I however would like a way for _Bool to
> be used with -fms-extensions, but it would require special case code.
>
> As for the pragma, I assumed it was MSVC only. Adding it to
> non-ms-extensions is trivial. I'll fix it today, just need to add
> support for not requiring parens.
>
> - Michael Spencer
>
>> On Sun, Sep 26, 2010 at 9:50 PM, Francois Pichet <pichet2000 at gmail.com> wrote:
>>> clang implements #pragma message but it is currently only enabled in
>>> Microsoft mode (-fms-extensions).
>>>
>>> Since GCC also support it, it would make sense to enable it by default.
>>>
>>> On Sun, Sep 26, 2010 at 7:37 AM, Matt Joiner <anacrolix at gmail.com> wrote:
>>>> What's Clang's equivalent to `#pragma message` as used in [GCC][1] and
>>>> [MSVC][2]?
>>>>
>>>>  [1]: http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
>>>>  [2]: http://msdn.microsoft.com/en-us/library/x7dkzch2.aspx
>




More information about the cfe-dev mailing list