[libc] Use __builtin_va_list et al in stdarg.h
authorMichael Brown <mcb30@etherboot.org>
Mon, 24 Mar 2008 00:23:11 +0000 (00:23 +0000)
committerMichael Brown <mcb30@etherboot.org>
Mon, 24 Mar 2008 00:23:11 +0000 (00:23 +0000)
The home-grown versions don't work properly for static variadic
functions, when gcc can choose to use a non-standard calling convention.

src/arch/i386/include/stdarg.h [deleted file]
src/include/stdarg.h [new file with mode: 0644]

diff --git a/src/arch/i386/include/stdarg.h b/src/arch/i386/include/stdarg.h
deleted file mode 100644 (file)
index 1742cb3..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef _STDARG_H
-#define _STDARG_H
-
-typedef void * va_list;
-
-#define va_start( ap, last ) do {      \
-               ap = ( &last + 1 );     \
-       } while ( 0 )
-
-#define va_arg( ap, type ) ({          \
-               type *_this = ap;       \
-               ap = ( _this + 1 );     \
-               *(_this);               \
-       })
-
-#define va_end( ap ) do { } while ( 0 )
-
-#define va_copy( dest, src ) do {      \
-               dest = src;             \
-       } while ( 0 )
-
-#endif /* _STDARG_H */
diff --git a/src/include/stdarg.h b/src/include/stdarg.h
new file mode 100644 (file)
index 0000000..a4eb711
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef _STDARG_H
+#define _STDARG_H
+
+typedef __builtin_va_list va_list;
+#define va_start( ap, last ) __builtin_va_start ( ap, last )
+#define va_arg( ap, type ) __builtin_va_arg ( ap, type )
+#define va_end( ap ) __builtin_va_end ( ap )
+#define va_copy( dest, src ) __builtin_va_copy ( dest, src )
+
+#endif /* _STDARG_H */