[patch] Let stddef.h redefine NULL if __need_NULL is set

Chandler Carruth chandlerc at google.com
Mon Apr 28 13:45:46 PDT 2014


On Mon, Apr 28, 2014 at 1:16 PM, Nico Weber <thakis at chromium.org> wrote:

> On Mon, Apr 28, 2014 at 1:05 PM, Reid Kleckner <rnk at google.com> wrote:
>
>> Even if we commit this workaround, can we report this as a bug to
>> upstream Linux?
>>
>
> As mentioned above, I'm guessing Linux probably doesn't want to depend on
> C standard headers, so they wouldn't see this as a bug in Linux.
>

Just FYI, there is a more subtle distinction here.

Linux probably wants to not depend on a C standard library. But stddef.h
and the definition of NULL is actually available even in a *freestanding*
implementation of C which has no standard library. It's required to be
provided by the compiler. As such, I actually think Linux would be OK with
including stddef.h from a technical perspective. Any barrier here would be
historical or political.

That said, either historical or political barriers would be barriers all
the same, and more pressingly we can't retroactively change all of the
existing linux kernel headers and glibcs deployed around the world and
trying to use Clang. So suggesting *only* changing either Linux or glibc is
a non-starter. We need to both change Clang to work around this, and (where
we can) suggest to the upstream communities a more clean solution.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140428/d39ec592/attachment.html>


More information about the cfe-commits mailing list