Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ jobs:
python3 -m pip install pytest

- name: make simplecpp
run: make -j$(nproc)
run: make -j$(nproc) CXXOPTS="-Werror"

- name: make test
run: make -j$(nproc) test
run: make -j$(nproc) test CXXOPTS="-Werror"

- name: selfcheck
run: |
Expand All @@ -57,7 +57,7 @@ jobs:

- name: Run CMake
run: |
cmake -S . -B cmake.output
cmake -S . -B cmake.output -DCMAKE_COMPILE_WARNING_AS_ERROR=On

- name: CMake simplecpp
run: |
Expand All @@ -80,27 +80,27 @@ jobs:
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-g3 -D_GLIBCXX_DEBUG"
make -j$(nproc) test selfcheck CXXOPTS="-Werror -g3 -D_GLIBCXX_DEBUG"

- name: Run with libc++ hardening mode
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDOPTS="-lc++"
make -j$(nproc) test selfcheck CXXOPTS="-Werror -stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDOPTS="-lc++"

- name: Run AddressSanitizer
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-O2 -g3 -fsanitize=address" LDOPTS="-fsanitize=address"
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=address" LDOPTS="-fsanitize=address"
env:
ASAN_OPTIONS: detect_stack_use_after_return=1

- name: Run UndefinedBehaviorSanitizer
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDOPTS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDOPTS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
env:
UBSAN_OPTIONS: print_stacktrace=1:halt_on_error=1:report_error_type=1

Expand All @@ -109,4 +109,4 @@ jobs:
if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXOPTS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDOPTS="-lc++ -fsanitize=memory"
make -j$(nproc) test selfcheck CXXOPTS="-Werror -O2 -g3 -stdlib=libc++ -fsanitize=memory" LDOPTS="-lc++ -fsanitize=memory"
2 changes: 1 addition & 1 deletion .github/workflows/CI-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Run CMake
run: |
cmake -G "Visual Studio 17 2022" -A x64 . || exit /b !errorlevel!
cmake -G "Visual Studio 17 2022" -A x64 -DCMAKE_COMPILE_WARNING_AS_ERROR=On . || exit /b !errorlevel!

- name: Build
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Prepare CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_COMPILE_WARNING_AS_ERROR=On -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
env:
CXX: clang-20

Expand Down
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options_safe(-Wuseless-cast)
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
# TODO: bump warning level
#add_compile_options(/W4) # Warning Level
# TODO: enable warning
add_compile_options(/wd4267) # warning C4267: '...': conversion from 'size_t' to 'unsigned int', possible loss of data
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Weverything)
# no need for c++98 compatibility
Expand Down
3 changes: 2 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ environment:

build_script:
- ECHO Building %configuration% %platform% with MSVC %VisualStudioVersion% using %PlatformToolset% PlatformToolset
- cmake -G "Visual Studio 14" .
- cmake -DCMAKE_COMPILE_WARNING_AS_ERROR=On -G "Visual Studio 14" .
- dir
- 'CALL "C:\Program Files (x86)\Microsoft Visual Studio %VisualStudioVersion%\VC\vcvarsall.bat" %vcvarsall_platform%'
- set _CL_=/WX
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be specified explicitly because the CMake version in Appveyor is not yet supported the canonical CMake option:

CMake Warning:
  Manually-specified variables were not used by the project:
    CMAKE_COMPILE_WARNING_AS_ERROR

I left the CMake option intact for consistency with other invocations.

- msbuild "simplecpp.sln" /consoleloggerparameters:Verbosity=minimal /target:Build /property:Configuration="%configuration%";Platform=%platform% /p:PlatformToolset=%PlatformToolset% /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"

test_script:
Expand Down
Loading