r292819 - Guard __gnuc_va_list typedef.
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Mon Jan 23 11:09:21 PST 2017
Author: probinson
Date: Mon Jan 23 13:09:21 2017
New Revision: 292819
URL: http://llvm.org/viewvc/llvm-project?rev=292819&view=rev
Log:
Guard __gnuc_va_list typedef.
Differential Revision: http://reviews.llvm.org/D28620
Added:
cfe/trunk/test/Headers/stdarg-gnuc_va_list.c
Modified:
cfe/trunk/lib/Headers/stdarg.h
Modified: cfe/trunk/lib/Headers/stdarg.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/stdarg.h?rev=292819&r1=292818&r2=292819&view=diff
==============================================================================
--- cfe/trunk/lib/Headers/stdarg.h (original)
+++ cfe/trunk/lib/Headers/stdarg.h Mon Jan 23 13:09:21 2017
@@ -43,10 +43,9 @@ typedef __builtin_va_list va_list;
#define va_copy(dest, src) __builtin_va_copy(dest, src)
#endif
-/* 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 */
Added: cfe/trunk/test/Headers/stdarg-gnuc_va_list.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/stdarg-gnuc_va_list.c?rev=292819&view=auto
==============================================================================
--- cfe/trunk/test/Headers/stdarg-gnuc_va_list.c (added)
+++ cfe/trunk/test/Headers/stdarg-gnuc_va_list.c Mon Jan 23 13:09:21 2017
@@ -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>
More information about the cfe-commits
mailing list