build: update waf to version 2.0.6
Fix discovered build issues
Change-Id: I9a861c955283c1b20cc5065a4baa22bd7c2ab0c1
diff --git a/.waf-tools/coverage.py b/.waf-tools/coverage.py
index ce92883..cc58165 100644
--- a/.waf-tools/coverage.py
+++ b/.waf-tools/coverage.py
@@ -1,15 +1,15 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import TaskGen, Logs
+from waflib import TaskGen
def options(opt):
- opt.add_option('--with-coverage', action='store_true', default=False, dest='with_coverage',
- help='''Set compiler flags for gcc to enable code coverage information''')
+ opt.add_option('--with-coverage', action='store_true', default=False,
+ help='Add compiler flags to enable code coverage information')
def configure(conf):
if conf.options.with_coverage:
if not conf.options.debug:
- conf.fatal("Code coverage flags require debug mode compilation (add --debug)")
+ conf.fatal('Code coverage flags require debug mode compilation (add --debug)')
conf.check_cxx(cxxflags=['-fprofile-arcs', '-ftest-coverage', '-fPIC'],
linkflags=['-fprofile-arcs'], uselib_store='GCOV', mandatory=True)
diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py
index e11f7f1..54db7ea 100644
--- a/.waf-tools/default-compiler-flags.py
+++ b/.waf-tools/default-compiler-flags.py
@@ -1,64 +1,67 @@
# -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-from waflib import Logs, Configure, Utils
+from waflib import Configure, Logs, Utils
def options(opt):
- opt.add_option('--debug', '--with-debug', action='store_true', default=False, dest='debug',
- help='''Compile in debugging mode with minimal optimizations (-O0 or -Og)''')
+ opt.add_option('--debug', '--with-debug', action='store_true', default=False,
+ help='Compile in debugging mode with minimal optimizations (-O0 or -Og)')
def configure(conf):
conf.start_msg('Checking C++ compiler version')
- cxx = conf.env['CXX_NAME'] # CXX_NAME is the generic name of the compiler
- ccver = tuple(int(i) for i in conf.env['CC_VERSION'])
+ cxx = conf.env.CXX_NAME # generic name of the compiler
+ ccver = tuple(int(i) for i in conf.env.CC_VERSION)
+ ccverstr = '.'.join(conf.env.CC_VERSION)
errmsg = ''
warnmsg = ''
if cxx == 'gcc':
if ccver < (4, 8, 2):
errmsg = ('The version of gcc you are using is too old.\n'
'The minimum supported gcc version is 4.8.2.')
- flags = GccFlags()
+ conf.flags = GccFlags()
elif cxx == 'clang':
if ccver < (3, 4, 0):
errmsg = ('The version of clang you are using is too old.\n'
'The minimum supported clang version is 3.4.0.')
- flags = ClangFlags()
+ conf.flags = ClangFlags()
else:
warnmsg = 'Note: %s compiler is unsupported' % cxx
- flags = CompilerFlags()
+ conf.flags = CompilerFlags()
if errmsg:
- conf.end_msg('.'.join(conf.env['CC_VERSION']), color='RED')
+ conf.end_msg(ccverstr, color='RED')
conf.fatal(errmsg)
elif warnmsg:
- conf.end_msg('.'.join(conf.env['CC_VERSION']), color='YELLOW')
+ conf.end_msg(ccverstr, color='YELLOW')
Logs.warn(warnmsg)
else:
- conf.end_msg('.'.join(conf.env['CC_VERSION']))
+ conf.end_msg(ccverstr)
- areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
+ conf.areCustomCxxflagsPresent = (len(conf.env.CXXFLAGS) > 0)
# General flags are always applied (e.g., selecting C++11 mode)
- generalFlags = flags.getGeneralFlags(conf)
+ generalFlags = conf.flags.getGeneralFlags(conf)
conf.add_supported_cxxflags(generalFlags['CXXFLAGS'])
conf.add_supported_linkflags(generalFlags['LINKFLAGS'])
conf.env.DEFINES += generalFlags['DEFINES']
+@Configure.conf
+def check_compiler_flags(conf):
# Debug or optimized CXXFLAGS and LINKFLAGS are applied only if the
# corresponding environment variables are not set.
# DEFINES are always applied.
if conf.options.debug:
- extraFlags = flags.getDebugFlags(conf)
- if areCustomCxxflagsPresent:
+ extraFlags = conf.flags.getDebugFlags(conf)
+ if conf.areCustomCxxflagsPresent:
missingFlags = [x for x in extraFlags['CXXFLAGS'] if x not in conf.env.CXXFLAGS]
- if len(missingFlags) > 0:
- Logs.warn("Selected debug mode, but CXXFLAGS is set to a custom value '%s'"
- % " ".join(conf.env.CXXFLAGS))
- Logs.warn("Default flags '%s' are not activated" % " ".join(missingFlags))
+ if missingFlags:
+ Logs.warn('Selected debug mode, but CXXFLAGS is set to a custom value "%s"'
+ % ' '.join(conf.env.CXXFLAGS))
+ Logs.warn('Default flags "%s" will not be used' % ' '.join(missingFlags))
else:
- extraFlags = flags.getOptimizedFlags(conf)
+ extraFlags = conf.flags.getOptimizedFlags(conf)
- if not areCustomCxxflagsPresent:
+ if not conf.areCustomCxxflagsPresent:
conf.add_supported_cxxflags(extraFlags['CXXFLAGS'])
conf.add_supported_linkflags(extraFlags['LINKFLAGS'])
@@ -75,9 +78,10 @@
self.start_msg('Checking supported CXXFLAGS')
supportedFlags = []
- for flag in cxxflags:
- if self.check_cxx(cxxflags=['-Werror', flag], mandatory=False):
- supportedFlags += [flag]
+ for flags in cxxflags:
+ flags = Utils.to_list(flags)
+ if self.check_cxx(cxxflags=['-Werror'] + flags, mandatory=False):
+ supportedFlags += flags
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('CXXFLAGS', supportedFlags)
@@ -93,15 +97,19 @@
self.start_msg('Checking supported LINKFLAGS')
supportedFlags = []
- for flag in linkflags:
- if self.check_cxx(linkflags=['-Werror', flag], mandatory=False):
- supportedFlags += [flag]
+ for flags in linkflags:
+ flags = Utils.to_list(flags)
+ if self.check_cxx(linkflags=['-Werror'] + flags, mandatory=False):
+ supportedFlags += flags
self.end_msg(' '.join(supportedFlags))
self.env.prepend_value('LINKFLAGS', supportedFlags)
class CompilerFlags(object):
+ def getCompilerVersion(self, conf):
+ return tuple(int(i) for i in conf.env.CC_VERSION)
+
def getGeneralFlags(self, conf):
"""Get dict of CXXFLAGS, LINKFLAGS, and DEFINES that are always needed"""
return {'CXXFLAGS': [], 'LINKFLAGS': [], 'DEFINES': []}
@@ -132,6 +140,7 @@
'-Wall',
'-Wextra',
'-Werror',
+ '-Wnon-virtual-dtor',
'-Wno-error=deprecated-declarations', # Bug #3795
'-Wno-error=maybe-uninitialized', # Bug #1615
'-Wno-unused-parameter',
@@ -146,6 +155,7 @@
'-pedantic',
'-Wall',
'-Wextra',
+ '-Wnon-virtual-dtor',
'-Wno-unused-parameter',
]
flags['LINKFLAGS'] += ['-fuse-ld=gold', '-Wl,-O1']
@@ -154,16 +164,14 @@
class GccFlags(GccBasicFlags):
def getDebugFlags(self, conf):
flags = super(GccFlags, self).getDebugFlags(conf)
- version = tuple(int(i) for i in conf.env['CC_VERSION'])
- if version < (5, 1, 0):
+ if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
def getOptimizedFlags(self, conf):
flags = super(GccFlags, self).getOptimizedFlags(conf)
- version = tuple(int(i) for i in conf.env['CC_VERSION'])
- if version < (5, 1, 0):
+ if self.getCompilerVersion(conf) < (5, 1, 0):
flags['CXXFLAGS'] += ['-Wno-missing-field-initializers']
flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9
return flags
@@ -171,32 +179,36 @@
class ClangFlags(GccBasicFlags):
def getGeneralFlags(self, conf):
flags = super(ClangFlags, self).getGeneralFlags(conf)
- if Utils.unversioned_sys_platform() == 'darwin':
- flags['CXXFLAGS'] += ['-stdlib=libc++']
- flags['LINKFLAGS'] += ['-stdlib=libc++']
+ if Utils.unversioned_sys_platform() == 'darwin' and self.getCompilerVersion(conf) >= (9, 0, 0):
+ # Bug #4296
+ flags['CXXFLAGS'] += [['-isystem', '/usr/local/include'], # for Homebrew
+ ['-isystem', '/opt/local/include']] # for MacPorts
return flags
def getDebugFlags(self, conf):
flags = super(ClangFlags, self).getDebugFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
+ '-Wextra-semi',
+ '-Wundefined-func-template',
'-Wno-error=deprecated-register',
- '-Wno-error=ignored-qualifiers',
'-Wno-error=infinite-recursion', # Bug #3358
'-Wno-error=keyword-macro', # Bug #3235
'-Wno-error=unneeded-internal-declaration', # Bug #1588
- '-Wno-keyword-macro',
- '-Wno-nested-anon-types',
- '-Wno-sign-compare',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
+ version = self.getCompilerVersion(conf)
+ if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
+ flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
return flags
def getOptimizedFlags(self, conf):
flags = super(ClangFlags, self).getOptimizedFlags(conf)
flags['CXXFLAGS'] += ['-fcolor-diagnostics',
- '-Wno-keyword-macro',
- '-Wno-nested-anon-types',
- '-Wno-sign-compare',
+ '-Wextra-semi',
+ '-Wundefined-func-template',
'-Wno-unused-local-typedef', # Bugs #2657 and #3209
]
+ version = self.getCompilerVersion(conf)
+ if version < (3, 9, 0) or (Utils.unversioned_sys_platform() == 'darwin' and version < (8, 1, 0)):
+ flags['CXXFLAGS'] += ['-Wno-unknown-pragmas']
return flags