Debug options added for C, C++ & Fortran
Sylvestre Ledru
sylvestre.ledru at scilab.org
Thu Sep 11 10:37:29 CEST 2008
Hello guys,
I committed an update which increases the number of warnings.
====== For C ======
-Wold-style-definition: warning about the old style declaration
void myBloodyFunction(plop) int plop {
It will also complain about:
void myGreatFucking(){
(void is missing)
-g3: added more symbols into the binary (like macros).
====== For C++ ======
-Weffc++ (copy & paste of the man g++)
Warn about violations of the following style guidelines from Scott
Meyers’ Effective C++ book:
· Item 11: Define a copy constructor and an assignment
operator for classes with dynamically allocated memory.
· Item 12: Prefer initialization to assignment in
constructors.
· Item 14: Make destructors virtual in base classes.
· Item 15: Have "operator=" return a reference to *this.
· Item 23: Don’t try to return a reference when you must
return an object.
Also warn about violations of the following style guidelines
from Scott Meyers’ More Effective C++ book:
· Item 6: Distinguish between prefix and postfix forms of
increment and decrement operators.
· Item 7: Never overload "&&", "||", or ",".
When selecting this option, be aware that the standard
library headers do not obey all of these guidelines; use
grep -v to filter out those warnings.
-g3 has been also added here
====== For Fortran ======
(if you don't care about Fortran warnings, stop using --enable-debug and
use --enable-debug-C & --enable-debug-CXX)
-Wimplicit:
Warn when implicit declaration are used (yet, we have tones of them)
-Wsurprising, once more, a lazy C/P:
Produce a warning when "suspicious" code constructs are encountered.
While technically legal these usually indicate that an error has been
made.
This currently produces a warning under the following
circumstances:
· An INTEGER SELECT construct has a CASE that can never be
matched as its lower value is greater than its upper value.
· A LOGICAL SELECT construct has three CASE statements.
· A TRANSFER specifies a source that is shorter than the
destination.
Sylvestre
More information about the dev
mailing list