fixed some bugs, changed warning interface
This commit is contained in:
parent
f04baf2201
commit
480de7cafb
5 changed files with 23 additions and 9 deletions
|
@ -25,6 +25,7 @@
|
||||||
#include "class.h"
|
#include "class.h"
|
||||||
#include "macro.h"
|
#include "macro.h"
|
||||||
|
|
||||||
|
extern char options[];
|
||||||
extern char **inctable; /* list of include directories */
|
extern char **inctable; /* list of include directories */
|
||||||
extern char *getwdir();
|
extern char *getwdir();
|
||||||
char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
char ifstack[IFDEPTH]; /* if-stack: the content of an entry is */
|
||||||
|
@ -211,7 +212,8 @@ int to_endif;
|
||||||
++(ifstack[nestlevel]);
|
++(ifstack[nestlevel]);
|
||||||
if (!to_endif && nestlevel == skiplevel) {
|
if (!to_endif && nestlevel == skiplevel) {
|
||||||
if (SkipToNewLine())
|
if (SkipToNewLine())
|
||||||
strict("garbage following #else");
|
if (!options['o'])
|
||||||
|
strict("garbage following #else");
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -221,7 +223,8 @@ int to_endif;
|
||||||
ASSERT(nestlevel > nestlow);
|
ASSERT(nestlevel > nestlow);
|
||||||
if (nestlevel == skiplevel) {
|
if (nestlevel == skiplevel) {
|
||||||
if (SkipToNewLine())
|
if (SkipToNewLine())
|
||||||
strict("garbage following #endif");
|
if (!options['o'])
|
||||||
|
strict("garbage following #endif");
|
||||||
nestlevel--;
|
nestlevel--;
|
||||||
NoUnstack--;
|
NoUnstack--;
|
||||||
return;
|
return;
|
||||||
|
@ -364,7 +367,8 @@ do_elif()
|
||||||
do_else()
|
do_else()
|
||||||
{
|
{
|
||||||
if (SkipToNewLine())
|
if (SkipToNewLine())
|
||||||
strict("garbage following #else");
|
if (!options['o'])
|
||||||
|
strict("garbage following #else");
|
||||||
if (nestlevel <= nestlow)
|
if (nestlevel <= nestlow)
|
||||||
lexerror("#else without corresponding #if");
|
lexerror("#else without corresponding #if");
|
||||||
else { /* mark this level as else-d */
|
else { /* mark this level as else-d */
|
||||||
|
@ -379,7 +383,8 @@ do_else()
|
||||||
do_endif()
|
do_endif()
|
||||||
{
|
{
|
||||||
if (SkipToNewLine())
|
if (SkipToNewLine())
|
||||||
strict("garbage following #endif");
|
if (!options['o'])
|
||||||
|
strict("garbage following #endif");
|
||||||
if (nestlevel <= nestlow) {
|
if (nestlevel <= nestlow) {
|
||||||
lexerror("#endif without corresponding #if");
|
lexerror("#endif without corresponding #if");
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,9 @@ idf2expr(expr)
|
||||||
if (def == 0) {
|
if (def == 0) {
|
||||||
if (AHEAD == '(') {
|
if (AHEAD == '(') {
|
||||||
/* function call, declare name IMPLICITly (3.3.2.2) */
|
/* function call, declare name IMPLICITly (3.3.2.2) */
|
||||||
warning("implicit declaration of function %s"
|
if (!options['o'])
|
||||||
, idf->id_text);
|
warning("implicit declaration of function %s"
|
||||||
|
, idf->id_text);
|
||||||
add_def(idf, IMPLICIT, funint_type, level);
|
add_def(idf, IMPLICIT, funint_type, level);
|
||||||
} else {
|
} else {
|
||||||
if (!is_anon_idf(idf))
|
if (!is_anon_idf(idf))
|
||||||
|
|
|
@ -591,10 +591,13 @@ check_formals(idf, dc)
|
||||||
|
|
||||||
while (du && du->du_fund != FUNCTION)
|
while (du && du->du_fund != FUNCTION)
|
||||||
du = du->next;
|
du = du->next;
|
||||||
ASSERT(du);
|
if (!du) return; /* terrible error, signalled earlier */
|
||||||
|
|
||||||
if (du->du_proto) return;
|
if (du->du_proto) return;
|
||||||
|
|
||||||
warning("'%s' old-fashioned function definition", dc->dc_idf->id_text);
|
if (!options['o'])
|
||||||
|
warning("'%s' old-fashioned function definition"
|
||||||
|
, dc->dc_idf->id_text);
|
||||||
|
|
||||||
if (pl) {
|
if (pl) {
|
||||||
if (pl->pl_flag & PL_ELLIPSIS) {
|
if (pl->pl_flag & PL_ELLIPSIS) {
|
||||||
|
|
|
@ -68,8 +68,13 @@ next_option: /* to allow combined one-char options */
|
||||||
case 'n': /* use no registers */
|
case 'n': /* use no registers */
|
||||||
case 'w': /* no warnings will be given */
|
case 'w': /* no warnings will be given */
|
||||||
case 's': /* no stricts will be given */
|
case 's': /* no stricts will be given */
|
||||||
|
case 'o': /* no complaints about old-style */
|
||||||
options[opt] = 1;
|
options[opt] = 1;
|
||||||
goto next_option;
|
goto next_option;
|
||||||
|
case 'a': /* suppress all but errors diagnostics */
|
||||||
|
options['w'] = 1; /* implies -a */
|
||||||
|
options['s'] = 1;
|
||||||
|
goto next_option;
|
||||||
#endif LINT
|
#endif LINT
|
||||||
|
|
||||||
#ifdef LINT
|
#ifdef LINT
|
||||||
|
|
|
@ -335,7 +335,7 @@ struct type *tp;
|
||||||
while((*tgpp) && (*tgpp)->tg_type != tp) {
|
while((*tgpp) && (*tgpp)->tg_type != tp) {
|
||||||
tgpp = &((*tgpp)->next);
|
tgpp = &((*tgpp)->next);
|
||||||
}
|
}
|
||||||
ASSERT(*tgpp);
|
if (!*tgpp) return;
|
||||||
|
|
||||||
tgp = *tgpp;
|
tgp = *tgpp;
|
||||||
if (tgp->tg_level > L_PROTO) return;
|
if (tgp->tg_level > L_PROTO) return;
|
||||||
|
|
Loading…
Reference in a new issue