Changes between Version 18 and Version 19 of Guidelines/WarningsGuidelines


Ignore:
Timestamp:
01/20/11 18:04:33 (3 years ago)
Author:
phorgan1
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Guidelines/WarningsGuidelines

    v18 v19  
    295295=== Turning on Warnings ===  
    296296     
    297 GCC uses command line warnings to turn on warnings.  If you want to turn on warnings about unused variables you would add -Wunused-variable to the command line.  Some of the command line options such as -Wall, -Wextra, and -pedantic turn on groups of warnings as detailed below.  Sometimes a group is almost right, but not quite.  If you want -pedantic, for example, but without warnings about the use of long long for use with C++98, you could say -pedantic -Wno-long-long.  In general, for any diagnostic option specified as -Woption-name, it can be turned off with -Wno-option-name. 
     297    GCC uses command line warnings to turn on warnings.  If you want to turn on warnings about unused variables you would add -Wunused-variable to the command line.  Some of the command line options such as -Wall, -Wextra, and -pedantic turn on groups of warnings as detailed below.  Sometimes a group is almost right, but not quite.  If you want -pedantic, for example, but without warnings about the use of long long for use with C++98, you could say -pedantic -Wno-long-long.  You could also say -pedantic -std=c++0x since long long is in that version of the spec.  In general, any diagnostic option specified as -Woption-name can be turned off with -Wno-option-name. 
    298298 
    299299'''-Wall''' 
     
    361361'''-pedantic''' 
    362362 
    363     This instructs GCC to consider the release version of C or C++ and to first issue all warnings required by that version of the standard, and second warn about the use of gcc extensions to the language.  This would, for instance warn about the use of ''#ident'' since it is a gcc extension and is not in any of the standards.  Using -pedantic makes it easier to write portable code, or at least to know when it is not.  Best used with the ''-std=xxxxx'' argument to the compiler, so that you know what version of the standard you're being compared to.  Currently if ''-std=xxxxx'' is not specified, it's as if you'd written ''-std=gnu++98''.  Much of boost uses facilities from more recent versions of the standard, so it might make more sense to explicitly specify ''-std=c++0x'' or ''-std=gnu++0x''.  ''-std=c++0x'' is most portable.  See the page [http://gcc.gnu.org/onlinedocs/gcc/Standards.html] for more information. 
     363    Tells GCC that you intend to adhere to a particular version of a language standard.  Causes GCC to issue all required diagnostics of version of the C or C++ language standard as given by the -std=xxxx option (the default is -std=gnu++98 for C++). 
     364 
     365    Also warns about the use of GCC extensions. (This would, for instance, warn about the use of #ident, which is a non-standard, GCC extension.) 
     366 
     367    Some of the warnings this option will trigger can be suppressed, such as the use of long long in C++98 code with -Wno-long-long, but many cannot. 
     368 
     369    Using -pedantic makes it easier to write portable code. 
     370 
     371    Best used with explicit -std=xxxx.  Much of boost uses facilities from more recent versions of the C++ standard, so it might make more sense to explicitly specify ''-std=c++0x'' or ''-std=gnu++0x''.  Both have the same effect on -pedantic.  See the page [http://gcc.gnu.org/onlinedocs/gcc/Standards.html] for more information. 
    364372 
    365373