[cfe-commits] r68503 - /cfe/trunk/lib/Headers/stdarg.h

Chris Lattner sabre at nondot.org
Mon Apr 6 22:12:42 PDT 2009


Author: lattner
Date: Tue Apr  7 00:12:42 2009
New Revision: 68503

URL: http://llvm.org/viewvc/llvm-project?rev=68503&view=rev
Log:
define __va_copy unconditionally, but va_copy only in c99 or non-ansi mode.
Fixes rdar://6759546, some code that actually used __va_copy because they
thought it was "more portable".

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=68503&r1=68502&r2=68503&view=diff

==============================================================================
--- cfe/trunk/lib/Headers/stdarg.h (original)
+++ cfe/trunk/lib/Headers/stdarg.h Tue Apr  7 00:12:42 2009
@@ -30,7 +30,15 @@
 #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





More information about the cfe-commits mailing list