-E warnings as errors.
This commit is contained in:
parent
36d5eed854
commit
f1da832ae9
@ -134,6 +134,9 @@ static char *prefix[3]={ "error", "fatal error", "warning" };
|
|||||||
char *pre;
|
char *pre;
|
||||||
|
|
||||||
pre=prefix[number/100];
|
pre=prefix[number/100];
|
||||||
|
if (number>=200 && pc_geterrorwarnings()){
|
||||||
|
pre=prefix[0];
|
||||||
|
}
|
||||||
if (firstline>=0)
|
if (firstline>=0)
|
||||||
fprintf(stderr,"%s(%d -- %d) : %s %03d: ",filename,firstline,lastline,pre,number);
|
fprintf(stderr,"%s(%d -- %d) : %s %03d: ",filename,firstline,lastline,pre,number);
|
||||||
else
|
else
|
||||||
|
@ -485,6 +485,8 @@ int pc_addtag(char *name);
|
|||||||
int pc_enablewarning(int number,int enable);
|
int pc_enablewarning(int number,int enable);
|
||||||
int pc_pushwarnings();
|
int pc_pushwarnings();
|
||||||
int pc_popwarnings();
|
int pc_popwarnings();
|
||||||
|
void pc_seterrorwarnings(int enable);
|
||||||
|
int pc_geterrorwarnings();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Functions called from the compiler (to be implemented by you)
|
* Functions called from the compiler (to be implemented by you)
|
||||||
|
@ -221,6 +221,9 @@ static char *prefix[3]={ "error", "fatal error", "warning" };
|
|||||||
char *pre;
|
char *pre;
|
||||||
|
|
||||||
pre=prefix[number/100];
|
pre=prefix[number/100];
|
||||||
|
if (number>=200 && pc_geterrorwarnings()){
|
||||||
|
pre=prefix[0];
|
||||||
|
}
|
||||||
if (firstline>=0)
|
if (firstline>=0)
|
||||||
fprintf(stderr,"%s(%d -- %d) : %s %03d: ",filename,firstline,lastline,pre,number);
|
fprintf(stderr,"%s(%d -- %d) : %s %03d: ",filename,firstline,lastline,pre,number);
|
||||||
else
|
else
|
||||||
@ -1159,6 +1162,19 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
|
|||||||
if (sc_asmfile && verbosity>1)
|
if (sc_asmfile && verbosity>1)
|
||||||
verbosity=1;
|
verbosity=1;
|
||||||
break;
|
break;
|
||||||
|
case 'E':
|
||||||
|
switch (*option_value(ptr)) {
|
||||||
|
case '+':
|
||||||
|
pc_seterrorwarnings(1);
|
||||||
|
break;
|
||||||
|
case '-':
|
||||||
|
pc_seterrorwarnings(0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
pc_seterrorwarnings(2);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
i=(int)strtol(option_value(ptr),(char **)&ptr,10);
|
i=(int)strtol(option_value(ptr),(char **)&ptr,10);
|
||||||
if (*ptr=='-')
|
if (*ptr=='-')
|
||||||
@ -1450,6 +1466,7 @@ static void about(void)
|
|||||||
pc_printf(" -X<num> abstract machine size limit in bytes\n");
|
pc_printf(" -X<num> abstract machine size limit in bytes\n");
|
||||||
pc_printf(" -XD<num> abstract machine data/stack size limit in bytes\n");
|
pc_printf(" -XD<num> abstract machine data/stack size limit in bytes\n");
|
||||||
pc_printf(" -Z[+/-] run in compatibility mode (default=%c)\n",pc_compat ? '+' : '-');
|
pc_printf(" -Z[+/-] run in compatibility mode (default=%c)\n",pc_compat ? '+' : '-');
|
||||||
|
pc_printf(" -E[+/-] turn warnings in to errors\n");
|
||||||
pc_printf(" -\\ use '\\' for escape characters\n");
|
pc_printf(" -\\ use '\\' for escape characters\n");
|
||||||
pc_printf(" -^ use '^' for escape characters\n");
|
pc_printf(" -^ use '^' for escape characters\n");
|
||||||
pc_printf(" -;[+/-] require a semicolon to end each statement (default=%c)\n", sc_needsemicolon ? '+' : '-');
|
pc_printf(" -;[+/-] require a semicolon to end each statement (default=%c)\n", sc_needsemicolon ? '+' : '-');
|
||||||
|
@ -203,6 +203,7 @@ static struct s_warnstack {
|
|||||||
static int errflag;
|
static int errflag;
|
||||||
static int errstart; /* line number at which the instruction started */
|
static int errstart; /* line number at which the instruction started */
|
||||||
static int errline; /* forced line number for the error message */
|
static int errline; /* forced line number for the error message */
|
||||||
|
static int errwarn;
|
||||||
|
|
||||||
/* error
|
/* error
|
||||||
*
|
*
|
||||||
@ -249,6 +250,11 @@ static short lastfile;
|
|||||||
msg=fatalmsg[number-100];
|
msg=fatalmsg[number-100];
|
||||||
pre=prefix[1];
|
pre=prefix[1];
|
||||||
errnum++; /* a fatal error also counts as an error */
|
errnum++; /* a fatal error also counts as an error */
|
||||||
|
} else if (errwarn) {
|
||||||
|
msg=warnmsg[number-200];
|
||||||
|
pre=prefix[0];
|
||||||
|
errflag=TRUE;
|
||||||
|
errnum++;
|
||||||
} else {
|
} else {
|
||||||
msg=warnmsg[number-200];
|
msg=warnmsg[number-200];
|
||||||
pre=prefix[2];
|
pre=prefix[2];
|
||||||
@ -303,7 +309,7 @@ static short lastfile;
|
|||||||
errorcount=0;
|
errorcount=0;
|
||||||
lastline=fline;
|
lastline=fline;
|
||||||
lastfile=fcurrent;
|
lastfile=fcurrent;
|
||||||
if (number<200)
|
if (number<200 || errwarn)
|
||||||
errorcount++;
|
errorcount++;
|
||||||
if (errorcount>=3)
|
if (errorcount>=3)
|
||||||
error(107); /* too many error/warning messages on one line */
|
error(107); /* too many error/warning messages on one line */
|
||||||
@ -401,3 +407,16 @@ int pc_popwarnings()
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* pc_seterrorwarnings()
|
||||||
|
* Make warnings errors (or not).
|
||||||
|
*/
|
||||||
|
void pc_seterrorwarnings(int enable)
|
||||||
|
{
|
||||||
|
errwarn = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pc_geterrorwarnings()
|
||||||
|
{
|
||||||
|
return errwarn;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user