https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46476
Eric Gallager <egallager at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |89863 --- Comment #17 from Eric Gallager <egallager at gcc dot gnu.org> --- (In reply to David Binderman from comment #16) > (In reply to Manuel López-Ibáñez from comment #14) > > But the main barrier for this is not technical or acceptance, it is > > leadership and human resources. > > And the usual time and money. There are plenty of static analysers out there. > Unless it is substantially better, why write another one ? > > My favourite static analyser, cppcheck, says this for the original code: > > $ ~/cppcheck/trunk/cppcheck --enable=all bug46476.cc > [bug46476.cc:5]: (style) Statements following return, break, continue, goto > or throw will never be executed. > [bug46476.cc:11]: (style) Statements following return, break, continue, goto > or throw will never be executed. > [bug46476.cc:8]: (style) The function 'bar' is never used. > [bug46476.cc:2]: (style) The function 'foo' is never used. > $ > > which pretty much does the job. > > Running the same static analyser over the source code of a recent gcc > found 22 occurrences of this kind of problem. > > Here they are: > > $ fgrep "Statements following" cppcheck.20170617.out > [trunk/gcc/c/c-decl.c:3211]: (style) Statements following return, break, > continue, goto or throw will never be executed. > [trunk/gcc/fortran/arith.c:2009]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/dwarf.c:2709]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/dwarf.c:2758]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/dwarf.c:2892]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/dwarf.c:3025]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/elf.c:448]: (style) Statements following return, break, > continue, goto or throw will never be executed. > [trunk/libbacktrace/elf.c:493]: (style) Statements following return, break, > continue, goto or throw will never be executed. > [trunk/libbacktrace/elf.c:967]: (style) Statements following return, break, > continue, goto or throw will never be executed. > [trunk/libbacktrace/fileline.c:64]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/fileline.c:75]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/pecoff.c:499]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/pecoff.c:564]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libbacktrace/pecoff.c:931]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libcilkrts/runtime/cilk_fiber.cpp:968]: (style) Statements following > return, break, continue, goto or throw will never be executed. > [trunk/libcilkrts/runtime/scheduler.c:2468]: (style) Statements following > return, break, continue, goto or throw will never be executed. > [trunk/libcilkrts/runtime/scheduler.c:2550]: (style) Statements following > return, break, continue, goto or throw will never be executed. > [trunk/libcilkrts/runtime/scheduler.c:2439]: (style) Statements following > return, break, continue, goto or throw will never be executed. > [trunk/libffi/src/dlmalloc.c:3877]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libgomp/error.c:90]: (style) Statements following return, break, > continue, goto or throw will never be executed. > [trunk/libgomp/libgomp-plugin.c:79]: (style) Statements following return, > break, continue, goto or throw will never be executed. > [trunk/libobjc/error.c:41]: (style) Statements following return, break, > continue, goto or throw will never be executed. > $ > > Most of them seem to be in libbacktrace. I could look deeper into these > and generate some bug reports. That's the usual way to provoke gcc developers > into developing a new warning: show that the gcc source code would benefit > from it. Dunno how I missed this when I created the new cppcheck meta-bug; adding this as a dependency for it now Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89863 [Bug 89863] [meta-bug] Issues that cppcheck finds that gcc misses