diff mc-code-ia32.c @ 307:fda28752d301 stdarg-support

stdarg (varargs done... PowerPC, IA32 checked)
author kono
date Wed, 09 Jun 2004 23:01:18 +0900
parents 9df8aa0497ea
children a86612cf1a19
line wrap: on
line diff
--- a/mc-code-ia32.c	Wed Jun 09 15:59:06 2004 +0900
+++ b/mc-code-ia32.c	Wed Jun 09 23:01:18 2004 +0900
@@ -6,8 +6,6 @@
 #include "mc-codegen.h"
 #include "mc-code.h"
 
-char *init_src = 0;
-
 char *l_include_path[] = {
     "/usr/include/",
     "/usr/include/linux/",
@@ -217,20 +215,23 @@
     return i==REG_L?"%esi":"%eax";
 }
 
+char *init_src = "\
+#define va_list int\n\
+#define va_start(ap,arg) ap=(((int)(&arg))+sizeof(arg))\n\
+#define va_arg(ap,type)  (*((type *)ap)++)\n\
+#define va_end\n\
+#define __i386__ 1\n\
+#define __LITTLE_ENDIAN__ 1\n\
+#define __STDC__ 1\n\
+#define size_t int\n\
+#define __externsion__\n\
+#define __flexarr\n\
+#define wchar_t int\n\
+";
 
 void
 code_init(void)
 {
-    macro_define("__i386__ 1\n");
-    macro_define("__LITTLE_ENDIAN__ 1\n");
-    macro_define("__STDC__ 1\n");
-    macro_define("size_t int\n");
-    macro_define("__externsion__\n");
-    macro_define("__flexarr\n");
-    macro_define("__builtin_va_list int*\n");
-    macro_define("wchar_t int\n");
-    // macro_define("__THROW\n");
-    macro_define("__gnuc_va_list int*\n");
 
     arg_offset = 8;
     // func_disp_offset = -12;