From 2c816b139233d2b756abf155a1bc49e32f90952d Mon Sep 17 00:00:00 2001 From: Brenden Matthews Date: Wed, 19 Dec 2018 11:11:24 -0500 Subject: [PATCH] Build fix for older GCC versions. (#710) Add some older OS versions to the build matrix to make sure we don't inadvertantly break the build. This resolves issue #708. --- .travis.yml | 166 ++++++++++++++++++++++++++++++++++++++++++++++++++- src/linux.cc | 4 +- 2 files changed, 167 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index a55bf583..e04066c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,126 @@ language: cpp matrix: include: + - os: linux + dist: xenial + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-5 + - cmake + - libxdamage-dev + - libx11-dev + - libxft-dev + - libxext-dev + - libglib2.0-dev + - libxml2-dev + - libcurl4-gnutls-dev + - liblua5.1-0-dev + - libtolua++5.1-dev + - libcairo2-dev + - libimlib2-dev + - libxinerama-dev + - libmysqlclient-dev + - libical-dev + - libircclient-dev + - libcairo2-dev + - libmicrohttpd-dev + - ncurses-dev + - liblua5.1-dev + - librsvg2-dev + - libaudclient-dev + - libxmmsclient-dev + - libpulse-dev + - libcurl4-gnutls-dev + - audacious-dev + - libsystemd-dev + - libxml2-dev + - tolua++ + - gawk + env: + - MATRIX_EVAL="CC=gcc-5 && CXX=g++-5" + - os: linux + dist: xenial + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-6 + - cmake + - libxdamage-dev + - libx11-dev + - libxft-dev + - libxext-dev + - libglib2.0-dev + - libxml2-dev + - libcurl4-gnutls-dev + - liblua5.1-0-dev + - libtolua++5.1-dev + - libcairo2-dev + - libimlib2-dev + - libxinerama-dev + - libmysqlclient-dev + - libical-dev + - libircclient-dev + - libcairo2-dev + - libmicrohttpd-dev + - ncurses-dev + - liblua5.1-dev + - librsvg2-dev + - libaudclient-dev + - libxmmsclient-dev + - libpulse-dev + - libcurl4-gnutls-dev + - audacious-dev + - libsystemd-dev + - libxml2-dev + - tolua++ + - gawk + env: + - MATRIX_EVAL="CC=gcc-6 && CXX=g++-6" + - os: linux + dist: xenial + addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-7 + - cmake + - libxdamage-dev + - libx11-dev + - libxft-dev + - libxext-dev + - libglib2.0-dev + - libxml2-dev + - libcurl4-gnutls-dev + - liblua5.1-0-dev + - libtolua++5.1-dev + - libcairo2-dev + - libimlib2-dev + - libxinerama-dev + - libmysqlclient-dev + - libical-dev + - libircclient-dev + - libcairo2-dev + - libmicrohttpd-dev + - ncurses-dev + - liblua5.1-dev + - librsvg2-dev + - libaudclient-dev + - libxmmsclient-dev + - libpulse-dev + - libcurl4-gnutls-dev + - audacious-dev + - libsystemd-dev + - libxml2-dev + - tolua++ + - gawk + env: + - MATRIX_EVAL="CC=gcc-7 && CXX=g++-7" - os: linux dist: xenial addons: @@ -41,6 +161,46 @@ matrix: - gawk env: - MATRIX_EVAL="CC=gcc-8 && CXX=g++-8" + - os: linux + dist: xenial + addons: + apt: + sources: + - llvm-toolchain-xenial-6.0 + packages: + - clang-6.0 + - cmake + - libxdamage-dev + - libx11-dev + - libxft-dev + - libxext-dev + - libglib2.0-dev + - libxml2-dev + - libcurl4-gnutls-dev + - liblua5.1-0-dev + - libtolua++5.1-dev + - libcairo2-dev + - libimlib2-dev + - libxinerama-dev + - libmysqlclient-dev + - libical-dev + - libircclient-dev + - libcairo2-dev + - libmicrohttpd-dev + - ncurses-dev + - liblua5.1-dev + - librsvg2-dev + - libaudclient-dev + - libxmmsclient-dev + - libpulse-dev + - libcurl4-gnutls-dev + - audacious-dev + - libsystemd-dev + - libxml2-dev + - tolua++ + - gawk + env: + - MATRIX_EVAL="CC=clang-6.0 && CXX=clang++-6.0" - os: linux dist: xenial addons: @@ -86,6 +246,10 @@ matrix: secure: "KikPusy+HXcEVLr0Dqb6mkrefDU5jm7EGQ5fwO4sBG7bRMcnHV3V14s5yB4Ol8btpUC0nkNn/41+f37lkG+oT4y9ZeIH2ZrhsSEHxOgH6DF9ZSVJwtpLrF9siWgfZ0m5c5V7U5rzVYL3jlO1hQfXKCfMNAcwlKcEUrfpk7jVEZc=" env: - MATRIX_EVAL="CC=clang-7 && CXX=clang++-7" + - os: osx + osx_image: xcode9.4 + - os: osx + osx_image: xcode10 - os: osx osx_image: xcode10.1 before_install: @@ -171,6 +335,6 @@ branches: - master sudo: false cache: - - ccache + - ccache: true - directories: - '$HOME/.sonar/cache' diff --git a/src/linux.cc b/src/linux.cc index da7085a9..26c8bb68 100644 --- a/src/linux.cc +++ b/src/linux.cc @@ -302,7 +302,7 @@ char *save_set_string(char *x, char *y) { void update_gateway_info_failure(const char *reason) { if (reason != nullptr) { perror(reason); } // 2 pointers to 1 location causes a crash when we try to free them both - std::unique_lock lock(gw_info.mutex); + std::unique_lock lock(gw_info.mutex); free_and_zero(gw_info.iface); free_and_zero(gw_info.ip); gw_info.iface = strndup("failed", text_buffer_size.get(*state)); @@ -388,7 +388,7 @@ int update_gateway_info(void) { if (!(dest || mask) && ((flags & RTF_GATEWAY) || !gate)) { gw_info.count++; snprintf(e_iface, 49, "%s", iface); - std::unique_lock lock(gw_info.mutex); + std::unique_lock lock(gw_info.mutex); gw_info.iface = save_set_string(gw_info.iface, iface); ina.s_addr = gate; gw_info.ip = save_set_string(gw_info.ip, inet_ntoa(ina));