]> granicus.if.org Git - clang/commit
Let stddef.h respect __need_{wchar_t, size_t, NULL, ptrdiff_t, wint_t}.
authorNico Weber <nicolasweber@gmx.de>
Wed, 30 Apr 2014 04:35:09 +0000 (04:35 +0000)
committerNico Weber <nicolasweber@gmx.de>
Wed, 30 Apr 2014 04:35:09 +0000 (04:35 +0000)
commit7933ecef1047af471f6116acb9ec052cec9e9335
tree47d2f27d977b25889e0cee7e31a8acb00265f931
parent810876919a16f5c2f0f18746b8dd9581746db599
Let stddef.h respect __need_{wchar_t, size_t, NULL, ptrdiff_t, wint_t}.

glibc expects that stddef.h only defines a single thing if either of these
defines is set.  For example, before this change, a C file containing

  #include <stdlib.h>
  int ptrdiff_t = 0;

would compile with gcc but not with clang. Now it compiles with clang too.

This also fixes PR12997, where older versions of the Linux headers would define
NULL incorrectly, and glibc would define __need_NULL and expect stddef.h to
redefine NULL with the correct definition.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207606 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Headers/stddef.h
test/Headers/stddefneeds.cpp [new file with mode: 0644]
test/Sema/format-strings.c