probinson created this revision.
probinson added a reviewer: yaron.keren.
probinson added a subscriber: cfe-commits.

https://reviews.llvm.org/D28620

Files:
  lib/Headers/stdarg.h
  test/Headers/stdarg-gnuc_va_list.c


Index: test/Headers/stdarg-gnuc_va_list.c
===================================================================
--- test/Headers/stdarg-gnuc_va_list.c
+++ test/Headers/stdarg-gnuc_va_list.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wsystem-headers -std=c99 %s
+// expected-no-diagnostics
+
+// Check that no warnings are emitted from stdarg.h if __gnuc_va_list has
+// previously been defined in another header file.
+typedef __builtin_va_list __va_list;
+typedef __va_list __gnuc_va_list;
+#define __GNUC_VA_LIST
+
+#include <stdarg.h>
Index: lib/Headers/stdarg.h
===================================================================
--- lib/Headers/stdarg.h
+++ lib/Headers/stdarg.h
@@ -46,7 +46,7 @@
 /* Hack required to make standard headers work, at least on Ubuntu */
 #ifndef __GNUC_VA_LIST
 #define __GNUC_VA_LIST 1
-#endif
 typedef __builtin_va_list __gnuc_va_list;
+#endif
 
 #endif /* __STDARG_H */


Index: test/Headers/stdarg-gnuc_va_list.c
===================================================================
--- test/Headers/stdarg-gnuc_va_list.c
+++ test/Headers/stdarg-gnuc_va_list.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wsystem-headers -std=c99 %s
+// expected-no-diagnostics
+
+// Check that no warnings are emitted from stdarg.h if __gnuc_va_list has
+// previously been defined in another header file.
+typedef __builtin_va_list __va_list;
+typedef __va_list __gnuc_va_list;
+#define __GNUC_VA_LIST
+
+#include <stdarg.h>
Index: lib/Headers/stdarg.h
===================================================================
--- lib/Headers/stdarg.h
+++ lib/Headers/stdarg.h
@@ -46,7 +46,7 @@
 /* Hack required to make standard headers work, at least on Ubuntu */
 #ifndef __GNUC_VA_LIST
 #define __GNUC_VA_LIST 1
-#endif
 typedef __builtin_va_list __gnuc_va_list;
+#endif
 
 #endif /* __STDARG_H */
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to