summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/format-strings.c
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2014-04-30 04:35:09 +0000
committerNico Weber <nicolasweber@gmx.de>2014-04-30 04:35:09 +0000
commit272bcf6768d3cfaba452c86d62697541568125ed (patch)
tree61877da073d62b4f455bb4a7292773c5831be02f /clang/test/Sema/format-strings.c
parent680210fe7de053f4745c01e8dbe99bd113f2c93a (diff)
downloadbcm5719-llvm-272bcf6768d3cfaba452c86d62697541568125ed.tar.gz
bcm5719-llvm-272bcf6768d3cfaba452c86d62697541568125ed.zip
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. llvm-svn: 207606
Diffstat (limited to 'clang/test/Sema/format-strings.c')
-rw-r--r--clang/test/Sema/format-strings.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/test/Sema/format-strings.c b/clang/test/Sema/format-strings.c
index ad7b37c3e11..e31644a9875 100644
--- a/clang/test/Sema/format-strings.c
+++ b/clang/test/Sema/format-strings.c
@@ -1,8 +1,9 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs %s
// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -isystem %S/Inputs -fno-signed-char %s
-#define __need_wint_t
#include <stdarg.h>
+#include <stddef.h>
+#define __need_wint_t
#include <stddef.h> // For wint_t and wchar_t
typedef struct _FILE FILE;
OpenPOWER on IntegriCloud