]> git.sur5r.net Git - cc65/blobdiff - src/common/va_copy.h
Fixed an error
[cc65] / src / common / va_copy.h
index d2be4ebc060de744a5e1609daf08de2ca6d6e785..ae7250ff364433b1bcdac5a05c90bae086585eed 100644 (file)
 
 
 
+/* No action if we're using a C99 compiler */
+#if (__STDC_VERSION__ < 199901)
+
+
+
+/* va_copy is not allowed to be defined */
+#if defined(va_copy)
+#error "The compiler is broken!"
+#endif
+
 /* The watcom compiler doesn't have va_copy and a problematic va_list definition */
 #if defined(__WATCOMC__)
+#define va_copy(dest,src)       memcpy((dest), (src), sizeof (va_list))
+#endif
 
-#define va_copy(src,dest)       memcpy((src), (dest), sizeof (va_list))
+/* GNU C has a builtin function */
+#if defined(__GNUC__)
+#define va_copy(dest,src)       __va_copy(dest, src)
+#endif
 
+/* If we don't have va_copy now, use a generic version */
+#if !defined(va_copy)
+#define va_copy(dest,src)       ((dest)=(src))
 #endif
 
 
 
+#endif  /* #if (__STDC_VERSION__ < 199901) */
+
+
+
 /* End of va_copy.h */
 #endif