r132 - in trunk: lcc lcc/cpp lcc/etc lcc/lburg lcc/lib lcc/src q3asm
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Mon Oct 3 21:21:35 EDT 2005
Author: tma
Date: 2005-10-03 21:21:34 -0400 (Mon, 03 Oct 2005)
New Revision: 132
Removed:
trunk/lcc/custom.mk
Modified:
trunk/lcc/cpp/cpp.c
trunk/lcc/cpp/getopt.c
trunk/lcc/cpp/include.c
trunk/lcc/cpp/lex.c
trunk/lcc/cpp/macro.c
trunk/lcc/cpp/nlist.c
trunk/lcc/cpp/tokens.c
trunk/lcc/etc/bprint.c
trunk/lcc/etc/lcc.c
trunk/lcc/etc/linux.c
trunk/lcc/lburg/gram.c
trunk/lcc/lib/bbexit.c
trunk/lcc/makefile
trunk/lcc/src/bind.c
trunk/lcc/src/bytecode.c
trunk/lcc/src/c.h
trunk/lcc/src/dag.c
trunk/lcc/src/decl.c
trunk/lcc/src/enode.c
trunk/lcc/src/expr.c
trunk/lcc/src/gen.c
trunk/lcc/src/init.c
trunk/lcc/src/inits.c
trunk/lcc/src/input.c
trunk/lcc/src/lex.c
trunk/lcc/src/null.c
trunk/lcc/src/output.c
trunk/lcc/src/prof.c
trunk/lcc/src/profio.c
trunk/lcc/src/simp.c
trunk/lcc/src/stab.c
trunk/lcc/src/stmt.c
trunk/lcc/src/sym.c
trunk/lcc/src/symbolic.c
trunk/lcc/src/trace.c
trunk/lcc/src/types.c
trunk/q3asm/Makefile
Log:
* Dewarninged the lcc and q3asm source
* Removed traditional target platforms from the lcc build. This might break
building lcc on Windows using nmake. Submit patches or be quiet :p
* Default target for lcc is now bytecode, so -Wf-target=bytecode is no longer
needed on the lcc command line
Modified: trunk/lcc/cpp/cpp.c
===================================================================
--- trunk/lcc/cpp/cpp.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/cpp.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -100,7 +100,7 @@
error(ERROR, "Unidentifiable control line");
return; /* else empty line */
}
- if ((np = lookup(tp, 0))==NULL || (np->flag&ISKW)==0 && !skipping) {
+ if ((np = lookup(tp, 0))==NULL || ((np->flag&ISKW)==0 && !skipping)) {
error(WARNING, "Unknown preprocessor control %t", tp);
return;
}
@@ -215,7 +215,7 @@
tp = trp->bp+2;
kline:
if (tp+1>=trp->lp || tp->type!=NUMBER || tp+3<trp->lp
- || (tp+3==trp->lp && ((tp+1)->type!=STRING)||*(tp+1)->t=='L')){
+ || ((tp+3==trp->lp && ((tp+1)->type!=STRING))||*(tp+1)->t=='L')){
error(ERROR, "Syntax error in #line");
return;
}
Modified: trunk/lcc/cpp/getopt.c
===================================================================
--- trunk/lcc/cpp/getopt.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/getopt.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -1,11 +1,11 @@
#include <stdio.h>
+#include <string.h>
#define EPR fprintf(stderr,
#define ERR(str, chr) if(opterr){EPR "%s%c\n", str, chr);}
int opterr = 1;
int optind = 1;
int optopt;
char *optarg;
-char *strchr();
int
getopt (int argc, char *const argv[], const char *opts)
@@ -14,7 +14,7 @@
int c;
char *cp;
- if (sp == 1)
+ if (sp == 1) {
if (optind >= argc ||
argv[optind][0] != '-' || argv[optind][1] == '\0')
return -1;
@@ -22,6 +22,7 @@
optind++;
return -1;
}
+ }
optopt = c = argv[optind][sp];
if (c == ':' || (cp=strchr(opts, c)) == 0) {
ERR (": illegal option -- ", c);
Modified: trunk/lcc/cpp/include.c
===================================================================
--- trunk/lcc/cpp/include.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/include.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -59,7 +59,7 @@
if ((fd = open(iname, 0)) >= 0)
break;
}
- if ( Mflag>1 || !angled&&Mflag==1 ) {
+ if ( Mflag>1 || (!angled&&Mflag==1) ) {
write(1,objname,strlen(objname));
write(1,iname,strlen(iname));
write(1,"\n",1);
Modified: trunk/lcc/cpp/lex.c
===================================================================
--- trunk/lcc/cpp/lex.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/lex.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -52,183 +52,183 @@
/*const*/ struct fsm fsm[] = {
/* start state */
- START, { C_XX }, ACT(UNCLASS,S_SELF),
- START, { ' ', '\t', '\v' }, WS1,
- START, { C_NUM }, NUM1,
- START, { '.' }, NUM3,
- START, { C_ALPH }, ID1,
- START, { 'L' }, ST1,
- START, { '"' }, ST2,
- START, { '\'' }, CC1,
- START, { '/' }, COM1,
- START, { EOFC }, S_EOF,
- START, { '\n' }, S_NL,
- START, { '-' }, MINUS1,
- START, { '+' }, PLUS1,
- START, { '<' }, LT1,
- START, { '>' }, GT1,
- START, { '=' }, ASG1,
- START, { '!' }, NOT1,
- START, { '&' }, AND1,
- START, { '|' }, OR1,
- START, { '#' }, SHARP1,
- START, { '%' }, PCT1,
- START, { '[' }, ACT(SBRA,S_SELF),
- START, { ']' }, ACT(SKET,S_SELF),
- START, { '(' }, ACT(LP,S_SELF),
- START, { ')' }, ACT(RP,S_SELF),
- START, { '*' }, STAR1,
- START, { ',' }, ACT(COMMA,S_SELF),
- START, { '?' }, ACT(QUEST,S_SELF),
- START, { ':' }, ACT(COLON,S_SELF),
- START, { ';' }, ACT(SEMIC,S_SELF),
- START, { '{' }, ACT(CBRA,S_SELF),
- START, { '}' }, ACT(CKET,S_SELF),
- START, { '~' }, ACT(TILDE,S_SELF),
- START, { '^' }, CIRC1,
+ {START, { C_XX }, ACT(UNCLASS,S_SELF)},
+ {START, { ' ', '\t', '\v' }, WS1},
+ {START, { C_NUM }, NUM1},
+ {START, { '.' }, NUM3},
+ {START, { C_ALPH }, ID1},
+ {START, { 'L' }, ST1},
+ {START, { '"' }, ST2},
+ {START, { '\'' }, CC1},
+ {START, { '/' }, COM1},
+ {START, { EOFC }, S_EOF},
+ {START, { '\n' }, S_NL},
+ {START, { '-' }, MINUS1},
+ {START, { '+' }, PLUS1},
+ {START, { '<' }, LT1},
+ {START, { '>' }, GT1},
+ {START, { '=' }, ASG1},
+ {START, { '!' }, NOT1},
+ {START, { '&' }, AND1},
+ {START, { '|' }, OR1},
+ {START, { '#' }, SHARP1},
+ {START, { '%' }, PCT1},
+ {START, { '[' }, ACT(SBRA,S_SELF)},
+ {START, { ']' }, ACT(SKET,S_SELF)},
+ {START, { '(' }, ACT(LP,S_SELF)},
+ {START, { ')' }, ACT(RP,S_SELF)},
+ {START, { '*' }, STAR1},
+ {START, { ',' }, ACT(COMMA,S_SELF)},
+ {START, { '?' }, ACT(QUEST,S_SELF)},
+ {START, { ':' }, ACT(COLON,S_SELF)},
+ {START, { ';' }, ACT(SEMIC,S_SELF)},
+ {START, { '{' }, ACT(CBRA,S_SELF)},
+ {START, { '}' }, ACT(CKET,S_SELF)},
+ {START, { '~' }, ACT(TILDE,S_SELF)},
+ {START, { '^' }, CIRC1},
/* saw a digit */
- NUM1, { C_XX }, ACT(NUMBER,S_SELFB),
- NUM1, { C_NUM, C_ALPH, '.' }, NUM1,
- NUM1, { 'E', 'e' }, NUM2,
- NUM1, { '_' }, ACT(NUMBER,S_SELFB),
+ {NUM1, { C_XX }, ACT(NUMBER,S_SELFB)},
+ {NUM1, { C_NUM, C_ALPH, '.' }, NUM1},
+ {NUM1, { 'E', 'e' }, NUM2},
+ {NUM1, { '_' }, ACT(NUMBER,S_SELFB)},
/* saw possible start of exponent, digits-e */
- NUM2, { C_XX }, ACT(NUMBER,S_SELFB),
- NUM2, { '+', '-' }, NUM1,
- NUM2, { C_NUM, C_ALPH }, NUM1,
- NUM2, { '_' }, ACT(NUMBER,S_SELFB),
+ {NUM2, { C_XX }, ACT(NUMBER,S_SELFB)},
+ {NUM2, { '+', '-' }, NUM1},
+ {NUM2, { C_NUM, C_ALPH }, NUM1},
+ {NUM2, { '_' }, ACT(NUMBER,S_SELFB)},
/* saw a '.', which could be a number or an operator */
- NUM3, { C_XX }, ACT(DOT,S_SELFB),
- NUM3, { '.' }, DOTS1,
- NUM3, { C_NUM }, NUM1,
+ {NUM3, { C_XX }, ACT(DOT,S_SELFB)},
+ {NUM3, { '.' }, DOTS1},
+ {NUM3, { C_NUM }, NUM1},
- DOTS1, { C_XX }, ACT(UNCLASS, S_SELFB),
- DOTS1, { C_NUM }, NUM1,
- DOTS1, { '.' }, ACT(ELLIPS, S_SELF),
+ {DOTS1, { C_XX }, ACT(UNCLASS, S_SELFB)},
+ {DOTS1, { C_NUM }, NUM1},
+ {DOTS1, { '.' }, ACT(ELLIPS, S_SELF)},
/* saw a letter or _ */
- ID1, { C_XX }, ACT(NAME,S_NAME),
- ID1, { C_ALPH, C_NUM }, ID1,
+ {ID1, { C_XX }, ACT(NAME,S_NAME)},
+ {ID1, { C_ALPH, C_NUM }, ID1},
/* saw L (start of wide string?) */
- ST1, { C_XX }, ACT(NAME,S_NAME),
- ST1, { C_ALPH, C_NUM }, ID1,
- ST1, { '"' }, ST2,
- ST1, { '\'' }, CC1,
+ {ST1, { C_XX }, ACT(NAME,S_NAME)},
+ {ST1, { C_ALPH, C_NUM }, ID1},
+ {ST1, { '"' }, ST2},
+ {ST1, { '\'' }, CC1},
/* saw " beginning string */
- ST2, { C_XX }, ST2,
- ST2, { '"' }, ACT(STRING, S_SELF),
- ST2, { '\\' }, ST3,
- ST2, { '\n' }, S_STNL,
- ST2, { EOFC }, S_EOFSTR,
+ {ST2, { C_XX }, ST2},
+ {ST2, { '"' }, ACT(STRING, S_SELF)},
+ {ST2, { '\\' }, ST3},
+ {ST2, { '\n' }, S_STNL},
+ {ST2, { EOFC }, S_EOFSTR},
/* saw \ in string */
- ST3, { C_XX }, ST2,
- ST3, { '\n' }, S_STNL,
- ST3, { EOFC }, S_EOFSTR,
+ {ST3, { C_XX }, ST2},
+ {ST3, { '\n' }, S_STNL},
+ {ST3, { EOFC }, S_EOFSTR},
/* saw ' beginning character const */
- CC1, { C_XX }, CC1,
- CC1, { '\'' }, ACT(CCON, S_SELF),
- CC1, { '\\' }, CC2,
- CC1, { '\n' }, S_STNL,
- CC1, { EOFC }, S_EOFSTR,
+ {CC1, { C_XX }, CC1},
+ {CC1, { '\'' }, ACT(CCON, S_SELF)},
+ {CC1, { '\\' }, CC2},
+ {CC1, { '\n' }, S_STNL},
+ {CC1, { EOFC }, S_EOFSTR},
/* saw \ in ccon */
- CC2, { C_XX }, CC1,
- CC2, { '\n' }, S_STNL,
- CC2, { EOFC }, S_EOFSTR,
+ {CC2, { C_XX }, CC1},
+ {CC2, { '\n' }, S_STNL},
+ {CC2, { EOFC }, S_EOFSTR},
/* saw /, perhaps start of comment */
- COM1, { C_XX }, ACT(SLASH, S_SELFB),
- COM1, { '=' }, ACT(ASSLASH, S_SELF),
- COM1, { '*' }, COM2,
- COM1, { '/' }, COM4,
+ {COM1, { C_XX }, ACT(SLASH, S_SELFB)},
+ {COM1, { '=' }, ACT(ASSLASH, S_SELF)},
+ {COM1, { '*' }, COM2},
+ {COM1, { '/' }, COM4},
/* saw / then *, start of comment */
- COM2, { C_XX }, COM2,
- COM2, { '\n' }, S_COMNL,
- COM2, { '*' }, COM3,
- COM2, { EOFC }, S_EOFCOM,
+ {COM2, { C_XX }, COM2},
+ {COM2, { '\n' }, S_COMNL},
+ {COM2, { '*' }, COM3},
+ {COM2, { EOFC }, S_EOFCOM},
/* saw the * possibly ending a comment */
- COM3, { C_XX }, COM2,
- COM3, { '\n' }, S_COMNL,
- COM3, { '*' }, COM3,
- COM3, { '/' }, S_COMMENT,
+ {COM3, { C_XX }, COM2},
+ {COM3, { '\n' }, S_COMNL},
+ {COM3, { '*' }, COM3},
+ {COM3, { '/' }, S_COMMENT},
/* // comment */
- COM4, { C_XX }, COM4,
- COM4, { '\n' }, S_NL,
- COM4, { EOFC }, S_EOFCOM,
+ {COM4, { C_XX }, COM4},
+ {COM4, { '\n' }, S_NL},
+ {COM4, { EOFC }, S_EOFCOM},
/* saw white space, eat it up */
- WS1, { C_XX }, S_WS,
- WS1, { ' ', '\t', '\v' }, WS1,
+ {WS1, { C_XX }, S_WS},
+ {WS1, { ' ', '\t', '\v' }, WS1},
/* saw -, check --, -=, -> */
- MINUS1, { C_XX }, ACT(MINUS, S_SELFB),
- MINUS1, { '-' }, ACT(MMINUS, S_SELF),
- MINUS1, { '=' }, ACT(ASMINUS,S_SELF),
- MINUS1, { '>' }, ACT(ARROW,S_SELF),
+ {MINUS1, { C_XX }, ACT(MINUS, S_SELFB)},
+ {MINUS1, { '-' }, ACT(MMINUS, S_SELF)},
+ {MINUS1, { '=' }, ACT(ASMINUS,S_SELF)},
+ {MINUS1, { '>' }, ACT(ARROW,S_SELF)},
/* saw +, check ++, += */
- PLUS1, { C_XX }, ACT(PLUS, S_SELFB),
- PLUS1, { '+' }, ACT(PPLUS, S_SELF),
- PLUS1, { '=' }, ACT(ASPLUS, S_SELF),
+ {PLUS1, { C_XX }, ACT(PLUS, S_SELFB)},
+ {PLUS1, { '+' }, ACT(PPLUS, S_SELF)},
+ {PLUS1, { '=' }, ACT(ASPLUS, S_SELF)},
/* saw <, check <<, <<=, <= */
- LT1, { C_XX }, ACT(LT, S_SELFB),
- LT1, { '<' }, LT2,
- LT1, { '=' }, ACT(LEQ, S_SELF),
- LT2, { C_XX }, ACT(LSH, S_SELFB),
- LT2, { '=' }, ACT(ASLSH, S_SELF),
+ {LT1, { C_XX }, ACT(LT, S_SELFB)},
+ {LT1, { '<' }, LT2},
+ {LT1, { '=' }, ACT(LEQ, S_SELF)},
+ {LT2, { C_XX }, ACT(LSH, S_SELFB)},
+ {LT2, { '=' }, ACT(ASLSH, S_SELF)},
/* saw >, check >>, >>=, >= */
- GT1, { C_XX }, ACT(GT, S_SELFB),
- GT1, { '>' }, GT2,
- GT1, { '=' }, ACT(GEQ, S_SELF),
- GT2, { C_XX }, ACT(RSH, S_SELFB),
- GT2, { '=' }, ACT(ASRSH, S_SELF),
+ {GT1, { C_XX }, ACT(GT, S_SELFB)},
+ {GT1, { '>' }, GT2},
+ {GT1, { '=' }, ACT(GEQ, S_SELF)},
+ {GT2, { C_XX }, ACT(RSH, S_SELFB)},
+ {GT2, { '=' }, ACT(ASRSH, S_SELF)},
/* = */
- ASG1, { C_XX }, ACT(ASGN, S_SELFB),
- ASG1, { '=' }, ACT(EQ, S_SELF),
+ {ASG1, { C_XX }, ACT(ASGN, S_SELFB)},
+ {ASG1, { '=' }, ACT(EQ, S_SELF)},
/* ! */
- NOT1, { C_XX }, ACT(NOT, S_SELFB),
- NOT1, { '=' }, ACT(NEQ, S_SELF),
+ {NOT1, { C_XX }, ACT(NOT, S_SELFB)},
+ {NOT1, { '=' }, ACT(NEQ, S_SELF)},
/* & */
- AND1, { C_XX }, ACT(AND, S_SELFB),
- AND1, { '&' }, ACT(LAND, S_SELF),
- AND1, { '=' }, ACT(ASAND, S_SELF),
+ {AND1, { C_XX }, ACT(AND, S_SELFB)},
+ {AND1, { '&' }, ACT(LAND, S_SELF)},
+ {AND1, { '=' }, ACT(ASAND, S_SELF)},
/* | */
- OR1, { C_XX }, ACT(OR, S_SELFB),
- OR1, { '|' }, ACT(LOR, S_SELF),
- OR1, { '=' }, ACT(ASOR, S_SELF),
+ {OR1, { C_XX }, ACT(OR, S_SELFB)},
+ {OR1, { '|' }, ACT(LOR, S_SELF)},
+ {OR1, { '=' }, ACT(ASOR, S_SELF)},
/* # */
- SHARP1, { C_XX }, ACT(SHARP, S_SELFB),
- SHARP1, { '#' }, ACT(DSHARP, S_SELF),
+ {SHARP1, { C_XX }, ACT(SHARP, S_SELFB)},
+ {SHARP1, { '#' }, ACT(DSHARP, S_SELF)},
/* % */
- PCT1, { C_XX }, ACT(PCT, S_SELFB),
- PCT1, { '=' }, ACT(ASPCT, S_SELF),
+ {PCT1, { C_XX }, ACT(PCT, S_SELFB)},
+ {PCT1, { '=' }, ACT(ASPCT, S_SELF)},
/* * */
- STAR1, { C_XX }, ACT(STAR, S_SELFB),
- STAR1, { '=' }, ACT(ASSTAR, S_SELF),
+ {STAR1, { C_XX }, ACT(STAR, S_SELFB)},
+ {STAR1, { '=' }, ACT(ASSTAR, S_SELF)},
/* ^ */
- CIRC1, { C_XX }, ACT(CIRC, S_SELFB),
- CIRC1, { '=' }, ACT(ASCIRC, S_SELF),
+ {CIRC1, { C_XX }, ACT(CIRC, S_SELFB)},
+ {CIRC1, { '=' }, ACT(ASCIRC, S_SELF)},
- -1
+ {-1}
};
/* first index is char, second is state */
@@ -254,7 +254,7 @@
continue;
case C_ALPH:
for (j=0; j<=256; j++)
- if ('a'<=j&&j<='z' || 'A'<=j&&j<='Z'
+ if (('a'<=j&&j<='z') || ('A'<=j&&j<='Z')
|| j=='_')
bigfsm[j][fp->state] = nstate;
continue;
@@ -305,7 +305,6 @@
int runelen;
Source *s = cursource;
int nmac = 0;
- extern char outbuf[];
tp = trp->lp;
ip = s->inp;
Modified: trunk/lcc/cpp/macro.c
===================================================================
--- trunk/lcc/cpp/macro.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/macro.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -71,7 +71,7 @@
if (np->flag&ISDEFINED) {
if (comparetokens(def, np->vp)
|| (np->ap==NULL) != (args==NULL)
- || np->ap && comparetokens(args, np->ap))
+ || (np->ap && comparetokens(args, np->ap)))
error(ERROR, "Macro redefinition of %t", trp->bp+2);
}
if (args) {
@@ -141,7 +141,7 @@
|| quicklook(tp->t[0], tp->len>1?tp->t[1]:0)==0
|| (np = lookup(tp, 0))==NULL
|| (np->flag&(ISDEFINED|ISMAC))==0
- || tp->hideset && checkhideset(tp->hideset, np)) {
+ || (tp->hideset && checkhideset(tp->hideset, np))) {
tp++;
continue;
}
@@ -300,7 +300,7 @@
parens--;
if (lp->type==DSHARP)
lp->type = DSHARP1; /* ## not special in arg */
- if (lp->type==COMMA && parens==0 || parens<0 && (lp-1)->type!=LP) {
+ if ((lp->type==COMMA && parens==0) || (parens<0 && (lp-1)->type!=LP)) {
if (*narg>=NARG-1)
error(FATAL, "Sorry, too many macro arguments");
ttr.bp = ttr.tp = bp;
@@ -339,7 +339,7 @@
if (rtr->tp->type==NAME
&& (argno = lookuparg(np, rtr->tp)) >= 0) {
if ((rtr->tp+1)->type==DSHARP
- || rtr->tp!=rtr->bp && (rtr->tp-1)->type==DSHARP)
+ || (rtr->tp!=rtr->bp && (rtr->tp-1)->type==DSHARP))
insertrow(rtr, 1, atr[argno]);
else {
copytokenrow(&tatr, atr[argno]);
Modified: trunk/lcc/cpp/nlist.c
===================================================================
--- trunk/lcc/cpp/nlist.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/nlist.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -20,26 +20,26 @@
int val;
int flag;
} kwtab[] = {
- "if", KIF, ISKW,
- "ifdef", KIFDEF, ISKW,
- "ifndef", KIFNDEF, ISKW,
- "elif", KELIF, ISKW,
- "else", KELSE, ISKW,
- "endif", KENDIF, ISKW,
- "include", KINCLUDE, ISKW,
- "define", KDEFINE, ISKW,
- "undef", KUNDEF, ISKW,
- "line", KLINE, ISKW,
- "error", KERROR, ISKW,
- "pragma", KPRAGMA, ISKW,
- "eval", KEVAL, ISKW,
- "defined", KDEFINED, ISDEFINED+ISUNCHANGE,
- "__LINE__", KLINENO, ISMAC+ISUNCHANGE,
- "__FILE__", KFILE, ISMAC+ISUNCHANGE,
- "__DATE__", KDATE, ISMAC+ISUNCHANGE,
- "__TIME__", KTIME, ISMAC+ISUNCHANGE,
- "__STDC__", KSTDC, ISUNCHANGE,
- NULL
+ {"if", KIF, ISKW},
+ {"ifdef", KIFDEF, ISKW},
+ {"ifndef", KIFNDEF, ISKW},
+ {"elif", KELIF, ISKW},
+ {"else", KELSE, ISKW},
+ {"endif", KENDIF, ISKW},
+ {"include", KINCLUDE, ISKW},
+ {"define", KDEFINE, ISKW},
+ {"undef", KUNDEF, ISKW},
+ {"line", KLINE, ISKW},
+ {"error", KERROR, ISKW},
+ {"pragma", KPRAGMA, ISKW},
+ {"eval", KEVAL, ISKW},
+ {"defined", KDEFINED, ISDEFINED+ISUNCHANGE},
+ {"__LINE__", KLINENO, ISMAC+ISUNCHANGE},
+ {"__FILE__", KFILE, ISMAC+ISUNCHANGE},
+ {"__DATE__", KDATE, ISMAC+ISUNCHANGE},
+ {"__TIME__", KTIME, ISMAC+ISUNCHANGE},
+ {"__STDC__", KSTDC, ISUNCHANGE},
+ {NULL}
};
unsigned long namebit[077+1];
Modified: trunk/lcc/cpp/tokens.c
===================================================================
--- trunk/lcc/cpp/tokens.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/cpp/tokens.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -154,14 +154,14 @@
return;
if (tp->wslen) {
if (tp->flag&XPWS
- && (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])) {
+ && (wstab[tp->type] || (trp->tp>trp->bp && wstab[(tp-1)->type]))) {
tp->wslen = 0;
return;
}
tp->t[-1] = ' ';
return;
}
- if (wstab[tp->type] || trp->tp>trp->bp && wstab[(tp-1)->type])
+ if (wstab[tp->type] || (trp->tp>trp->bp && wstab[(tp-1)->type]))
return;
tt = newstring(tp->t, tp->len, 1);
*tt++ = ' ';
Deleted: trunk/lcc/custom.mk
===================================================================
--- trunk/lcc/custom.mk 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/custom.mk 2005-10-04 01:21:34 UTC (rev 132)
@@ -1 +0,0 @@
-BUILDDIR=.obj
Modified: trunk/lcc/etc/bprint.c
===================================================================
--- trunk/lcc/etc/bprint.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/etc/bprint.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -70,7 +70,7 @@
void emitdata(char *file) {
FILE *fp;
- if (fp = fopen(file, "w")) {
+ if ((fp = fopen(file, "w"))) {
struct file *p;
for (p = filelist; p; p = p->link) {
int i;
@@ -78,7 +78,7 @@
struct caller *r;
fprintf(fp, "1\n%s\n", p->name);
for (i = 0, q = p->funcs; q; i++, q = q->link)
- if (r = q->callers)
+ if ((r = q->callers))
for (i--; r; r = r->link)
i++;
fprintf(fp, "%d\n", i);
@@ -109,7 +109,7 @@
for (i = 0; dirs[i]; i++) {
char buf[200];
sprintf(buf, "%s/%s", dirs[i], name);
- if (fp = fopen(buf, "r"))
+ if ((fp = fopen(buf, "r")))
return fp;
}
return fopen(name, "r");
@@ -297,9 +297,9 @@
struct count *c = cursor->counts;
for (l = 0, u = cursor->count - 1; l <= u; ) {
int k = (l + u)/2;
- if (c[k].y > y || c[k].y == y && c[k].x > x)
+ if (c[k].y > y || (c[k].y == y && c[k].x > x))
u = k - 1;
- else if (c[k].y < y || c[k].y == y && c[k].x < x)
+ else if (c[k].y < y || (c[k].y == y && c[k].x < x))
l = k + 1;
else
return c[k].count;
@@ -461,7 +461,7 @@
if (i < argc) {
int nf = i < argc - 1 ? 1 : 0;
for ( ; i < argc; i++, nf ? nf++ : 0)
- if (p = findfile(string(argv[i])))
+ if ((p = findfile(string(argv[i]))))
(*f)(p, nf);
else
fprintf(stderr, "%s: no data for `%s'\n", progname, argv[i]);
Modified: trunk/lcc/etc/lcc.c
===================================================================
--- trunk/lcc/etc/lcc.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/etc/lcc.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -11,6 +11,7 @@
#include <assert.h>
#include <ctype.h>
#include <signal.h>
+#include <unistd.h>
#ifndef TEMPDIR
#define TEMPDIR "/tmp"
@@ -47,7 +48,6 @@
extern int suffix(char *, char *[], int);
extern char *tempname(char *);
-extern int access(char *, int);
extern int getpid(void);
extern char *cpp[], *include[], *com[], *as[],*ld[], inputs[], *suffixes[];
@@ -71,7 +71,7 @@
static char *progname;
static List lccinputs; /* list of input directories */
-main(int argc, char *argv[]) {
+int main(int argc, char *argv[]) {
int i, j, nf;
progname = argv[0];
@@ -93,7 +93,7 @@
tempdir = getenv("TMPDIR");
assert(tempdir);
i = strlen(tempdir);
- for (; i > 0 && tempdir[i-1] == '/' || tempdir[i-1] == '\\'; i--)
+ for (; (i > 0 && tempdir[i-1] == '/') || tempdir[i-1] == '\\'; i--)
tempdir[i-1] = '\0';
if (argc <= 1) {
help();
@@ -149,7 +149,7 @@
char *name = exists(argv[i]);
if (name) {
if (strcmp(name, argv[i]) != 0
- || nf > 1 && suffix(name, suffixes, 3) >= 0)
+ || (nf > 1 && suffix(name, suffixes, 3) >= 0))
fprintf(stderr, "%s:\n", name);
filename(name, 0);
} else
@@ -214,7 +214,6 @@
#define _P_WAIT 0
extern int fork(void);
extern int wait(int *);
-extern void execv(const char *, char *[]);
static int _spawnvp(int mode, const char *cmdname, char *argv[]) {
int pid, n, status;
@@ -261,7 +260,7 @@
}
for (i = 0; status == 0 && av[i] != NULL; ) {
int j = 0;
- char *s;
+ char *s = NULL;
for ( ; av[i] != NULL && (s = strchr(av[i], '\n')) == NULL; i++)
argv[j++] = av[i];
if (s != NULL) {
@@ -319,7 +318,7 @@
if (s && isdigit(s[1])) {
int k = s[1] - '0';
assert(k >=1 && k <= 3);
- if (b = lists[k-1]) {
+ if ((b = lists[k-1])) {
b = b->link;
av[j] = alloc(strlen(cmd[i]) + strlen(b->str) - 1);
strncpy(av[j], cmd[i], s - cmd[i]);
@@ -452,7 +451,7 @@
static List find(char *str, List list) {
List b;
- if (b = list)
+ if ((b = list))
do {
if (strcmp(str, b->str) == 0)
return b;
@@ -508,7 +507,7 @@
if (strncmp("-tempdir", msgs[i], 8) == 0 && tempdir)
fprintf(stderr, "; default=%s", tempdir);
}
-#define xx(v) if (s = getenv(#v)) fprintf(stderr, #v "=%s\n", s)
+#define xx(v) if ((s = getenv(#v))) fprintf(stderr, #v "=%s\n", s)
xx(LCCINPUTS);
xx(LCCDIR);
#ifdef WIN32
@@ -521,13 +520,13 @@
/* initinputs - if LCCINPUTS or include is defined, use them to initialize various lists */
static void initinputs(void) {
char *s = getenv("LCCINPUTS");
- List list, b;
+ List b;
if (s == 0 || (s = inputs)[0] == 0)
s = ".";
if (s) {
lccinputs = path2list(s);
- if (b = lccinputs)
+ if ((b = lccinputs))
do {
b = b->link;
if (strcmp(b->str, ".") != 0) {
@@ -701,7 +700,7 @@
sep = ';';
while (*path) {
char *p, buf[512];
- if (p = strchr(path, sep)) {
+ if ((p = strchr(path, sep))) {
assert(p - path < sizeof buf);
strncpy(buf, path, p - path);
buf[p-path] = '\0';
@@ -767,7 +766,7 @@
for (i = 0; i < n; i++) {
char *s = tails[i], *t;
- for ( ; t = strchr(s, ';'); s = t + 1) {
+ for ( ; (t = strchr(s, ';')); s = t + 1) {
int m = t - s;
if (len > m && strncmp(&name[len-m], s, m) == 0)
return i;
Modified: trunk/lcc/etc/linux.c
===================================================================
--- trunk/lcc/etc/linux.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/etc/linux.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -2,8 +2,6 @@
#include <string.h>
-static char rcsid[] = "Dummy rcsid";
-
/*
TTimo - 10-18-2001
our binaries are named q3lcc q3rcc and q3cpp
@@ -26,7 +24,7 @@
"$1", "$2", "$3", 0 };
char *include[] = {"-I" LCCDIR "include", "-I" LCCDIR "gcc/include", "-I/usr/include",
"-I" SYSTEM "include", 0 };
-char *com[] = {LCCDIR "q3rcc", "-target=x86/linux", "$1", "$2", "$3", 0 };
+char *com[] = {LCCDIR "q3rcc", "-target=bytecode", "$1", "$2", "$3", 0 };
char *as[] = { "/usr/bin/as", "-o", "$3", "$1", "$2", 0 };
// NOTE TTimo I don't think we have any use with the native linkage
// our target is always bytecode..
Modified: trunk/lcc/lburg/gram.c
===================================================================
--- trunk/lcc/lburg/gram.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/lburg/gram.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -18,9 +18,9 @@
#ifndef YYDONT_INCLUDE_STDIO
#include <stdio.h>
#endif
-#ifdef __cplusplus
+//#ifdef __cplusplus TA <tim at ngus.net> stdlib.h applies to C too
#include <stdlib.h> /* for malloc/realloc/free */
-#endif
+//#endif
#line 2 "lburg/gram.y"
#include <stdio.h>
#include "lburg.h"
@@ -227,7 +227,9 @@
#endif
yygrow ()
{
+#if YYDEBUG
int old_stacksize = yystacksize;
+#endif
short *new_yyss;
YYSTYPE *new_yyvs;
@@ -469,7 +471,7 @@
*++yyvsp = yyval;
yyloop:
- if (yyn = yydefred[yystate]) goto yyreduce;
+ if ((yyn = yydefred[yystate])) goto yyreduce;
yyn = yysindex[yystate];
if (yychar < 0)
{
@@ -509,13 +511,13 @@
if (yyerrflag) goto yyinrecovery;
#ifdef lint
goto yynewerror;
+yynewerror:
#endif
-yynewerror:
yyerror("syntax error");
#ifdef lint
goto yyerrlab;
+yyerrlab:
#endif
-yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
Modified: trunk/lcc/lib/bbexit.c
===================================================================
--- trunk/lcc/lib/bbexit.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/lib/bbexit.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -55,7 +55,7 @@
for (i = 0; p->files[i]; i++)
fprintf(fp, "%s\n", p->files[i]);
for (i = 0, f = p->funcs; f; i++, f = f->link)
- if (q = f->callers)
+ if ((q = f->callers))
for (i--; q; q = q->link)
i++;
fprintf(fp, "%d\n", i);
Modified: trunk/lcc/makefile
===================================================================
--- trunk/lcc/makefile 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/makefile 2005-10-04 01:21:34 UTC (rev 132)
@@ -5,7 +5,7 @@
O=.o
E=
CC=cc
-CFLAGS=-g -Wall
+CFLAGS=-O2 -Wall -fno-strict-aliasing
LDFLAGS=
LD=cc
AR=ar ruv
@@ -13,9 +13,8 @@
DIFF=diff
RM=rm -f
RMDIR=rmdir
+BUILDDIR=build
TSTDIR=$(BUILDDIR)/$(TARGET)/tst
-CUSTOM=custom.mk
-include $(CUSTOM)
B=$(BUILDDIR)/
T=$(TSTDIR)/
@@ -24,14 +23,18 @@
what:
- at echo make all q3rcc lburg q3cpp q3lcc bprint liblcc triple clean clobber
+makedirs:
+ @if [ ! -d $(B) ];then mkdir $(B);fi
+ @if [ ! -d $(T) ];then mkdir $(T);fi
+
all:: q3rcc lburg q3cpp q3lcc bprint liblcc
-q3rcc: $Bq3rcc$E
-lburg: $Blburg$E
-q3cpp: $Bq3cpp$E
-q3lcc: $Bq3lcc$E
-bprint: $Bbprint$E
-liblcc: $Bliblcc$A
+q3rcc: makedirs $Bq3rcc$E
+lburg: makedirs $Blburg$E
+q3cpp: makedirs $Bq3cpp$E
+q3lcc: makedirs $Bq3lcc$E
+bprint: makedirs $Bbprint$E
+liblcc: makedirs $Bliblcc$A
RCCOBJS=$Balloc$O \
$Bbind$O \
@@ -61,13 +64,7 @@
$Bnull$O \
$Bsymbolic$O \
$Bgen$O \
- $Bbytecode$O \
- $Balpha$O \
- $Bmips$O \
- $Bsparc$O \
- $Bstab$O \
- $Bx86$O \
- $Bx86linux$O
+ $Bbytecode$O
$Bq3rcc$E:: $Bmain$O $Blibrcc$A $(EXTRAOBJS)
$(LD) $(LDFLAGS) -o $@ $Bmain$O $(EXTRAOBJS) $Blibrcc$A $(EXTRALIBS)
Modified: trunk/lcc/src/bind.c
===================================================================
--- trunk/lcc/src/bind.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/bind.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -7,17 +7,17 @@
extern Interface nullIR;
extern Interface bytecodeIR;
Binding bindings[] = {
- "alpha/osf", &alphaIR,
- "mips/irix", &mipsebIR,
- "mips/ultrix", &mipselIR,
- "sparc/sun", &sparcIR,
- "sparc/solaris", &solarisIR,
- "x86/win32", &x86IR,
- "x86/linux", &x86linuxIR,
- "symbolic/osf", &symbolic64IR,
- "symbolic/irix", &symbolicIR,
- "symbolic", &symbolicIR,
- "null", &nullIR,
- "bytecode", &bytecodeIR,
- NULL, NULL
+ /*{ "alpha/osf", &alphaIR },*/
+ /*{ "mips/irix", &mipsebIR },*/
+ /*{ "mips/ultrix", &mipselIR },*/
+ /*{ "sparc/sun", &sparcIR },*/
+ /*{ "sparc/solaris", &solarisIR },*/
+ /*{ "x86/win32", &x86IR },*/
+ /*{ "x86/linux", &x86linuxIR },*/
+ { "symbolic/osf", &symbolic64IR },
+ { "symbolic/irix", &symbolicIR },
+ { "symbolic", &symbolicIR },
+ { "null", &nullIR },
+ { "bytecode", &bytecodeIR },
+ { NULL, NULL },
};
Modified: trunk/lcc/src/bytecode.c
===================================================================
--- trunk/lcc/src/bytecode.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/bytecode.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -320,16 +320,16 @@
#define b_blockend blockend
Interface bytecodeIR = {
- 1, 1, 0, /* char */
- 2, 2, 0, /* short */
- 4, 4, 0, /* int */
- 4, 4, 0, /* long */
- 4, 4, 0, /* long long */
- 4, 4, 0, /* float */ // JDC: use inline floats
- 4, 4, 0, /* double */ // JDC: don't ever emit 8 byte double code
- 4, 4, 0, /* long double */ // JDC: don't ever emit 8 byte double code
- 4, 4, 0, /* T* */
- 0, 4, 0, /* struct */
+ {1, 1, 0}, /* char */
+ {2, 2, 0}, /* short */
+ {4, 4, 0}, /* int */
+ {4, 4, 0}, /* long */
+ {4, 4, 0}, /* long long */
+ {4, 4, 0}, /* float */ // JDC: use inline floats
+ {4, 4, 0}, /* double */ // JDC: don't ever emit 8 byte double code
+ {4, 4, 0}, /* long double */ // JDC: don't ever emit 8 byte double code
+ {4, 4, 0}, /* T* */
+ {0, 4, 0}, /* struct */
0, /* little_endian */
0, /* mulops_calls */
0, /* wants_callb */
Modified: trunk/lcc/src/c.h
===================================================================
--- trunk/lcc/src/c.h 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/c.h 2005-10-04 01:21:34 UTC (rev 132)
@@ -14,7 +14,7 @@
#define BUFSIZE 4096
#define istypename(t,tsym) (kind[t] == CHAR \
- || t == ID && tsym && tsym->sclass == TYPEDEF)
+ || (t == ID && tsym && tsym->sclass == TYPEDEF))
#define sizeop(n) ((n)<<10)
#define generic(op) ((op)&0x3F0)
#define specific(op) ((op)&0x3FF)
Modified: trunk/lcc/src/dag.c
===================================================================
--- trunk/lcc/src/dag.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/dag.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -2,9 +2,9 @@
#define iscall(op) (generic(op) == CALL \
- || IR->mulops_calls \
+ || (IR->mulops_calls \
&& (generic(op)==DIV||generic(op)==MOD||generic(op)==MUL) \
- && ( optype(op)==U || optype(op)==I))
+ && ( optype(op)==U || optype(op)==I)))
static Node forest;
static struct dag {
struct node node;
@@ -102,7 +102,7 @@
Node p = NULL, l, r;
int op;
- assert(tlab || flab || tlab == 0 && flab == 0);
+ assert(tlab || flab || (tlab == 0 && flab == 0));
if (tp == NULL)
return NULL;
if (tp->node)
@@ -172,8 +172,8 @@
p = node(op, NULL, NULL, constant(ty, tp->u.v)); } break;
case RIGHT: { if ( tp->kids[0] && tp->kids[1]
&& generic(tp->kids[1]->op) == ASGN
- && (generic(tp->kids[0]->op) == INDIR
- && tp->kids[0]->kids[0] == tp->kids[1]->kids[0]
+ && ((generic(tp->kids[0]->op) == INDIR
+ && tp->kids[0]->kids[0] == tp->kids[1]->kids[0])
|| (tp->kids[0]->op == FIELD
&& tp->kids[0] == tp->kids[1]->kids[0]))) {
assert(tlab == 0 && flab == 0);
@@ -276,11 +276,11 @@
unsigned int fmask = fieldmask(f);
unsigned int mask = fmask<<fieldright(f);
Tree q = tp->kids[1];
- if (q->op == CNST+I && q->u.v.i == 0
- || q->op == CNST+U && q->u.v.u == 0)
+ if ((q->op == CNST+I && q->u.v.i == 0)
+ || (q->op == CNST+U && q->u.v.u == 0))
q = bittree(BAND, x, cnsttree(unsignedtype, (unsigned long)~mask));
- else if (q->op == CNST+I && (q->u.v.i&fmask) == fmask
- || q->op == CNST+U && (q->u.v.u&fmask) == fmask)
+ else if ((q->op == CNST+I && (q->u.v.i&fmask) == fmask)
+ || (q->op == CNST+U && (q->u.v.u&fmask) == fmask))
q = bittree(BOR, x, cnsttree(unsignedtype, (unsigned long)mask));
else {
listnodes(q, 0, 0);
@@ -621,11 +621,11 @@
return forest;
}
static Node visit(Node p, int listed) {
- if (p)
+ if (p) {
if (p->syms[2])
p = tmpnode(p);
- else if (p->count <= 1 && !iscall(p->op)
- || p->count == 0 && iscall(p->op)) {
+ else if ((p->count <= 1 && !iscall(p->op))
+ || (p->count == 0 && iscall(p->op))) {
p->kids[0] = visit(p->kids[0], 0);
p->kids[1] = visit(p->kids[1], 0);
}
@@ -654,6 +654,7 @@
if (!listed)
p = tmpnode(p);
};
+ }
return p;
}
static Node tmpnode(Node p) {
Modified: trunk/lcc/src/decl.c
===================================================================
--- trunk/lcc/src/decl.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/decl.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -115,10 +115,10 @@
type = INT;
ty = inttype;
}
- if (size == SHORT && type != INT
- || size == LONG+LONG && type != INT
- || size == LONG && type != INT && type != DOUBLE
- || sign && type != INT && type != CHAR)
+ if ((size == SHORT && type != INT)
+ || (size == LONG+LONG && type != INT)
+ || (size == LONG && type != INT && type != DOUBLE)
+ || (sign && type != INT && type != CHAR))
error("invalid type specification\n");
if (type == CHAR && sign)
ty = sign == UNSIGNED ? unsignedchar : signedchar;
@@ -196,7 +196,7 @@
}
} else if (ty == NULL
|| !(isenum(ty) ||
- isstruct(ty) && (*unqual(ty)->u.sym->name < '1' || *unqual(ty)->u.sym->name > '9')))
+ (isstruct(ty) && (*unqual(ty)->u.sym->name < '1' || *unqual(ty)->u.sym->name > '9'))))
error("empty declaration\n");
test(';', stop);
}
@@ -220,9 +220,9 @@
if (!isfunc(ty) && p->defined && t == '=')
error("redefinition of `%s' previously defined at %w\n", p->name, &p->src);
- if (p->sclass == EXTERN && sclass == STATIC
- || p->sclass == STATIC && sclass == AUTO
- || p->sclass == AUTO && sclass == STATIC)
+ if ((p->sclass == EXTERN && sclass == STATIC)
+ || (p->sclass == STATIC && sclass == AUTO)
+ || (p->sclass == AUTO && sclass == STATIC))
warning("inconsistent linkage for `%s' previously declared at %w\n", p->name, &p->src);
}
@@ -416,7 +416,7 @@
error("missing parameter type\n");
n++;
ty = dclr(specifier(&sclass), &id, NULL, 1);
- if ( ty == voidtype && (ty1 || id)
+ if ( (ty == voidtype && (ty1 || id))
|| ty1 == voidtype)
error("illegal formal parameter types\n");
if (id == NULL)
@@ -736,10 +736,10 @@
if (ty->u.f.oldstyle)
warning("`%t %s()' is a non-ANSI definition\n", rty, id);
else if (!(rty == inttype
- && (n == 0 && callee[0] == NULL
- || n == 2 && callee[0]->type == inttype
+ && ((n == 0 && callee[0] == NULL)
+ || (n == 2 && callee[0]->type == inttype
&& isptr(callee[1]->type) && callee[1]->type->type == charptype
- && !variadic(ty))))
+ && !variadic(ty)))))
warning("`%s' is a non-ANSI definition\n", typestring(ty, id));
}
p = lookup(id, identifiers);
@@ -853,7 +853,7 @@
registers = append(retv, registers);
}
while (kind[t] == CHAR || kind[t] == STATIC
- || istypename(t, tsym) && getchr() != ':')
+ || (istypename(t, tsym) && getchr() != ':'))
decl(dcllocal);
{
int i;
@@ -908,7 +908,7 @@
p->type, p->name);
}
if (p->sclass == AUTO
- && (p->scope == PARAM && regcount == 0
+ && ((p->scope == PARAM && regcount == 0)
|| p->scope >= LOCAL)
&& !p->addressed && isscalar(p->type) && p->ref >= 3.0)
p->sclass = REGISTER;
@@ -933,13 +933,14 @@
sclass = AUTO;
}
q = lookup(id, identifiers);
- if (q && q->scope >= level
- || q && q->scope == PARAM && level == LOCAL)
+ if ((q && q->scope >= level)
+ || (q && q->scope == PARAM && level == LOCAL)) {
if (sclass == EXTERN && q->sclass == EXTERN
&& eqtype(q->type, ty, 1))
ty = compose(ty, q->type);
else
error("redeclaration of `%s' previously declared at %w\n", q->name, &q->src);
+ }
assert(level >= LOCAL);
p = install(id, &identifiers, level, sclass == STATIC || sclass == EXTERN ? PERM : FUNC);
@@ -964,13 +965,14 @@
p->u.alias = q; break;
case STATIC: (*IR->defsymbol)(p);
initglobal(p, 0);
- if (!p->defined)
+ if (!p->defined) {
if (p->type->size > 0) {
defglobal(p, BSS);
(*IR->space)(p->type->size);
} else
error("undefined size for `%t %s'\n",
p->type, p->name);
+ }
p->defined = 1; break;
case REGISTER: registers = append(p, registers);
regcount++;
@@ -987,7 +989,7 @@
t = gettok();
definept(NULL);
if (isscalar(p->type)
- || isstruct(p->type) && t != '{') {
+ || (isstruct(p->type) && t != '{')) {
if (t == '{') {
t = gettok();
e = expr1(0);
@@ -1027,7 +1029,7 @@
}
static void doglobal(Symbol p, void *cl) {
if (!p->defined && (p->sclass == EXTERN
- || isfunc(p->type) && p->sclass == AUTO))
+ || (isfunc(p->type) && p->sclass == AUTO)))
(*IR->import)(p);
else if (!p->defined && !isfunc(p->type)
&& (p->sclass == AUTO || p->sclass == STATIC)) {
@@ -1077,7 +1079,7 @@
Type enumdcl(void) {
char *tag;
Type ty;
- Symbol p;
+ Symbol p = {0};
Coordinate pos;
t = gettok();
Modified: trunk/lcc/src/enode.c
===================================================================
--- trunk/lcc/src/enode.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/enode.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -64,7 +64,7 @@
else
q = cast(q, promote(q->type));
}
- if (!IR->wants_argb && isstruct(q->type))
+ if (!IR->wants_argb && isstruct(q->type)) {
if (iscallb(q))
q = addrof(q);
else {
@@ -73,6 +73,7 @@
q = tree(RIGHT, ptr(t1->type),
root(q), lvalue(idtree(t1)));
}
+ }
if (q->type->size == 0)
q->type = inttype;
if (hascall(q))
@@ -223,15 +224,15 @@
Type ty = unqual(e->type);
return generic(e->op) == CNST
- && (ty->op == INT && e->u.v.i == 0
- || ty->op == UNSIGNED && e->u.v.u == 0
- || isvoidptr(ty) && e->u.v.p == NULL);
+ && ((ty->op == INT && e->u.v.i == 0)
+ || (ty->op == UNSIGNED && e->u.v.u == 0)
+ || (isvoidptr(ty) && e->u.v.p == NULL));
}
Tree eqtree(int op, Tree l, Tree r) {
Type xty = l->type, yty = r->type;
- if (isptr(xty) && isnullptr(r)
- || isptr(xty) && !isfunc(xty->type) && isvoidptr(yty)
+ if ((isptr(xty) && isnullptr(r))
+ || (isptr(xty) && !isfunc(xty->type) && isvoidptr(yty))
|| (isptr(xty) && isptr(yty)
&& eqtype(unqual(xty->type), unqual(yty->type), 1))) {
Type ty = unsignedptr;
@@ -239,8 +240,8 @@
r = cast(r, ty);
return simplify(mkop(op,ty), inttype, l, r);
}
- if (isptr(yty) && isnullptr(l)
- || isptr(yty) && !isfunc(yty->type) && isvoidptr(xty))
+ if ((isptr(yty) && isnullptr(l))
+ || (isptr(yty) && !isfunc(yty->type) && isvoidptr(xty)))
return eqtree(op, r, l);
return cmptree(op, l, r);
}
@@ -253,13 +254,13 @@
xty = xty->type;
if (xty->size == 0 || yty->size == 0)
return NULL;
- if ( isarith(xty) && isarith(yty)
- || isstruct(xty) && xty == yty)
+ if ( (isarith(xty) && isarith(yty))
+ || (isstruct(xty) && xty == yty))
return xty;
if (isptr(xty) && isnullptr(e))
return xty;
- if ((isvoidptr(xty) && isptr(yty)
- || isptr(xty) && isvoidptr(yty))
+ if (((isvoidptr(xty) && isptr(yty))
+ || (isptr(xty) && isvoidptr(yty)))
&& ( (isconst(xty->type) || !isconst(yty->type))
&& (isvolatile(xty->type) || !isvolatile(yty->type))))
return xty;
@@ -273,8 +274,8 @@
&& ( (isconst(xty->type) || !isconst(yty->type))
&& (isvolatile(xty->type) || !isvolatile(yty->type)))) {
Type lty = unqual(xty->type), rty = unqual(yty->type);
- if (isenum(lty) && rty == inttype
- || isenum(rty) && lty == inttype) {
+ if ((isenum(lty) && rty == inttype)
+ || (isenum(rty) && lty == inttype)) {
if (Aflag >= 1)
warning("assignment between `%t' and `%t' is compiler-dependent\n",
xty, yty);
@@ -302,13 +303,14 @@
if (isptr(aty))
aty = unqual(aty)->type;
if ( isconst(aty)
- || isstruct(aty) && unqual(aty)->u.sym->u.s.cfields)
+ || (isstruct(aty) && unqual(aty)->u.sym->u.s.cfields)) {
if (isaddrop(l->op)
&& !l->u.sym->computed && !l->u.sym->generated)
error("assignment to const identifier `%s'\n",
l->u.sym->name);
else
error("assignment to const location\n");
+ }
if (l->op == FIELD) {
long n = 8*l->u.field->type->size - fieldsize(l->u.field);
if (n > 0 && isunsigned(l->u.field->type))
@@ -345,8 +347,8 @@
ty = xty;
else if (isnullptr(l) && isptr(yty))
ty = yty;
- else if (isptr(xty) && !isfunc(xty->type) && isvoidptr(yty)
- || isptr(yty) && !isfunc(yty->type) && isvoidptr(xty))
+ else if ((isptr(xty) && !isfunc(xty->type) && isvoidptr(yty))
+ || (isptr(yty) && !isfunc(yty->type) && isvoidptr(xty)))
ty = voidptype;
else if ((isptr(xty) && isptr(yty)
&& eqtype(unqual(xty->type), unqual(yty->type), 1)))
@@ -357,11 +359,11 @@
}
if (isptr(ty)) {
ty = unqual(unqual(ty)->type);
- if (isptr(xty) && isconst(unqual(xty)->type)
- || isptr(yty) && isconst(unqual(yty)->type))
+ if ((isptr(xty) && isconst(unqual(xty)->type))
+ || (isptr(yty) && isconst(unqual(yty)->type)))
ty = qual(CONST, ty);
- if (isptr(xty) && isvolatile(unqual(xty)->type)
- || isptr(yty) && isvolatile(unqual(yty)->type))
+ if ((isptr(xty) && isvolatile(unqual(xty)->type))
+ || (isptr(yty) && isvolatile(unqual(yty)->type)))
ty = qual(VOLATILE, ty);
ty = ptr(ty);
}
@@ -518,15 +520,15 @@
void typeerror(int op, Tree l, Tree r) {
int i;
static struct { int op; char *name; } ops[] = {
- ASGN, "=", INDIR, "*", NEG, "-",
- ADD, "+", SUB, "-", LSH, "<<",
- MOD, "%", RSH, ">>", BAND, "&",
- BCOM, "~", BOR, "|", BXOR, "^",
- DIV, "/", MUL, "*", EQ, "==",
- GE, ">=", GT, ">", LE, "<=",
- LT, "<", NE, "!=", AND, "&&",
- NOT, "!", OR, "||", COND, "?:",
- 0, 0
+ {ASGN, "="}, {INDIR, "*"}, {NEG, "-"},
+ {ADD, "+"}, {SUB, "-"}, {LSH, "<<"},
+ {MOD, "%"}, {RSH, ">>"}, {BAND, "&"},
+ {BCOM, "~"}, {BOR, "|"}, {BXOR, "^"},
+ {DIV, "/"}, {MUL, "*"}, {EQ, "=="},
+ {GE, ">="}, {GT, ">"}, {LE, "<="},
+ {LT, "<"}, {NE, "!="}, {AND, "&&"},
+ {NOT, "!"}, {OR, "||"}, {COND, "?:"},
+ {0, 0}
};
op = generic(op);
Modified: trunk/lcc/src/expr.c
===================================================================
--- trunk/lcc/src/expr.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/expr.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -230,13 +230,13 @@
pty = p->type;
if (isenum(pty))
pty = pty->type;
- if (isarith(pty) && isarith(ty)
- || isptr(pty) && isptr(ty)) {
+ if ((isarith(pty) && isarith(ty))
+ || (isptr(pty) && isptr(ty))) {
explicitCast++;
p = cast(p, ty);
explicitCast--;
- } else if (isptr(pty) && isint(ty)
- || isint(pty) && isptr(ty)) {
+ } else if ((isptr(pty) && isint(ty))
+ || (isint(pty) && isptr(ty))) {
if (Aflag >= 1 && ty->size < pty->size)
warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, ty);
@@ -278,11 +278,12 @@
Tree q;
t = gettok();
q = expr(']');
- if (YYnull)
+ if (YYnull) {
if (isptr(p->type))
p = nullcheck(p);
else if (isptr(q->type))
q = nullcheck(q);
+ }
p = (*optree['+'])(ADD, pointer(p), pointer(q));
if (isptr(p->type) && isarray(p->type->type))
p = retype(p, p->type->type);
@@ -497,12 +498,13 @@
xx(unsignedlonglong);
xx(longlong);
xx(unsignedlong);
- if (xty == longtype && yty == unsignedtype
- || xty == unsignedtype && yty == longtype)
+ if ((xty == longtype && yty == unsignedtype)
+ || (xty == unsignedtype && yty == longtype)) {
if (longtype->size > unsignedtype->size)
return longtype;
else
return unsignedlong;
+ }
xx(longtype);
xx(unsignedtype);
return inttype;
@@ -618,8 +620,8 @@
if (src->op != dst->op)
p = simplify(CVP, dst, p, NULL);
else {
- if (isfunc(src->type) && !isfunc(dst->type)
- || !isfunc(src->type) && isfunc(dst->type))
+ if ((isfunc(src->type) && !isfunc(dst->type))
+ || (!isfunc(src->type) && isfunc(dst->type)))
warning("conversion from `%t' to `%t' is compiler dependent\n", p->type, type);
if (src->size != dst->size)
Modified: trunk/lcc/src/gen.c
===================================================================
--- trunk/lcc/src/gen.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/gen.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -368,7 +368,7 @@
void emit(Node p) {
for (; p; p = p->x.next) {
assert(p->x.registered);
- if (p->x.equatable && requate(p) || moveself(p))
+ if ((p->x.equatable && requate(p)) || moveself(p))
;
else
(*emitter)(p, p->x.inst);
Modified: trunk/lcc/src/init.c
===================================================================
--- trunk/lcc/src/init.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/init.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -81,7 +81,7 @@
do {
initializer(ty, lev);
n += ty->size;
- if (len > 0 && n >= len || t != ',')
+ if ((len > 0 && n >= len) || t != ',')
break;
t = gettok();
} while (t != '}');
@@ -99,7 +99,7 @@
(*IR->defstring)(inttype->size, buf);
s = buf;
}
- if (len > 0 && n >= len || t != ',')
+ if ((len > 0 && n >= len) || t != ',')
break;
t = gettok();
} while (t != '}');
@@ -123,9 +123,9 @@
do {
i = initvalue(inttype)->u.v.i;
if (fieldsize(p) < 8*p->type->size) {
- if (p->type == inttype &&
- (i < -(int)(fieldmask(p)>>1)-1 || i > (int)(fieldmask(p)>>1))
- || p->type == unsignedtype && (i&~fieldmask(p)) != 0)
+ if ((p->type == inttype &&
+ (i < -(int)(fieldmask(p)>>1)-1 || i > (int)(fieldmask(p)>>1)))
+ || (p->type == unsignedtype && (i&~fieldmask(p)) != 0))
warning("initializer exceeds bit-field width\n");
i &= fieldmask(p);
}
@@ -185,7 +185,7 @@
(*IR->space)(a - n%a);
n = roundup(n, a);
}
- if (len > 0 && n >= len || t != ',')
+ if ((len > 0 && n >= len) || t != ',')
break;
t = gettok();
} while (t != '}');
Modified: trunk/lcc/src/inits.c
===================================================================
--- trunk/lcc/src/inits.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/inits.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -4,5 +4,4 @@
{extern void prof_init(int, char *[]); prof_init(argc, argv);}
{extern void trace_init(int, char *[]); trace_init(argc, argv);}
{extern void type_init(int, char *[]); type_init(argc, argv);}
- {extern void x86linux_init(int, char *[]); x86linux_init(argc, argv);}
}
Modified: trunk/lcc/src/input.c
===================================================================
--- trunk/lcc/src/input.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/input.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -125,10 +125,11 @@
} else if (Aflag >= 2 && *cp != '\n')
warning("unrecognized control line\n");
while (*cp)
- if (*cp++ == '\n')
+ if (*cp++ == '\n') {
if (cp == limit + 1)
nextline();
else
break;
+ }
}
Modified: trunk/lcc/src/lex.c
===================================================================
--- trunk/lcc/src/lex.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/lex.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -685,17 +685,18 @@
}
goto id;
default:
- if ((map[cp[-1]]&BLANK) == 0)
+ if ((map[cp[-1]]&BLANK) == 0) {
if (cp[-1] < ' ' || cp[-1] >= 0177)
error("illegal character `\\0%o'\n", cp[-1]);
else
error("illegal character `%c'\n", cp[-1]);
+ }
}
}
}
static Symbol icon(unsigned long n, int overflow, int base) {
- if ((*cp=='u'||*cp=='U') && (cp[1]=='l'||cp[1]=='L')
- || (*cp=='l'||*cp=='L') && (cp[1]=='u'||cp[1]=='U')) {
+ if (((*cp=='u'||*cp=='U') && (cp[1]=='l'||cp[1]=='L'))
+ || ((*cp=='l'||*cp=='L') && (cp[1]=='u'||cp[1]=='U'))) {
tval.type = unsignedlong;
cp += 2;
} else if (*cp == 'u' || *cp == 'U') {
Modified: trunk/lcc/src/null.c
===================================================================
--- trunk/lcc/src/null.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/null.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -29,16 +29,16 @@
Interface nullIR = {
- 1, 1, 0, /* char */
- 2, 2, 0, /* short */
- 4, 4, 0, /* int */
- 8, 8, 1, /* long */
- 8 ,8, 1, /* long long */
- 4, 4, 1, /* float */
- 8, 8, 1, /* double */
- 16,16,1, /* long double */
- 4, 4, 0, /* T* */
- 0, 4, 0, /* struct */
+ {1, 1, 0}, /* char */
+ {2, 2, 0}, /* short */
+ {4, 4, 0}, /* int */
+ {8, 8, 1}, /* long */
+ {8 ,8, 1}, /* long long */
+ {4, 4, 1}, /* float */
+ {8, 8, 1}, /* double */
+ {16,16,1}, /* long double */
+ {4, 4, 0}, /* T* */
+ {0, 4, 0}, /* struct */
1, /* little_endian */
0, /* mulops_calls */
0, /* wants_callb */
Modified: trunk/lcc/src/output.c
===================================================================
--- trunk/lcc/src/output.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/output.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -5,7 +5,7 @@
if (f)
fputs(str, f);
else
- while (*bp = *str++)
+ while ((*bp = *str++))
bp++;
return bp;
}
@@ -95,9 +95,10 @@
case 'c': if (f) fputc(va_arg(ap, int), f); else *bp++ = va_arg(ap, int); break;
case 'S': { char *s = va_arg(ap, char *);
int n = va_arg(ap, int);
- if (s)
+ if (s) {
for ( ; n-- > 0; s++)
if (f) (void)putc(*s, f); else *bp++ = *s;
+ }
} break;
case 'k': { int t = va_arg(ap, int);
static char *tokens[] = {
Modified: trunk/lcc/src/prof.c
===================================================================
--- trunk/lcc/src/prof.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/prof.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -203,7 +203,7 @@
return;
inited = 1;
type_init(argc, argv);
- if (IR)
+ if (IR) {
for (i = 1; i < argc; i++)
if (strncmp(argv[i], "-a", 2) == 0) {
if (ncalled == -1
@@ -224,4 +224,5 @@
attach((Apply)bbincr, YYcounts, &events.points);
}
}
+ }
}
Modified: trunk/lcc/src/profio.c
===================================================================
--- trunk/lcc/src/profio.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/profio.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -150,9 +150,9 @@
struct count *c = cursor->counts;
for (l = 0, u = cursor->count - 1; l <= u; ) {
int k = (l + u)/2;
- if (c[k].y > y || c[k].y == y && c[k].x > x)
+ if (c[k].y > y || (c[k].y == y && c[k].x > x))
u = k - 1;
- else if (c[k].y < y || c[k].y == y && c[k].x < x)
+ else if (c[k].y < y || (c[k].y == y && c[k].x < x))
l = k + 1;
else
return c[k].count;
Modified: trunk/lcc/src/simp.c
===================================================================
--- trunk/lcc/src/simp.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/simp.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -53,10 +53,10 @@
int explicitCast;
static int addi(long x, long y, long min, long max, int needconst) {
int cond = x == 0 || y == 0
- || x < 0 && y < 0 && x >= min - y
- || x < 0 && y > 0
- || x > 0 && y < 0
- || x > 0 && y > 0 && x <= max - y;
+ || (x < 0 && y < 0 && x >= min - y)
+ || (x < 0 && y > 0)
+ || (x > 0 && y < 0)
+ || (x > 0 && y > 0 && x <= max - y);
if (!cond && needconst) {
warning("overflow in constant expression\n");
cond = 1;
@@ -68,10 +68,10 @@
static int addd(double x, double y, double min, double max, int needconst) {
int cond = x == 0 || y == 0
- || x < 0 && y < 0 && x >= min - y
- || x < 0 && y > 0
- || x > 0 && y < 0
- || x > 0 && y > 0 && x <= max - y;
+ || (x < 0 && y < 0 && x >= min - y)
+ || (x < 0 && y > 0)
+ || (x > 0 && y < 0)
+ || (x > 0 && y > 0 && x <= max - y);
if (!cond && needconst) {
warning("overflow in constant expression\n");
cond = 1;
@@ -146,11 +146,11 @@
/* mul[id] - return 1 if min <= x*y <= max, 0 otherwise */
static int muli(long x, long y, long min, long max, int needconst) {
- int cond = x > -1 && x <= 1 || y > -1 && y <= 1
- || x < 0 && y < 0 && -x <= max/-y
- || x < 0 && y > 0 && x >= min/y
- || x > 0 && y < 0 && y >= min/x
- || x > 0 && y > 0 && x <= max/y;
+ int cond = (x > -1 && x <= 1) || (y > -1 && y <= 1)
+ || (x < 0 && y < 0 && -x <= max/-y)
+ || (x < 0 && y > 0 && x >= min/y)
+ || (x > 0 && y < 0 && y >= min/x)
+ || (x > 0 && y > 0 && x <= max/y);
if (!cond && needconst) {
warning("overflow in constant expression\n");
cond = 1;
@@ -161,11 +161,11 @@
}
static int muld(double x, double y, double min, double max, int needconst) {
- int cond = x >= -1 && x <= 1 || y >= -1 && y <= 1
- || x < 0 && y < 0 && -x <= max/-y
- || x < 0 && y > 0 && x >= min/y
- || x > 0 && y < 0 && y >= min/x
- || x > 0 && y > 0 && x <= max/y;
+ int cond = (x >= -1 && x <= 1) || (y >= -1 && y <= 1)
+ || (x < 0 && y < 0 && -x <= max/-y)
+ || (x < 0 && y > 0 && x >= min/y)
+ || (x > 0 && y < 0 && y >= min/x)
+ || (x > 0 && y > 0 && x <= max/y);
if (!cond && needconst) {
warning("overflow in constant expression\n");
cond = 1;
@@ -204,7 +204,6 @@
}
Tree simplify(int op, Type ty, Tree l, Tree r) {
int n;
- Tree p;
if (optype(op) == 0)
op = mkop(op, ty);
@@ -256,13 +255,14 @@
break;
case CVF+F: {
float d;
- if (l->op == CNST+F)
+ if (l->op == CNST+F) {
if (l->u.v.d < ty->u.sym->u.limits.min.d)
d = ty->u.sym->u.limits.min.d;
else if (l->u.v.d > ty->u.sym->u.limits.max.d)
d = ty->u.sym->u.limits.max.d;
else
d = l->u.v.d;
+ }
xcvtcnst(F,l->u.v.d,ty,d,(long double)d);
break;
}
@@ -308,14 +308,14 @@
identity(r,retype(l,ty),I,i,0);
identity(r,retype(l,ty),U,u,0);
if (isaddrop(l->op)
- && (r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i
- && r->u.v.i >= longtype->u.sym->u.limits.min.i
- || r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i))
+ && ((r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i
+ && r->u.v.i >= longtype->u.sym->u.limits.min.i)
+ || (r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i)))
return addrtree(l, cast(r, longtype)->u.v.i, ty);
if (l->op == ADD+P && isaddrop(l->kids[1]->op)
- && (r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i
- && r->u.v.i >= longtype->u.sym->u.limits.min.i
- || r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i))
+ && ((r->op == CNST+I && r->u.v.i <= longtype->u.sym->u.limits.max.i
+ && r->u.v.i >= longtype->u.sym->u.limits.min.i)
+ || (r->op == CNST+U && r->u.v.u <= longtype->u.sym->u.limits.max.i)))
return simplify(ADD+P, ty, l->kids[0],
addrtree(l->kids[1], cast(r, longtype)->u.v.i, ty));
if ((l->op == ADD+I || l->op == SUB+I)
@@ -385,9 +385,9 @@
break;
case DIV+I:
identity(r,l,I,i,1);
- if (r->op == CNST+I && r->u.v.i == 0
- || l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i
- && r->op == CNST+I && r->u.v.i == -1)
+ if ((r->op == CNST+I && r->u.v.i == 0)
+ || (l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i
+ && r->op == CNST+I && r->u.v.i == -1))
break;
xfoldcnst(I,i,/,divi);
break;
@@ -465,9 +465,9 @@
case MOD+I:
if (r->op == CNST+I && r->u.v.i == 1) /* l%1 => (l,0) */
return tree(RIGHT, ty, root(l), cnsttree(ty, 0L));
- if (r->op == CNST+I && r->u.v.i == 0
- || l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i
- && r->op == CNST+I && r->u.v.i == -1)
+ if ((r->op == CNST+I && r->u.v.i == 0)
+ || (l->op == CNST+I && l->u.v.i == ty->u.sym->u.limits.min.i
+ && r->op == CNST+I && r->u.v.i == -1))
break;
xfoldcnst(I,i,%,divi);
break;
Modified: trunk/lcc/src/stab.c
===================================================================
--- trunk/lcc/src/stab.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/stab.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -201,9 +201,7 @@
if (brace == '{')
while (*p)
stabsym(*p++);
- if (IR == &sparcIR)
- print(".stabd 0x%x,0,%d\n", brace == '{' ? N_LBRAC : N_RBRAC, lev);
- else {
+ {
int lab = genlabel(1);
print(".stabn 0x%x,0,%d,%s%d-%s\n", brace == '{' ? N_LBRAC : N_RBRAC, lev,
stabprefix, lab, cfunc->x.name);
@@ -252,9 +250,7 @@
print("%s%d:\n", stabprefix, lab);
currentfile = cp->file;
}
- if (IR == &sparcIR)
- print(".stabd 0x%x,0,%d\n", N_SLINE, cp->y);
- else {
+ {
int lab = genlabel(1);
print(".stabn 0x%x,0,%d,%s%d-%s\n", N_SLINE, cp->y,
stabprefix, lab, cfunc->x.name);
@@ -280,7 +276,7 @@
sz = p->type->type->size;
} else
tc = dbxtype(p->type);
- if (p->sclass == AUTO && p->scope == GLOBAL || p->sclass == EXTERN) {
+ if ((p->sclass == AUTO && p->scope == GLOBAL) || p->sclass == EXTERN) {
print(".stabs \"%s:G", p->name);
code = N_GSYM;
} else if (p->sclass == STATIC) {
Modified: trunk/lcc/src/stmt.c
===================================================================
--- trunk/lcc/src/stmt.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/stmt.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -37,7 +37,6 @@
return cp;
}
int reachable(int kind) {
- Code cp;
if (kind > Start) {
Code cp;
Modified: trunk/lcc/src/sym.c
===================================================================
--- trunk/lcc/src/sym.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/sym.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -296,7 +296,6 @@
/* vtoa - return string for the constant v of type ty */
char *vtoa(Type ty, Value v) {
- char buf[50];
ty = unqual(ty);
switch (ty->op) {
Modified: trunk/lcc/src/symbolic.c
===================================================================
--- trunk/lcc/src/symbolic.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/symbolic.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -404,16 +404,16 @@
static void I(stabtype)(Symbol p) {}
Interface symbolicIR = {
- 1, 1, 0, /* char */
- 2, 2, 0, /* short */
- 4, 4, 0, /* int */
- 4, 4, 0, /* long */
- 4, 4, 0, /* long long */
- 4, 4, 1, /* float */
- 8, 8, 1, /* double */
- 8, 8, 1, /* long double */
- 4, 4, 0, /* T* */
- 0, 4, 0, /* struct */
+ {1, 1, 0}, /* char */
+ {2, 2, 0}, /* short */
+ {4, 4, 0}, /* int */
+ {4, 4, 0}, /* long */
+ {4, 4, 0}, /* long long */
+ {4, 4, 1}, /* float */
+ {8, 8, 1}, /* double */
+ {8, 8, 1}, /* long double */
+ {4, 4, 0}, /* T* */
+ {0, 4, 0}, /* struct */
0, /* little_endian */
0, /* mulops_calls */
0, /* wants_callb */
@@ -449,16 +449,16 @@
};
Interface symbolic64IR = {
- 1, 1, 0, /* char */
- 2, 2, 0, /* short */
- 4, 4, 0, /* int */
- 8, 8, 0, /* long */
- 8, 8, 0, /* long long */
- 4, 4, 1, /* float */
- 8, 8, 1, /* double */
- 8, 8, 1, /* long double */
- 8, 8, 0, /* T* */
- 0, 1, 0, /* struct */
+ {1, 1, 0}, /* char */
+ {2, 2, 0}, /* short */
+ {4, 4, 0}, /* int */
+ {8, 8, 0}, /* long */
+ {8, 8, 0}, /* long long */
+ {4, 4, 1}, /* float */
+ {8, 8, 1}, /* double */
+ {8, 8, 1}, /* long double */
+ {8, 8, 0}, /* T* */
+ {0, 1, 0}, /* struct */
1, /* little_endian */
0, /* mulops_calls */
0, /* wants_callb */
Modified: trunk/lcc/src/trace.c
===================================================================
--- trunk/lcc/src/trace.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/trace.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -8,7 +8,7 @@
/* appendstr - append str to the evolving format string, expanding it if necessary */
static void appendstr(char *str) {
do
- if (fp == fmtend)
+ if (fp == fmtend) {
if (fp) {
char *s = allocate(2*(fmtend - fmt), FUNC);
strncpy(s, fmt, fmtend - fmt);
@@ -19,6 +19,7 @@
fp = fmt = allocate(80, FUNC);
fmtend = fmt + 80;
}
+ }
while ((*fp++ = *str++) != 0);
fp--;
}
Modified: trunk/lcc/src/types.c
===================================================================
--- trunk/lcc/src/types.c 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/lcc/src/types.c 2005-10-04 01:21:34 UTC (rev 132)
@@ -233,8 +233,8 @@
ty->align, NULL);
else if (isfunc(ty))
warning("qualified function type ignored\n");
- else if (isconst(ty) && op == CONST
- || isvolatile(ty) && op == VOLATILE)
+ else if ((isconst(ty) && op == CONST)
+ || (isvolatile(ty) && op == VOLATILE))
error("illegal type `%k %t'\n", op, ty);
else {
if (isqual(ty)) {
@@ -276,7 +276,7 @@
tag = stringd(genlabel(1));
else
if ((p = lookup(tag, types)) != NULL && (p->scope == level
- || p->scope == PARAM && level == PARAM+1)) {
+ || (p->scope == PARAM && level == PARAM+1))) {
if (p->type->op == op && !p->defined)
return p->type;
error("redefinition of `%s' previously defined at %w\n",
@@ -400,7 +400,7 @@
case CONST: case VOLATILE:
return qual(ty1->op, compose(ty1->type, ty2->type));
case ARRAY: { Type ty = compose(ty1->type, ty2->type);
- if (ty1->size && (ty1->type->size && ty2->size == 0 || ty1->size == ty2->size))
+ if (ty1->size && ((ty1->type->size && ty2->size == 0) || ty1->size == ty2->size))
return array(ty, ty1->size/ty1->type->size, ty1->align);
if (ty2->size && ty2->type->size && ty1->size == 0)
return array(ty, ty2->size/ty2->type->size, ty2->align);
Modified: trunk/q3asm/Makefile
===================================================================
--- trunk/q3asm/Makefile 2005-09-30 22:30:22 UTC (rev 131)
+++ trunk/q3asm/Makefile 2005-10-04 01:21:34 UTC (rev 132)
@@ -1,7 +1,7 @@
# yeah, couldn't do more simple really
CC=gcc
-CFLAGS=-g -Wall
+CFLAGS=-O2 -Wall -Werror -fno-strict-aliasing
default: q3asm
More information about the quake3-commits
mailing list