Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
9b17b3a9
Commit
9b17b3a9
authored
Oct 24, 2018
by
johnvg@science.ru.nl
Browse files
add -wmf option 'for function may fail' warnings
parent
e25033c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
backendC/CleanCompilerSources/cocl.c
View file @
9b17b3a9
...
...
@@ -137,7 +137,7 @@ Bool CallCompiler (int argc, char **argv)
StrictDoAnnots
=
False
;
StrictDepth
=
10
;
/* 8; */
FunctionMayFail
Is
Error
=
False
;
FunctionMayFail
WarningOr
Error
=
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
)
FunctionMayFail
Is
Error
=
True
;
FunctionMayFail
WarningOr
Error
=
2
;
else
if
(
strcmp
(
argv_i
,
"-desc"
)
==
0
)
DoDescriptors
=
True
;
else
if
(
strcmp
(
argv_i
,
"-exl"
)
==
0
)
...
...
backendC/CleanCompilerSources/codegen.c
View file @
9b17b3a9
...
...
@@ -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
);
}
...
...
backendC/CleanCompilerSources/codegen3.c
View file @
9b17b3a9
...
...
@@ -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
)))
...
...
backendC/CleanCompilerSources/settings.c
View file @
9b17b3a9
...
...
@@ -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 */
backendC/CleanCompilerSources/settings.h
View file @
9b17b3a9
...
...
@@ -46,4 +46,4 @@ extern Bool StrictDoEager;
extern
Bool
StrictDoVerbose
;
extern
Bool
StrictDoAnnots
;
extern
Bool
FunctionMayFail
Is
Error
;
extern
int
FunctionMayFail
WarningOr
Error
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment