ci: enable warnings as errors

This commit is contained in:
Sergiu Deitsch 2021-12-10 01:25:04 +01:00 committed by Sergiu Deitsch
parent 660352f02b
commit baa7006e63
5 changed files with 47 additions and 48 deletions

View File

@ -17,28 +17,35 @@ jobs:
build_type: [Debug, Release]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.0
- name: Setup Ninja
uses: ashutoshvarma/setup-ninja@master
with:
version: 1.10.0
- name: Configure
run: |
cmake -S . -B build_${{matrix.abi}} \
-DANDROID_ABI=${{matrix.abi}} \
-DANDROID_NATIVE_API_LEVEL=28 \
-DANDROID_STL=c++_shared \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_EXTENSIONS=OFF \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-G Ninja \
-Werror
- name: Setup C++98 Environment
if: matrix.std == '98'
run: |
echo 'CXXFLAGS=-Wno-error=variadic-macros -Wno-error=long-long ${{env.CXXFLAGS}}' >> $GITHUB_ENV
- name: Build
run: |
cmake --build build_${{matrix.abi}} \
--config ${{matrix.build_type}}
- name: Configure
env:
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}
run: |
cmake -S . -B build_${{matrix.abi}} \
-DANDROID_ABI=${{matrix.abi}} \
-DANDROID_NATIVE_API_LEVEL=28 \
-DANDROID_STL=c++_shared \
-DCMAKE_BUILD_TYPE=${{matrix.build_type}} \
-DCMAKE_CXX_EXTENSIONS=OFF \
-DCMAKE_CXX_STANDARD=${{matrix.std}} \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-G Ninja \
-Werror
- name: Build
run: |
cmake --build build_${{matrix.abi}} \
--config ${{matrix.build_type}}

View File

@ -60,7 +60,14 @@ jobs:
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
echo 'GTest_ROOT=${{github.workspace}}/gtest' >> $GITHUB_ENV
- name: Setup C++98 Environment
if: matrix.std == '98'
run: |
echo 'CXXFLAGS=-Wno-error=variadic-macros -Wno-error=long-long ${{env.CXXFLAGS}}' >> $GITHUB_ENV
- name: Configure
env:
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}
run: |
cmake -S . -B build_${{matrix.build_type}} \
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \

View File

@ -31,11 +31,6 @@ jobs:
run: |
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
- name: Setup C++98 Environment
if: matrix.std == '98'
run: |
echo 'CXXFLAGS=-Wall -Wextra -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}' >> $GITHUB_ENV
- name: Configure
shell: bash
env:

View File

@ -100,9 +100,14 @@ jobs:
mingw-w64-${{matrix.env}}-gflags
mingw-w64-${{matrix.env}}-ninja
- name: Setup C++98 Environment
if: matrix.std == '98'
run: |
echo 'CXXFLAGS=-Wno-error=variadic-macros -Wno-error=long-long ${{env.CXXFLAGS}}' >> $GITHUB_ENV
- name: Configure
env:
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Werror -Wno-error=variadic-macros -Wno-error=long-long
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}
run: |
if [[ ${{matrix.build_type}} == "Debug" ]]; then
export CXXFLAGS="--coverage ${CXXFLAGS}"

View File

@ -666,12 +666,12 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
// POSIX doesn't define any async-signal safe function for converting
// an integer to ASCII. We'll have to define our own version.
// itoa_r() converts a (signed) integer to ASCII. It returns "buf", if the
// itoa_r() converts an (unsigned) integer to ASCII. It returns "buf", if the
// conversion was successful or NULL otherwise. It never writes more than "sz"
// bytes. Output will be truncated as needed, and a NUL character is always
// appended.
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
static char *itoa_r(intptr_t i, char *buf, size_t sz, unsigned base, size_t padding) {
static char *itoa_r(uintptr_t i, char *buf, size_t sz, unsigned base, size_t padding) {
// Make sure we can write at least one NUL byte.
size_t n = 1;
if (n > sz)
@ -684,21 +684,6 @@ static char *itoa_r(intptr_t i, char *buf, size_t sz, unsigned base, size_t padd
char *start = buf;
uintptr_t j = static_cast<uintptr_t>(i);
// Handle negative numbers (only for base 10).
if (i < 0 && base == 10) {
// This does "j = -i" while avoiding integer overflow.
j = static_cast<uintptr_t>(-(i + 1)) + 1;
// Make sure we can write the '-' character.
if (++n > sz) {
buf[0] = '\000';
return NULL;
}
*start++ = '-';
}
// Loop until we have converted the entire number. Output at least one
// character (i.e. '0').
char *ptr = start;
@ -710,12 +695,12 @@ static char *itoa_r(intptr_t i, char *buf, size_t sz, unsigned base, size_t padd
}
// Output the next digit.
*ptr++ = "0123456789abcdef"[j % base];
j /= base;
*ptr++ = "0123456789abcdef"[i % base];
i /= base;
if (padding > 0)
padding--;
} while (j > 0 || padding > 0);
} while (i > 0 || padding > 0);
// Terminate the output with a NUL character.
*ptr = '\000';