aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorTuncer Ayaz <[email protected]>2011-08-02 16:41:53 +0200
committerTuncer Ayaz <[email protected]>2011-09-08 14:02:17 +0200
commita6b46d18e04c23cf8f7798ebc4ef34e4e03eb04e (patch)
tree05203700846a03d155e02ce54147596c4bbb6672 /lib
parent089df2b89969353229093ac56665f1b52d87ce09 (diff)
downloadotp-a6b46d18e04c23cf8f7798ebc4ef34e4e03eb04e.tar.gz
otp-a6b46d18e04c23cf8f7798ebc4ef34e4e03eb04e.tar.bz2
otp-a6b46d18e04c23cf8f7798ebc4ef34e4e03eb04e.zip
yecc: log warnings as errors if -Werror is enabled
Diffstat (limited to 'lib')
-rw-r--r--lib/parsetools/src/yecc.erl18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/parsetools/src/yecc.erl b/lib/parsetools/src/yecc.erl
index d714420680..d03435c441 100644
--- a/lib/parsetools/src/yecc.erl
+++ b/lib/parsetools/src/yecc.erl
@@ -852,14 +852,22 @@ report_errors(St) ->
end.
report_warnings(St) ->
- case member(report_warnings, St#yecc.options) of
+ Werr = member(warnings_as_errors, St#yecc.options),
+ Prefix = case Werr of
+ true -> "";
+ false -> "Warning: "
+ end,
+ ReportWerr = Werr andalso member(report_errors, St#yecc.options),
+ case member(report_warnings, St#yecc.options) orelse ReportWerr of
true ->
foreach(fun({File,{none,Mod,W}}) ->
- io:fwrite(<<"~s: Warning: ~s\n">>,
- [File,Mod:format_error(W)]);
+ io:fwrite(<<"~s: ~s~s\n">>,
+ [File,Prefix,
+ Mod:format_error(W)]);
({File,{Line,Mod,W}}) ->
- io:fwrite(<<"~s:~w: Warning: ~s\n">>,
- [File,Line,Mod:format_error(W)])
+ io:fwrite(<<"~s:~w: ~s~s\n">>,
+ [File,Line,Prefix,
+ Mod:format_error(W)])
end, sort(St#yecc.warnings));
false ->
ok