From 26ea1ac2aa1005a68eff165f54ee67b5c1549b35 Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Thu, 10 May 2018 20:20:03 -0400 Subject: [PATCH] build: require gcc >= 5.3 Change-Id: Ie8877a9047c96030f138745a19768fcfa11da855 Refs: #4462 --- .jenkins.d/README.md | 4 +- .travis.yml | 93 ++++++++++------------------ .waf-tools/default-compiler-flags.py | 16 ++--- README-dev.md | 2 +- tests/test-case.t.cpp.sample | 2 +- wscript | 2 +- 6 files changed, 43 insertions(+), 76 deletions(-) diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md index 41812aa..39fa40b 100644 --- a/.jenkins.d/README.md +++ b/.jenkins.d/README.md @@ -13,13 +13,13 @@ Environment Variables Used in Build Scripts * `[OS_TYPE]`: `Linux` * `[DISTRO_TYPE]`: `Ubuntu` - * `[DISTRO_VERSION]`: `Ubuntu-14.04`, `Ubuntu-16.04` + * `[DISTRO_VERSION]`: `Ubuntu-16.04`, `Ubuntu-18.04` Possible values for OS X / macOS: * `[OS_TYPE]`: `OSX` * `[DISTRO_TYPE]`: `OSX` (can be absent) - * `[DISTRO_VERSION]`: `OSX-10.10`, `OSX-10.11`, `OSX-10.12` + * `[DISTRO_VERSION]`: `OSX-10.11`, `OSX-10.12`, `OSX-10.13` - `JOB_NAME`: optional variable to define type of the job. Depending on the defined job type, the build scripts can perform different tasks. diff --git a/.travis.yml b/.travis.yml index c310d6b..984e8ac 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: cpp -dist: trusty +dist: xenial sudo: required env: global: @@ -10,93 +10,35 @@ matrix: include: # Linux/gcc # https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test/+packages - - os: linux - env: COMPILER=g++-4.8 - - os: linux - env: COMPILER=g++-4.9 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-4.9 - os: linux env: COMPILER=g++-5 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-5 - os: linux env: COMPILER=g++-6 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-6 - os: linux env: COMPILER=g++-7 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-7 - os: linux env: COMPILER=g++-8 - addons: - apt: - sources: ubuntu-toolchain-r-test - packages: g++-8 # Linux/clang # https://apt.llvm.org/ - os: linux env: COMPILER=clang++-3.5 - addons: - apt: - packages: clang-3.5 - os: linux env: COMPILER=clang++-3.6 - addons: - apt: - packages: clang-3.6 - os: linux env: COMPILER=clang++-3.7 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-precise-3.7", "ubuntu-toolchain-r-test"] - packages: clang-3.7 - os: linux env: COMPILER=clang++-3.8 - addons: - apt: - sources: ["llvm-toolchain-precise-3.8", "ubuntu-toolchain-r-test"] - packages: clang-3.8 - os: linux - env: COMPILER=clang++-3.9 DISABLE_ASAN=yes - addons: - apt: - sources: ["llvm-toolchain-trusty-3.9", "ubuntu-toolchain-r-test"] - packages: clang-3.9 + env: COMPILER=clang++-3.9 - os: linux env: COMPILER=clang++-4.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-4.0", "ubuntu-toolchain-r-test"] - packages: clang-4.0 - os: linux env: COMPILER=clang++-5.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-5.0", "ubuntu-toolchain-r-test"] - packages: clang-5.0 - os: linux env: COMPILER=clang++-6.0 - addons: - apt: - sources: ["llvm-toolchain-trusty-6.0", "ubuntu-toolchain-r-test"] - packages: clang-6.0 - os: linux env: COMPILER=clang++-7 - addons: - apt: - sources: ["llvm-toolchain-trusty", "ubuntu-toolchain-r-test"] - packages: clang-7 # macOS/clang # https://docs.travis-ci.com/user/reference/osx/#OS-X-Version @@ -111,12 +53,41 @@ matrix: env: OSX_VERSION=10.13 allow_failures: + - env: COMPILER=g++-6 + - env: COMPILER=g++-7 + - env: COMPILER=g++-8 + - env: COMPILER=clang++-3.5 + - env: COMPILER=clang++-3.6 + - env: COMPILER=clang++-3.7 DISABLE_ASAN=yes + - env: COMPILER=clang++-3.8 + - env: COMPILER=clang++-3.9 + - env: COMPILER=clang++-4.0 + - env: COMPILER=clang++-5.0 + - env: COMPILER=clang++-6.0 - env: COMPILER=clang++-7 fast_finish: true +install: | + case ${COMPILER} in + g++-[6789]) + travis_retry sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test + travis_retry sudo apt-get -qq update + travis_retry sudo apt-get -qy install "${COMPILER}" + ;; + clang++-*) + CLANG_VERSION=${COMPILER/clang++} + if [[ ${CLANG_VERSION} != "-3."* ]]; then + wget -O - "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add - + travis_retry sudo add-apt-repository -y "deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial${CLANG_VERSION/-7} main" + fi + travis_retry sudo apt-get -qq update + travis_retry sudo apt-get -qy install "clang${CLANG_VERSION}" + ;; + esac + before_script: - - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-14.04"; fi + - if [[ ${TRAVIS_OS_NAME} == linux ]]; then export NODE_LABELS="Linux Ubuntu Ubuntu-16.04"; fi - if [[ ${TRAVIS_OS_NAME} == osx ]]; then export NODE_LABELS="OSX OSX-${OSX_VERSION}"; fi - if [[ -n ${COMPILER} ]]; then export CXX=${COMPILER}; fi - ${CXX:-c++} --version diff --git a/.waf-tools/default-compiler-flags.py b/.waf-tools/default-compiler-flags.py index 54db7ea..e9fdcc6 100644 --- a/.waf-tools/default-compiler-flags.py +++ b/.waf-tools/default-compiler-flags.py @@ -15,14 +15,14 @@ def configure(conf): errmsg = '' warnmsg = '' if cxx == 'gcc': - if ccver < (4, 8, 2): + if ccver < (5, 3, 0): errmsg = ('The version of gcc you are using is too old.\n' - 'The minimum supported gcc version is 4.8.2.') + 'The minimum supported gcc version is 5.3.0.') conf.flags = GccFlags() elif cxx == 'clang': - if ccver < (3, 4, 0): + if ccver < (3, 5, 0): errmsg = ('The version of clang you are using is too old.\n' - 'The minimum supported clang version is 3.4.0.') + 'The minimum supported clang version is 3.5.0.') conf.flags = ClangFlags() else: warnmsg = 'Note: %s compiler is unsupported' % cxx @@ -164,16 +164,12 @@ class GccBasicFlags(CompilerFlags): class GccFlags(GccBasicFlags): def getDebugFlags(self, conf): flags = super(GccFlags, self).getDebugFlags(conf) - if self.getCompilerVersion(conf) < (5, 1, 0): - flags['CXXFLAGS'] += ['-Wno-missing-field-initializers'] - flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9 + flags['CXXFLAGS'] += ['-fdiagnostics-color'] return flags def getOptimizedFlags(self, conf): flags = super(GccFlags, self).getOptimizedFlags(conf) - if self.getCompilerVersion(conf) < (5, 1, 0): - flags['CXXFLAGS'] += ['-Wno-missing-field-initializers'] - flags['CXXFLAGS'] += ['-fdiagnostics-color'] # gcc >= 4.9 + flags['CXXFLAGS'] += ['-fdiagnostics-color'] return flags class ClangFlags(GccBasicFlags): diff --git a/README-dev.md b/README-dev.md index dc3e937..3f6fef3 100644 --- a/README-dev.md +++ b/README-dev.md @@ -112,5 +112,5 @@ For example: ### Command Line Arguments -[Boost.Program\_options](http://www.boost.org/doc/libs/1_54_0/doc/html/program_options.html) is +[Boost.Program\_options](https://www.boost.org/doc/libs/1_58_0/doc/html/program_options.html) is preferred over getopt(3) for parsing command line arguments. diff --git a/tests/test-case.t.cpp.sample b/tests/test-case.t.cpp.sample index 7aa05f9..77d22c1 100644 --- a/tests/test-case.t.cpp.sample +++ b/tests/test-case.t.cpp.sample @@ -40,7 +40,7 @@ BOOST_AUTO_TEST_CASE(Test1) int i = 0; // For reference of available Boost.Test macros, see - // http://www.boost.org/doc/libs/1_54_0/libs/test/doc/html/utf/testing-tools/reference.html + // https://www.boost.org/doc/libs/1_58_0/libs/test/doc/html/utf/testing-tools/reference.html BOOST_REQUIRE_NO_THROW(i = 1); BOOST_REQUIRE_EQUAL(i, 1); diff --git a/wscript b/wscript index 4782454..c7ccb62 100644 --- a/wscript +++ b/wscript @@ -83,7 +83,7 @@ def version(ctx): else: # no tags matched Context.g_module.VERSION = '%s-commit-%s' % (VERSION_BASE, out) - except subprocess.CalledProcessError: + except (OSError, subprocess.CalledProcessError): pass versionFile = ctx.path.find_node('VERSION')