]> granicus.if.org Git - clang/commitdiff
define __va_copy unconditionally, but va_copy only in c99 or non-ansi mode.
authorChris Lattner <sabre@nondot.org>
Tue, 7 Apr 2009 05:12:42 +0000 (05:12 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 7 Apr 2009 05:12:42 +0000 (05:12 +0000)
Fixes rdar://6759546, some code that actually used __va_copy because they
thought it was "more portable".

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68503 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Headers/stdarg.h

index b73edb4699b7fd3fc672809aa680cff27ed65f98..c436ced97c5faeb8da32f290e31b6d5cb8f9d561 100644 (file)
@@ -30,7 +30,15 @@ typedef __builtin_va_list va_list;
 #define va_start(ap, param) __builtin_va_start(ap, param)
 #define va_end(ap)          __builtin_va_end(ap)
 #define va_arg(ap, type)    __builtin_va_arg(ap, type)
+
+/* GCC always defines __va_copy, but does not define va_copy unless in c99 mode
+ * or -ansi is not specified, since it was not part of C90.
+ */
+#define __va_copy(d,s) __builtin_va_copy(d,s)
+
+#if __STDC_VERSION__ >= 199900L || !defined(__STRICT_ANSI__)
 #define va_copy(dest, src)  __builtin_va_copy(dest, src)
+#endif
 
 /* Hack required to make standard headers work, at least on Ubuntu */
 #define __GNUC_VA_LIST 1