[cfe-commits] [patch] Let NULL and MSVC headers coexist

Nico Weber thakis at chromium.org
Tue Apr 24 14:03:27 PDT 2012


On Tue, Apr 24, 2012 at 2:02 PM, David Blaikie <dblaikie at gmail.com> wrote:
> On Tue, Apr 24, 2012 at 1:49 PM, Nico Weber <thakis at chromium.org> wrote:
>> Hi,
>>
>> the attached patch fixes both issues mentioned in
>> http://llvm.org/PR12146 . Like suggested by Eli in that bug, it does
>> this by defining NULL to 0 instead of __null on windows. I think it
>> would be nice to have a __clang_null, but this patch fixes the
>> immediate issues I'm seeing without me having to argue with Eli :-)
>> Maybe I'll do that in a follow-up patch.
>
> I'm probably with you on the __clang_null - ish, but if "better
> diagnostics"* isn't something Eli considers a "necessary" basis for
> making that change, I guess not.
>
> * Currently our null-conversion warnings are off by default & not very
> good (big holes in them - int i = NULL doesn't warn when sizeof(void*)
> == sizeof(int)). Also, technically we could implement these warnings
> without __null anyway, by looking at the spelling of every zero
> literal in a program... but perhaps that would be prohibitive.
>
>> Ok?
>
> Could you potentially test both these cases in the same source file?
> Just to keep test file count down.

No, because stddef.h has file include guards.

Nico



More information about the cfe-commits mailing list