# HG changeset patch # User kono # Date 1086789678 -32400 # Node ID fda28752d3019f8a9abbdabef14bfd9e63a65a3e # Parent 1ec915dcd2d1cb33e7aa59c08b1e0385f1c30e97 stdarg (varargs done... PowerPC, IA32 checked) diff -r 1ec915dcd2d1 -r fda28752d301 Changes --- a/Changes Wed Jun 09 15:59:06 2004 +0900 +++ b/Changes Wed Jun 09 23:01:18 2004 +0900 @@ -4853,3 +4853,11 @@ 切符買わないと。なんか、関数の引数の型のチェックをしてない みたい。 +stdarg できました。struct size のエラーはなに? + +えーと、 + alloca + asm + struct partial field init + hoge##name +がないね。というか、これだけ? (頑張れ〜) diff -r 1ec915dcd2d1 -r fda28752d301 Makefile --- a/Makefile Wed Jun 09 15:59:06 2004 +0900 +++ b/Makefile Wed Jun 09 23:01:18 2004 +0900 @@ -72,6 +72,7 @@ make check TARGET=test/enum make check TARGET=test/obsf make check TARGET=test/long + make check TARGET=test/tstdarg make check TARGET=test/code-gen-all #MK =-make MK= diff -r 1ec915dcd2d1 -r fda28752d301 mc-code-ia32.c --- 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; diff -r 1ec915dcd2d1 -r fda28752d301 mc-code-powerpc.c --- a/mc-code-powerpc.c Wed Jun 09 15:59:06 2004 +0900 +++ b/mc-code-powerpc.c Wed Jun 09 23:01:18 2004 +0900 @@ -2682,13 +2682,8 @@ void gen_comment(char *s) { - int c; if (chk) return; - printf("## "); - while((c=*s++)) { - putchar(c); - if (c=='\n') break; - } + printf("## %s",s); } void diff -r 1ec915dcd2d1 -r fda28752d301 mc-parse.c --- a/mc-parse.c Wed Jun 09 15:59:06 2004 +0900 +++ b/mc-parse.c Wed Jun 09 23:01:18 2004 +0900 @@ -4420,11 +4420,10 @@ chinput=0; continue; } - chptr=chinput; - while((c=*chinput++)&&(c!='\n')); - if (lsrc && !asmf && !macro_if_skip) gen_comment(chinput); - if (*chptr== '#' && !in_comment && !in_quote) { - if (macro_processing()) return; + chptr=linebuf; + i=0; + while((*chptr++=c=*chinput++)&&(c!='\n')) { + if (++i > LBUFSIZE-2) error(LNERR); } } else { lineno++; @@ -4438,11 +4437,11 @@ --chptr; } } - *chptr = '\0'; - if (lsrc && !asmf && !macro_if_skip) gen_comment(linebuf); - if (*(chptr = linebuf) == '#' && !in_comment && !in_quote) { - if (macro_processing()) return; - } + } + *chptr = '\0'; + if (lsrc && !asmf && !macro_if_skip) gen_comment(linebuf); + if (*(chptr = linebuf) == '#' && !in_comment && !in_quote) { + if (macro_processing()) return; } } while(!in_quote && (macro_if_skip || linebuf[0] == '#')); }