Mercurial > hg > CbC > old > device
changeset 183:1d80ad165831 gcc-header-pass
recursive macros
author | kono |
---|---|
date | Sun, 30 Nov 2003 23:30:14 +0900 |
parents | e1e9ec8c96a7 |
children | 4bf42b2df5d7 |
files | mc-code-ia32.c mc-parse.c mc.h test/macro.c |
diffstat | 4 files changed, 32 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-code-ia32.c Sun Nov 30 21:15:24 2003 +0900 +++ b/mc-code-ia32.c Sun Nov 30 23:30:14 2003 +0900 @@ -9,6 +9,7 @@ char *l_include_path[] = { "/usr/include/", "/usr/include/linux/", + "/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/", 0 }; @@ -163,6 +164,8 @@ 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"); arg_offset = 8; func_disp_offset = -12;
--- a/mc-parse.c Sun Nov 30 21:15:24 2003 +0900 +++ b/mc-parse.c Sun Nov 30 23:30:14 2003 +0900 @@ -535,7 +535,7 @@ getsym(0); t = INT; if(sym==LONG) { - getsym(0); + if(getsym(0)==INT) getsym(0); t=LONGLONG; } else if(sym==INT) { getsym(0); @@ -554,7 +554,7 @@ getsym(0); t = UNSIGNED; if(sym==LONG) { - getsym(0); + if(getsym(0)==INT) getsym(0); t=ULONGLONG; } else if(sym==INT) { getsym(0); @@ -608,6 +608,9 @@ NMTBL *n; if(sym==MUL) { getsym(0); + while (sym==KONST) { + getsym(0); + } n=decl0(); type=list2(POINTER,type); return n; @@ -3130,7 +3133,8 @@ { return (integral(s) || s==CODE || s==SHORT || s==LONG || s==STRUCT || s==UNION || s==ENUM || - s==LONGLONG || s==FLOAT || s==DOUBLE || + s==LONGLONG || s==FLOAT || s==DOUBLE || s==VOID || + s==ULONGLONG || (s==IDENT && nptr->sc==TYPE)); } @@ -3236,7 +3240,8 @@ return (symval=0); } } - if (nptrm->sc!=EMPTY&&(nptrm->sc!=FMACRO||skipspc()=='(')) { + if ((nptrm->sc==MACRO&&neqname((char *)car(nptrm->dsp),name)) || + (nptrm->sc==FMACRO&&skipspc()=='(')) { i = mode; mode = STAT; macrop = 0; @@ -3949,6 +3954,8 @@ macro_define0() { int i,args,c; + char *scheapp; + i=mode; mode=MDECL; // ch= *chptr; ?? @@ -3965,7 +3972,9 @@ nptr->sc = MACRO; nptr->ty = -1; } + while((c=*chptr)==' '||c=='\t') chptr++; nptr->dsp = list2((int)cheapp,args); /* macro body */ + scheapp = cheapp; while ((*cheapp++ = c = *chptr++) && c != '\n') { if (c=='/'&&chptr[0]=='/') { @@ -3985,8 +3994,12 @@ } } *cheapp++ = '\0'; +//fprintf(stderr,"before: *%s*\n",(char*)car(nptr->dsp)); + while(cheapp>scheapp&&(*cheapp=='\n'||*cheapp==0)) cheapp--; + *++cheapp = '\0'; cheapp++; if (cheapp >= cheap+CHEAPSIZE) /* too late? */ error(STRERR); +//fprintf(stderr,"after : *%s*\n",(char*)car(nptr->dsp)); // fprintf(stderr,"%s\n",(char *)car(nptr->dsp)); mode=i; } @@ -4168,7 +4181,10 @@ if (nptrm->sc==LMACRO) { while((*macropp++ = *macro++)); macropp[-1]=c; - } else if (nptrm->sc==MACRO) { + } else if (nptrm->sc==MACRO && neqname(namebuf,macro)) { + if (macro[0]==0) { + continue; + } *macropp++=0; macrop=macro_eval(macrop,macro,list2((int)macro,history)); if (c) {
--- a/mc.h Sun Nov 30 21:15:24 2003 +0900 +++ b/mc.h Sun Nov 30 23:30:14 2003 +0900 @@ -332,9 +332,9 @@ #define LSYMS 500 #define MSYMS 3000 -#define HEAPSIZE 20000 +#define HEAPSIZE 30000 /* #define CHEAPSIZE 3000 */ -#define CHEAPSIZE 256000 +#define CHEAPSIZE 356000 #define LBUFSIZE 4096 #define MACROSIZE 16000