From 560d38d0698cb80fac208627a1ae38e4d30a7651 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Wed, 13 Oct 2021 18:11:33 -0300 Subject: [PATCH 1/3] Allow disabling -Werror via a cmake option --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index affe3f5..ae117c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,7 +113,13 @@ target_include_directories(oxenmq $ ) -target_compile_options(oxenmq PRIVATE -Wall -Wextra -Werror) +target_compile_options(oxenmq PRIVATE -Wall -Wextra) + +option(WARNINGS_AS_ERRORS "treat all warnings as errors" ON) +if(WARNINGS_AS_ERRORS) + target_compile_options(oxenmq PRIVATE -Werror) +endif() + set_target_properties(oxenmq PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON From 6a386b7d4a14f8eb2fda923351750e84648b15a3 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Wed, 13 Oct 2021 19:00:19 -0300 Subject: [PATCH 2/3] Crank clang to 13 Also reformat and move things around a bit. --- .drone.jsonnet | 70 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 23 deletions(-) diff --git a/.drone.jsonnet b/.drone.jsonnet index 4b67711..7620850 100644 --- a/.drone.jsonnet +++ b/.drone.jsonnet @@ -1,4 +1,3 @@ - local apt_get_quiet = 'apt-get -o=Dpkg::Use-Pty=0 -q '; local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3-dev', cmake_extra='', build_type='Release', extra_cmds=[], allow_fail=false) = { @@ -6,12 +5,12 @@ local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3 type: 'docker', name: name, platform: { arch: arch }, - environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) + environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) steps: [ { name: 'build', image: image, - [if allow_fail then "failure"]: "ignore", + [if allow_fail then 'failure']: 'ignore', commands: [ 'echo "Building on ${DRONE_STAGE_MACHINE}"', 'echo "man-db man-db/auto-update boolean false" | debconf-set-selections', @@ -22,35 +21,60 @@ local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3 'git submodule update --init --recursive', 'mkdir build', 'cd build', - 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE='+build_type+' -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ' + cmake_extra, + 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fdiagnostics-color=always -DCMAKE_BUILD_TYPE=' + build_type + ' -DCMAKE_CXX_COMPILER_LAUNCHER=ccache ' + cmake_extra, 'ninja -v', - './tests/tests --use-colour yes' + './tests/tests --use-colour yes', ] + extra_cmds, - } - ] + }, + ], }; +local clang(version) = debian_pipeline( + 'Debian sid/clang-' + version + ' (amd64)', + 'debian:sid', + deps='clang-13 libsodium-dev libzmq3-dev', + cmake_extra='-DCMAKE_C_COMPILER=clang-13 -DCMAKE_CXX_COMPILER=clang++-13 ' +); + +local full_llvm(version) = debian_pipeline( + 'Debian sid/llvm-' + version + ' (amd64)', + 'debian:sid', + deps='clang-13 lld-13 libc++-13-dev libc++abi-13-dev libsodium-dev libzmq3-dev', + cmake_extra='-DCMAKE_C_COMPILER=clang-' + version + + ' -DCMAKE_CXX_COMPILER=clang++-' + version + + ' -DCMAKE_CXX_FLAGS=-stdlib=libc++ ' + + std.join(' ', [ + '-DCMAKE_' + type + '_LINKER_FLAGS=-fuse-ld=lld-' + version + for type in ['EXE', 'MODULE', 'SHARED', 'STATIC'] + ]) +); + + [ - debian_pipeline("Ubuntu focal (amd64)", "ubuntu:focal"), - debian_pipeline("Ubuntu bionic (amd64)", "ubuntu:bionic", deps='libsodium-dev g++-8', + debian_pipeline('Ubuntu focal (amd64)', 'ubuntu:focal'), + debian_pipeline('Ubuntu bionic (amd64)', + 'ubuntu:bionic', + deps='libsodium-dev g++-8', cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'), - debian_pipeline("Debian sid (amd64)", "debian:sid"), - debian_pipeline("Debian sid/Debug (amd64)", "debian:sid", build_type='Debug'), - debian_pipeline("Debian sid/clang-11 (amd64)", "debian:sid", deps='clang-11 lld-11 libsodium-dev libzmq3-dev', - cmake_extra='-DCMAKE_C_COMPILER=clang-11 -DCMAKE_CXX_COMPILER=clang++-11 ' + std.join(' ', [ - '-DCMAKE_'+type+'_LINKER_FLAGS=-fuse-ld=lld-11' for type in ['EXE','MODULE','SHARED','STATIC']])), - debian_pipeline("Debian buster (amd64)", "debian:buster"), - debian_pipeline("Debian buster (i386)", "i386/debian:buster"), - debian_pipeline("Ubuntu bionic (ARM64)", "ubuntu:bionic", arch="arm64", deps='libsodium-dev g++-8', + debian_pipeline('Debian sid (amd64)', 'debian:sid'), + debian_pipeline('Debian sid/Debug (amd64)', 'debian:sid', build_type='Debug'), + clang(13), + full_llvm(13), + debian_pipeline('Debian buster (amd64)', 'debian:buster'), + debian_pipeline('Debian buster (i386)', 'i386/debian:buster'), + debian_pipeline('Ubuntu bionic (ARM64)', + 'ubuntu:bionic', + arch='arm64', + deps='libsodium-dev g++-8', cmake_extra='-DCMAKE_C_COMPILER=gcc-8 -DCMAKE_CXX_COMPILER=g++-8'), - debian_pipeline("Debian sid (ARM64)", "debian:sid", arch="arm64"), - debian_pipeline("Debian buster (armhf)", "arm32v7/debian:buster", arch="arm64"), + debian_pipeline('Debian sid (ARM64)', 'debian:sid', arch='arm64'), + debian_pipeline('Debian buster (armhf)', 'arm32v7/debian:buster', arch='arm64'), { kind: 'pipeline', type: 'exec', name: 'macOS (Catalina w/macports)', platform: { os: 'darwin', arch: 'amd64' }, - environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) + environment: { CLICOLOR_FORCE: '1' }, // Lets color through ninja (1.9+) steps: [ { name: 'build', @@ -60,9 +84,9 @@ local debian_pipeline(name, image, arch='amd64', deps='g++ libsodium-dev libzmq3 'cd build', 'cmake .. -G Ninja -DCMAKE_CXX_FLAGS=-fcolor-diagnostics -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache', 'ninja -v', - './tests/tests --use-colour yes' + './tests/tests --use-colour yes', ], - } - ] + }, + ], }, ] From 23c2d537a3e02f59f8feacc871d1b61ca95d688c Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Thu, 14 Oct 2021 11:03:55 -0300 Subject: [PATCH 3/3] Maybe fix macos tests? --- tests/common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/common.h b/tests/common.h index 6cfe623..f41b9d2 100644 --- a/tests/common.h +++ b/tests/common.h @@ -18,9 +18,9 @@ constexpr int TIME_DILATION = static auto startup = std::chrono::steady_clock::now(); /// Returns a localhost connection string to listen on. It can be considered random, though in -/// practice in the current implementation is sequential starting at 4500. +/// practice in the current implementation is sequential starting at 25432. inline std::string random_localhost() { - static uint16_t last = 4499; + static std::atomic last = 25432; last++; assert(last); // We should never call this enough to overflow return "tcp://127.0.0.1:" + std::to_string(last);