ci: enable warnings as errors
This commit is contained in:
parent
660352f02b
commit
baa7006e63
51
.github/workflows/android.yml
vendored
51
.github/workflows/android.yml
vendored
@ -17,28 +17,35 @@ jobs:
|
|||||||
build_type: [Debug, Release]
|
build_type: [Debug, Release]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Ninja
|
- name: Setup Ninja
|
||||||
uses: ashutoshvarma/setup-ninja@master
|
uses: ashutoshvarma/setup-ninja@master
|
||||||
with:
|
with:
|
||||||
version: 1.10.0
|
version: 1.10.0
|
||||||
|
|
||||||
- name: Configure
|
- name: Setup C++98 Environment
|
||||||
run: |
|
if: matrix.std == '98'
|
||||||
cmake -S . -B build_${{matrix.abi}} \
|
run: |
|
||||||
-DANDROID_ABI=${{matrix.abi}} \
|
echo 'CXXFLAGS=-Wno-error=variadic-macros -Wno-error=long-long ${{env.CXXFLAGS}}' >> $GITHUB_ENV
|
||||||
-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
|
- name: Configure
|
||||||
run: |
|
env:
|
||||||
cmake --build build_${{matrix.abi}} \
|
CXXFLAGS: -Wall -Wextra -Wpedantic -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}
|
||||||
--config ${{matrix.build_type}}
|
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}}
|
||||||
|
|||||||
7
.github/workflows/linux.yml
vendored
7
.github/workflows/linux.yml
vendored
@ -60,7 +60,14 @@ jobs:
|
|||||||
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
|
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
|
||||||
echo 'GTest_ROOT=${{github.workspace}}/gtest' >> $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
|
- name: Configure
|
||||||
|
env:
|
||||||
|
CXXFLAGS: -Wall -Wextra -Wsign-conversion -Wtautological-compare -Werror ${{env.CXXFLAGS}}
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B build_${{matrix.build_type}} \
|
cmake -S . -B build_${{matrix.build_type}} \
|
||||||
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
|
-DBUILD_SHARED_LIBS=${{matrix.lib == 'shared'}} \
|
||||||
|
|||||||
5
.github/workflows/macos.yml
vendored
5
.github/workflows/macos.yml
vendored
@ -31,11 +31,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
echo 'CXXFLAGS=--coverage' >> $GITHUB_ENV
|
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
|
- name: Configure
|
||||||
shell: bash
|
shell: bash
|
||||||
env:
|
env:
|
||||||
|
|||||||
7
.github/workflows/windows.yml
vendored
7
.github/workflows/windows.yml
vendored
@ -100,9 +100,14 @@ jobs:
|
|||||||
mingw-w64-${{matrix.env}}-gflags
|
mingw-w64-${{matrix.env}}-gflags
|
||||||
mingw-w64-${{matrix.env}}-ninja
|
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
|
- name: Configure
|
||||||
env:
|
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: |
|
run: |
|
||||||
if [[ ${{matrix.build_type}} == "Debug" ]]; then
|
if [[ ${{matrix.build_type}} == "Debug" ]]; then
|
||||||
export CXXFLAGS="--coverage ${CXXFLAGS}"
|
export CXXFLAGS="--coverage ${CXXFLAGS}"
|
||||||
|
|||||||
@ -666,12 +666,12 @@ OpenObjectFileContainingPcAndGetStartAddress(uint64_t pc,
|
|||||||
|
|
||||||
// POSIX doesn't define any async-signal safe function for converting
|
// POSIX doesn't define any async-signal safe function for converting
|
||||||
// an integer to ASCII. We'll have to define our own version.
|
// 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"
|
// 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
|
// bytes. Output will be truncated as needed, and a NUL character is always
|
||||||
// appended.
|
// appended.
|
||||||
// NOTE: code from sandbox/linux/seccomp-bpf/demo.cc.
|
// 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.
|
// Make sure we can write at least one NUL byte.
|
||||||
size_t n = 1;
|
size_t n = 1;
|
||||||
if (n > sz)
|
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;
|
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
|
// Loop until we have converted the entire number. Output at least one
|
||||||
// character (i.e. '0').
|
// character (i.e. '0').
|
||||||
char *ptr = start;
|
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.
|
// Output the next digit.
|
||||||
*ptr++ = "0123456789abcdef"[j % base];
|
*ptr++ = "0123456789abcdef"[i % base];
|
||||||
j /= base;
|
i /= base;
|
||||||
|
|
||||||
if (padding > 0)
|
if (padding > 0)
|
||||||
padding--;
|
padding--;
|
||||||
} while (j > 0 || padding > 0);
|
} while (i > 0 || padding > 0);
|
||||||
|
|
||||||
// Terminate the output with a NUL character.
|
// Terminate the output with a NUL character.
|
||||||
*ptr = '\000';
|
*ptr = '\000';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user