lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] A matter of style


From: Greg Chicares
Subject: Re: [lmi] A matter of style
Date: Wed, 07 Mar 2007 03:37:32 +0000
User-agent: Thunderbird 1.5.0.4 (Windows/20060516)

On 2007-3-7 0:58 UTC, Vadim Zeitlin wrote:
[...]
>  So I'd like to recommend to try to enable -Wunreachable-code for LMI
> compilation and then allow writing just
> 
>       if ( condition )
>               return;
> 
> as forgetting to add the braces will result in a warning.

That's an intriguing idea.

>From time to time, I try rebuilding everything from scratch with
stronger warnings. I don't often find that I can reenable a
suppressed warning, but sometimes I do find errors in lmi itself
that had been suppressed because of diagnostics arising from
libraries we use. It was time to do that again anyway, so thanks
for prompting me.

This particular warning is documented in 'workhorse.make':
  # Too many warnings for libstdc++:
  #  -Wunreachable-code \

I rebuilt with that warning and filtered the output this way:
  sed -e'/executed/!d' | sort | uniq
to remove duplicates because there were over nine hundred
warnings, of which the thirty-two pasted below [1] are unique.
Of those, seventeen are in libstdc++.

We could consider inhibiting this default:
  -Wsystem-headers
    Print warning messages for constructs found in system header files.
assuming that a '-Wno-system-headers' form is defined. But that
would still leave five unique warnings in third-party libraries,
the one in 'boost/shared_ptr.hpp' being the worst because it
affects much of our own code.

I have a strong prejudice in favor of keeping
  -pedantic-errors -Werror
to treat all warnings as errors. If we weaken that, then every
time we compile we'll have to filter out diagnostics that we've
deemed benign. If we did that manually, I'm sure we'd overlook
some actual problems, and the code would suffer. We could write
a script to do that, but then that script would have to be
maintained carefully, every time we update the compiler or a
library. I don't see this as a good path to follow.

As always, I welcome your thoughts. I find that if I expose
my reasoning in detail, you sometimes point out premises
that I should change, resulting in a better outcome.

---------

[1] Unique '-Wunreachable-code' warnings:

C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/allocator.h:103:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/basic_ios.h:268:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:1988:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:418:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/basic_string.h:426:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_algo.h:208:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_algobase.h:380:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_iterator.h:666:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_iterator.h:700:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_tree.h:180:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_vector.h:106:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/stl_vector.h:95:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/vector.tcc:257:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bits/vector.tcc:260:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/bitset:1019:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/new:56:
 warning: will never be executed
C:/MinGW-20050827//bin/../lib/gcc/mingw32/3.4.4/../../../../include/c++/3.4.4/new:96:
 warning: will never be executed
C:/lmi/src/lmi/actuarial_table.cpp:263: warning: will never be executed
C:/lmi/src/lmi/actuarial_table.cpp:264: warning: will never be executed
C:/lmi/src/lmi/actuarial_table.cpp:265: warning: will never be executed
C:/lmi/src/lmi/actuarial_table.cpp:275: warning: will never be executed
C:/lmi/src/lmi/crc32.cpp:147: warning: will never be executed
C:/lmi/src/lmi/ihs_fpios.cpp:177: warning: will never be executed
C:/lmi/src/lmi/ihs_pios.cpp:142: warning: will never be executed
C:/lmi/src/lmi/mvc_model.cpp:67: warning: will never be executed
C:/lmi/src/lmi/obstruct_slicing.hpp:99: warning: will never be executed
C:/lmi/src/lmi/xenumtypes.cpp:979: warning: will never be executed
C:/opt/lmi/third_party/include/boost/shared_ptr.hpp:252: warning: will never be 
executed
C:/opt/lmi/third_party/src/cgicc/CgiUtils.cpp:68: warning: will never be 
executed
C:/opt/lmi/third_party/src/libxml/ait_impl.cxx:273: warning: will never be 
executed
C:/opt/lmi/third_party/src/libxml/node.cxx:113: warning: will never be executed
C:/opt/lmi/third_party/src/libxml/tree_parser.cxx:190: warning: will never be 
executed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]