diff -r 67e50943a093 doc/tutorial/source/getting-started.rst --- a/doc/tutorial/source/getting-started.rst Thu Jun 21 18:28:31 2018 -0700 +++ b/doc/tutorial/source/getting-started.rst Sun Jun 24 11:22:03 2018 -0700 @@ -592,7 +592,7 @@ There is also an intermediate build profile, ``release``. ``-d`` is a synonym for ``--build-profile``. -The build profile controls the use of logging, assertions, and compiler optimization: +The build profile controls the use of logging, assertions, warnings, and compiler optimization: +--------------------+---------------------------------+-----------------------------------------------------------------+ | Feature | Build Profile | @@ -605,7 +605,8 @@ +--------------------+---------------------------------+-------------------------------+---------------------------------+ | Code Wrapper Macro | ``NS_BUILD_DEBUG(code)`` | ``NS_BUILD_RELEASE(code)`` | ``NS_BUILD_OPTIMIZED(code)`` | +--------------------+---------------------------------+-------------------------------+---------------------------------+ -| Compiler Flags | ``-O0 -ggdb -g3`` | ``-O3 -g0`` | ``-O3 -g`` | +| Compiler Flags | ``-O0 -ggdb -g3`` | ``-O2 -g`` | ``-O3 -g0`` | +| | ``-Wall -Werror`` | ``-Wall`` | ``-Wall`` | | | | ``-fomit-frame-pointer`` | ``-fstrict-overflow`` | | | | | ``-march=native`` | +--------------------+---------------------------------+-------------------------------+---------------------------------+ @@ -624,6 +625,14 @@ DoLongInvolvedComputation (); NS_BUILD_DEBUG (timer.Stop (); std::cout << "Done: " << timer << std::endl;) +If you are using an older ns-3 release on a newer system, the -Werror option (treating +all warnings as errors) may prevent a successful build. This flag may be disabled +by passing the --disable-werror flag to Waf configuration: + +:: + + $ ./waf configure -d debug --disable-werror ... + By default Waf puts the build artifacts in the ``build`` directory. You can specify a different output directory with the ``--out`` option, e.g. diff -r 67e50943a093 waf-tools/cflags.py --- a/waf-tools/cflags.py Thu Jun 21 18:28:31 2018 -0700 +++ b/waf-tools/cflags.py Sun Jun 24 11:22:03 2018 -0700 @@ -18,7 +18,7 @@ class GccTraits(CompilerTraits): def __init__(self): super(GccTraits, self).__init__() - # cumulative list of warnings per level + # cumulative list of warnings per level: levels 1, 2, 3 self.warnings_flags = [['-Wall'], ['-Werror'], ['-Wextra']] def get_warnings_flags(self, level): @@ -159,6 +159,9 @@ opt.add_option('--check-profile', help=('print out current build profile'), default=False, dest='check_profile', action="store_true") + opt.add_option('--disable-werror', + help=('disable -Werror flag (warnings treated as errors'), + default=False, dest='disable_werror', action="store_true") def configure(conf): cc = conf.env['COMPILER_CC'] or None cxx = conf.env['COMPILER_CXX'] or None @@ -181,7 +184,13 @@ optimizations = compiler.get_optimization_flags(opt_level) debug, debug_defs = compiler.get_debug_flags(dbg_level) warnings = compiler.get_warnings_flags(warn_level) - + + if Options.options.disable_werror: + try: + warnings.remove ('-Werror') + except ValueError: + pass + if cc and not conf.env['CCFLAGS']: conf.env.append_value('CCFLAGS', optimizations) conf.env.append_value('CCFLAGS', debug) diff -r 67e50943a093 wscript --- a/wscript Thu Jun 21 18:28:31 2018 -0700 +++ b/wscript Sun Jun 24 11:22:03 2018 -0700 @@ -54,8 +54,8 @@ cflags.profiles = { # profile name: [optimization_level, warnings_level, debug_level] 'debug': [0, 2, 3], - 'optimized': [3, 2, 1], - 'release': [3, 2, 0], + 'optimized': [3, 1, 0], + 'release': [2, 1, 1], } cflags.default_profile = 'debug'