added test for valist
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 14 Jun 2006 16:09:48 +0000 (16:09 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 14 Jun 2006 16:09:48 +0000 (16:09 +0000)
ir/be/test/valist.c [new file with mode: 0644]

diff --git a/ir/be/test/valist.c b/ir/be/test/valist.c
new file mode 100644 (file)
index 0000000..9d749e9
--- /dev/null
@@ -0,0 +1,23 @@
+#ifdef __GNUC__
+#define va_start(v,l)  __builtin_va_start(v,l)
+#define va_end(v)      __builtin_va_end(v)
+#define va_arg(v,l)    __builtin_va_arg(v,l)
+#define va_copy(d,s)   __builtin_va_copy(d,s)
+#else
+#include <stdarg.h>
+#endif
+
+char * foo(char *fmt, ...) {
+     va_list ap;
+     char *s;
+
+     va_start(ap, fmt);
+     s = va_arg(ap, char *);
+     va_end(ap);
+     return s;
+}
+
+int main()
+{
+  printf("<%s>\n", foo("bla", "blup"));
+}