1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:07:57 -07:00

build: use gcc -Werror

Better to fix the warnings that we find.

R=iant
CC=golang-dev
https://golang.org/cl/4406042
This commit is contained in:
Russ Cox 2011-04-13 16:18:09 -04:00
parent da8c5e7239
commit 1d26908d3f
7 changed files with 18 additions and 13 deletions

View File

@ -1100,7 +1100,7 @@ copyu(Prog *p, Adr *v, Adr *s)
if(v->type == D_REG) { if(v->type == D_REG) {
if(v->reg <= REGEXT && v->reg > exregoffset) if(v->reg <= REGEXT && v->reg > exregoffset)
return 2; return 2;
if(v->reg == REGARG) if(v->reg == (uchar)REGARG)
return 2; return 2;
} }
if(v->type == D_FREG) if(v->type == D_FREG)
@ -1118,7 +1118,7 @@ copyu(Prog *p, Adr *v, Adr *s)
case ATEXT: /* funny */ case ATEXT: /* funny */
if(v->type == D_REG) if(v->type == D_REG)
if(v->reg == REGARG) if(v->reg == (uchar)REGARG)
return 3; return 3;
return 0; return 0;
} }

View File

@ -400,6 +400,10 @@ regsalloc(Node *n, Node *nn)
void void
regaalloc1(Node *n, Node *nn) regaalloc1(Node *n, Node *nn)
{ {
if(REGARG < 0) {
fatal(n, "regaalloc1 and REGARG<0");
return;
}
nodreg(n, nn, REGARG); nodreg(n, nn, REGARG);
reg[REGARG]++; reg[REGARG]++;
curarg = align(curarg, nn->type, Aarg1, nil); curarg = align(curarg, nn->type, Aarg1, nil);

View File

@ -797,7 +797,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3; return 3;
case ACALL: /* funny */ case ACALL: /* funny */
if(REGARG >= 0 && v->type == REGARG) if(REGARG >= 0 && v->type == (uchar)REGARG)
return 2; return 2;
if(s != A) { if(s != A) {
@ -810,7 +810,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3; return 3;
case ATEXT: /* funny */ case ATEXT: /* funny */
if(REGARG >= 0 && v->type == REGARG) if(REGARG >= 0 && v->type == (uchar)REGARG)
return 3; return 3;
return 0; return 0;
} }

View File

@ -436,8 +436,10 @@ regsalloc(Node *n, Node *nn)
void void
regaalloc1(Node *n, Node *nn) regaalloc1(Node *n, Node *nn)
{ {
if(REGARG < 0) if(REGARG < 0) {
diag(n, "regaalloc1 and REGARG<0"); fatal(n, "regaalloc1 and REGARG<0");
return;
}
nodreg(n, nn, REGARG); nodreg(n, nn, REGARG);
reg[REGARG]++; reg[REGARG]++;
curarg = align(curarg, nn->type, Aarg1, nil); curarg = align(curarg, nn->type, Aarg1, nil);

View File

@ -713,7 +713,7 @@ copyu(Prog *p, Adr *v, Adr *s)
return 3; return 3;
case ACALL: /* funny */ case ACALL: /* funny */
if(REGARG >= 0 && v->type == REGARG) if(REGARG >= 0 && v->type == (uchar)REGARG)
return 2; return 2;
if(s != A) { if(s != A) {

View File

@ -397,6 +397,10 @@ regsalloc(Node *n, Node *nn)
void void
regaalloc1(Node *n, Node *nn) regaalloc1(Node *n, Node *nn)
{ {
if(REGARG < 0) {
fatal(n, "regaalloc1 and REGARG<0");
return;
}
nodreg(n, nn, REGARG); nodreg(n, nn, REGARG);
reg[REGARG]++; reg[REGARG]++;
curarg = align(curarg, nn->type, Aarg1, nil); curarg = align(curarg, nn->type, Aarg1, nil);

View File

@ -35,15 +35,10 @@ esac
tmp=/tmp/qcc.$$.$USER.out tmp=/tmp/qcc.$$.$USER.out
$gcc -Wall -Wno-sign-compare -Wno-missing-braces \ $gcc -Wall -Wno-sign-compare -Wno-missing-braces \
-Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment \ -Wno-parentheses -Wno-unknown-pragmas -Wno-switch -Wno-comment \
-Werror \
"$@" >$tmp 2>&1 "$@" >$tmp 2>&1
status=$? status=$?
egrep -v "$ignore" $tmp | uniq | tee $tmp.1 egrep -v "$ignore" $tmp | uniq | tee $tmp.1
# Make incompatible pointer type "warnings" stop the build.
# Not quite perfect--we should remove the object file--but
# a step in the right direction.
if egrep 'incompatible pointer type' $tmp.1 >/dev/null; then
status=1
fi
rm -f $tmp $tmp.1 rm -f $tmp $tmp.1
exit $status exit $status