Changes between Version 16 and Version 17 of Guidelines/MaintenanceGuidelines


Ignore:
Timestamp:
Nov 6, 2009, 4:15:05 PM (13 years ago)
Author:
Paul A. Bristow
Comment:

Added some notes on warnings and suggested actions.

Legend:

Unmodified
Added
Removed
Modified
  • Guidelines/MaintenanceGuidelines

    v16 v17  
    5705701  Test compilation with the most pedantic setting for the compiler.
    571571
    572 For Microsoft Visual Studio, this means setting level to 4 (command line /W4),
    573 and disabling Microsoft language extensions
    574 Disable MS extensions = Yes, command line option /Za
     572For Microsoft Visual Studio, this means setting level to 4 (command line /W4),[[BR]]
     573and disabling Microsoft language extensions Disable MS extensions = Yes, command line option /Za
     574
     575(You might also consider using Microsoft /Wall if available.  You may find
     576[http://www.geoffchappell.com/viewer.htm?doc=studies/msvc/cl/c1xx/warnings/index.htm&tx=2,27&ts=0,3820]
     577a helpful guide to the byzantine complexity of warnings).[[BR]]
    575578
    576579For GCC this means -Wall -pendantic 
     
    580583-pedantic -Wall -Wno-long-long -Wno-unused-value
    581584
    582 but this is a global setting, so you need to document that these warning must be suppressed by users of this module.  This may be acceptable if they are building a library of entirely Boost modules.
     585but this is a global setting, so you need to document that these warnings must be suppressed by users of this module.  This may be acceptable if they are building a library of entirely Boost modules.
    583586
    584587Using bjam add warnings=all to the invocation command line.
     
    659662
    660663
    661 
    662 
    663 
     664=== Specific warnings and suggested actions. ===
     665
     666''These are just few for starters and need more especially for gcc. Suggestions may be wrong!  Also need reordering in a table.''
     667
     668'''Microsoft'''
     669
     670If you chose to suppress (rather than fix by recoding),
     671localise the warnings as far as possible by using push'n'pop pragmas (see above).
     672
     6731  C4512 assignment operator could not be generated
     674
     675Suppress using push'n'pop for the module(s) causing the warning.
     676//#  pragma warning(disable: 4512) // assignment operator could not be generated
     677
     678
     6792  C4996 'putenv': The POSIX name for this item is deprecated.[[BR]]
     680and many other messages about using secure versions.
     681
     682Unless you believe that the 'secure' versions are useful, suppress with
     683#  pragma warning(disable: 4996) // '' was declared deprecated
     684
     6853  C4127 conditional expression is constant[[BR]]
     686
     687Very common and many believe unhelpful, but a few find it informative, so do not suppress globally.
     688
     689Even while(true) can trigger this!  Suppress.[[BR]]
     690
     691 #  pragma warning(disable: 4127) // conditional expression is constant
     692
     6934 C4100 unreferenced formal parameter
     694
     695Either surround the parameter with C comments, for example: int */ my_variable */)
     696or just delete if the variable name is uninformative.
     697
     6985 C4701 local variable may be used without having been initialized
     699
     700Best is to recode to avoid the message, but if you are '''very''' sure the message is misleading, suppress.
     701
     702 #  pragma warning(disable: 4701) // local variable may be used without having been initialized
     703
     7046 c4511  copy constructor could not be generated
     705
     706This can almost certainly be suppressed.
     707 #  pragma warning(disable: 4511) // copy constructor could not be generated
     708
     7097 C4180  qualifier applied to function type has no meaning; ignored
     710
     711This can always be suppressed - but check that you didn't mean to put the const somewhere else.
     712
     7138 C4702  unreachable code
     714
     715Be very cautious about suppressing this, but use of macros may make this troublesome,
     716so suppress with care, and always locally.
     717
     718 #pragma warning(disable: 4702) // unreachable code
     719
     7209 C4189 local variable is initialized but not referenced
     721
     722This probably indicates a redundant variable and assignment, so probably remove it.
     723
     724If you sure it is required (or has negligible cost for some documentation benefit), suppress.
     725
     72610  C4224 nonstandard extension used : formal parameter 'arg' was previously defined as a type.
     727
     728This will bite users who try to compile with Microsoft extensions disabled.
     729So is most undesirable, but may be a major nuisance to change the names in code.
     730However fixing is the Right Thing, but meanwhile suppressing may be helpful.
     731
     732 #  pragma warning(disable: 4224) // formal parameter 'arg' was previously defined as a type.
     733
     73411 C4510  default constructor could not be generated
     735
     736Suppress.
     737
     73812 C4800 int' : forcing value to bool 'true' or 'false'
     739
     740Suppress.
     741
     74213 C4244   // Conversion: possible loss of data.
     743
     744Fix, for example changing type or using static_cast is best, suppress with much caution.
     745
     746  # pragma warning(disable:4244)    // Conversion: possible loss of data.
     747
     74814  C4324  structure was padded due to __declspec(align())
     749
     750Suppress
     751
     752#pragma warning(disable:4324) // structure was padded due to __declspec(align())
     753
     754'''GCC'''
     755
     7561  class does not have a  virtual destructor
     757
     758Suppress or provide a virtual destructor.
     759