Commit 9b17b3a9 authored by johnvg@science.ru.nl's avatar johnvg@science.ru.nl
Browse files

add -wmf option 'for function may fail' warnings

parent e25033c1
......@@ -137,7 +137,7 @@ Bool CallCompiler (int argc, char **argv)
StrictDoAnnots = False;
StrictDepth = 10;/* 8; */
FunctionMayFailIsError = False;
FunctionMayFailWarningOrError = 0;
#ifdef CLEAN2
StdErrorReopened = False;
......@@ -177,8 +177,10 @@ Bool CallCompiler (int argc, char **argv)
DoTimeProfiling=True;
else if (strcmp (argv_i,"-wmt") == 0)
WriteModificationTimes=True;
else if (strcmp (argv_i,"-wmf") == 0)
FunctionMayFailWarningOrError=1;
else if (strcmp (argv_i,"-emf") == 0)
FunctionMayFailIsError=True;
FunctionMayFailWarningOrError=2;
else if (strcmp (argv_i,"-desc") ==0)
DoDescriptors=True;
else if (strcmp (argv_i,"-exl") ==0)
......
......@@ -954,10 +954,8 @@ static void CodeRule (ImpRuleP rule)
++CurrentAltLabel.lab_post;
CurrentLine=rule->rule_alts->alt_line;
#if CLEAN2
if (FunctionMayFailIsError)
#endif
StaticMessage (FunctionMayFailIsError, "%S", "function may fail", CurrentSymbol);
if (FunctionMayFailWarningOrError!=0)
StaticMessage (FunctionMayFailWarningOrError==2, "%S", "function may fail", CurrentSymbol);
MatchError (asize,bsize,rule_sdef,root_node_needed,0);
}
......
......@@ -944,7 +944,8 @@ static void CodeNormalRootNode (Node root,NodeId rootid,int asp,int bsp,CodeGenN
case_def_s.sdef_ident = &case_ident_s;
StaticMessage (FunctionMayFailIsError, "%D", "case may fail", &case_def_s);
if (FunctionMayFailWarningOrError!=0)
StaticMessage (FunctionMayFailWarningOrError==2, "%D", "case may fail", &case_def_s);
if (! (IsOnBStack (resultstate) ||
(IsSimpleState (resultstate) && resultstate.state_kind==StrictRedirection)))
......
......@@ -48,4 +48,5 @@ Bool StrictDoEager = True;
Bool StrictDoVerbose = False;
Bool StrictDoAnnots = True;
Bool FunctionMayFailIsError = False;
int FunctionMayFailWarningOrError = 0; /* 0: ignore, 1: warning, 2: error */
......@@ -46,4 +46,4 @@ extern Bool StrictDoEager;
extern Bool StrictDoVerbose;
extern Bool StrictDoAnnots;
extern Bool FunctionMayFailIsError;
extern int FunctionMayFailWarningOrError;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment