This is GCC Bugzilla
This is GCC Bugzilla Version 2.20+
View Bug Activity | Format For Printing | Clone This Bug
Consider: int main () { goto foo; { int i = 0; foo:; } } Compiling this snippet /without/ -Wfatal-errors produces: t.cpp: In function ‘int main()’: t.cpp:1: error: jump to label ‘foo’ t.cpp:1: error: from here t.cpp:1: error: crosses initialization of ‘int i’ Compiling the snippet /with/ -Wfatal-errors, we get: t.cpp: In function ‘int main()’: t.cpp:1: error: jump to label ‘foo’ compilation terminated due to -Wfatal-errors. Alas, half the error message has disappeared.
Well the second error: really should be notes. But really this is doing what -Wfatal-errors is designed to do. -Wfatal-errors is really was only designed to help out reducing testcases and nothing else.
Then perhaps I ought to explain what I'm using -Wfatal-errors for. I wrote an IRC bot called geordi ( http://www.eelis.net/geordi ) that accepts lines of C++ code, compiles them with g++, and either reports the first compilation error or proceeds to run the resulting program and report its output. Geordi has proved to be an extremely useful demonstration tool that is now used in several C++ channels, including Freenode's ##c++ and ##iso-c++. Since geordi only reports the first error (if any), it passes -Wfatal-errors to g++ to not waste time compiling further (response time is very important here). Unfortunately, this means that it currently reports truncated errors for snippets like the one I mentioned.
Apart from the issue regarding that the last two errors should be notes this is really impossible to "fix" if -Wfatal-errors should continue to work as designed. That is, the only way would be to annotate all _callers_ of diagnostic functions to eventually terminate compilation, which is a too large overhead really. Sorry.