diff options
author | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2011-02-14 13:23:51 +0100 |
commit | 758ff64c69e34965f8af5b2d6ffd65e8d7ab2150 (patch) | |
tree | 6d6b34f8c678862fe9b56c945a7b63f68502c245 /src/cmd/cc/lex.c | |
parent | 3e45412327a2654a77944249962b3652e6142299 (diff) | |
download | golang-upstream/2011-02-01.1.tar.gz |
Imported Upstream version 2011-02-01.1upstream/2011-02-01.1
Diffstat (limited to 'src/cmd/cc/lex.c')
-rw-r--r-- | src/cmd/cc/lex.c | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/cmd/cc/lex.c b/src/cmd/cc/lex.c index 3b413c246..dba8ff634 100644 --- a/src/cmd/cc/lex.c +++ b/src/cmd/cc/lex.c @@ -59,15 +59,20 @@ pathchar(void) * -d print declarations * -D name define * -F format specification check + * -G print pgen stuff + * -g print cgen trees * -i print initialization * -I path include * -l generate little-endian code * -L print every NAME symbol * -M constant multiplication * -m print add/sub/mul trees - * -n print acid to file (%.c=%.acid) (with -a or -aa) + * -n print acid or godefs to file (%.c=%.acid) (with -a or -aa) * -o file output file * -p use standard cpp ANSI preprocessor (not on windows) + * -p something with peepholes + * -q print equivalent Go code for variables and types (lower-case identifiers) + * -Q print equivalent Go code for variables and types (upper-case identifiers) * -r print registerization * -s print structure offsets (with -a or -aa) * -S print assembly @@ -121,7 +126,7 @@ main(int argc, char *argv[]) p = ARGF(); if(p) { if(ndef%8 == 0) - defs = allocn(defs, ndef*sizeof(char *), + defs = allocn(defs, ndef*sizeof(char *), 8*sizeof(char *)); defs[ndef++] = p; dodefine(p); @@ -147,7 +152,7 @@ main(int argc, char *argv[]) * if we're writing acid to standard output, don't compile * concurrently, to avoid interleaving output. */ - if(((!debug['a'] && !debug['Z']) || debug['n']) && + if(((!debug['a'] && !debug['q'] && !debug['Q']) || debug['n']) && (p = getenv("NPROC")) != nil) nproc = atol(p); /* */ c = 0; @@ -220,8 +225,8 @@ compile(char *file, char **defs, int ndef) p = utfrune(outfile, 0); if(debug['a'] && debug['n']) strcat(p, ".acid"); - else if(debug['Z'] && debug['n']) - strcat(p, "_pickle.c"); + else if((debug['q'] || debug['Q']) && debug['n']) + strcat(p, ".go"); else { p[0] = '.'; p[1] = thechar; @@ -246,7 +251,7 @@ compile(char *file, char **defs, int ndef) * if we're writing acid to standard output, don't keep scratching * outbuf. */ - if((debug['a'] || debug['Z']) && !debug['n']) { + if((debug['a'] || debug['q'] || debug['Q']) && !debug['n']) { if (first) { outfile = 0; Binit(&outbuf, dup(1, -1), OWRITE); @@ -325,7 +330,7 @@ compile(char *file, char **defs, int ndef) newfile(file, -1); } yyparse(); - if(!debug['a'] && !debug['Z']) + if(!debug['a'] && !debug['q'] && !debug['Q']) gclean(); return nerrors; } @@ -1309,6 +1314,7 @@ cinit(void) fmtinstall('L', Lconv); fmtinstall('Q', Qconv); fmtinstall('|', VBconv); + fmtinstall('U', Uconv); } int @@ -1554,7 +1560,7 @@ setinclude(char *p) return; if(ninclude%8 == 0) - include = allocn(include, ninclude*sizeof(char *), + include = allocn(include, ninclude*sizeof(char *), 8*sizeof(char *)); include[ninclude++] = p; } @@ -1595,7 +1601,7 @@ ensuresymb(int32 n) if(symb == nil) { symb = alloc(NSYMB+1); nsymb = NSYMB; - } + } if(n > nsymb) { symb = allocn(symb, nsymb, n+1-nsymb); |