Skip to content

Commit

Permalink
Merge branch 'master' into absolute-path-header
Browse files Browse the repository at this point in the history
  • Loading branch information
Tal500 committed Nov 14, 2024
2 parents 907c443 + 0ab783c commit 4e02592
Show file tree
Hide file tree
Showing 8 changed files with 299 additions and 115 deletions.
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Checks: >
-objc-*,
-openmp-*,
-zircon-*,
-boost-use-ranges,
-bugprone-branch-clone,
-bugprone-easily-swappable-parameters,
-bugprone-narrowing-conversions,
Expand Down
30 changes: 17 additions & 13 deletions .github/workflows/CI-unixish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
compiler: [clang++, g++]
os: [ubuntu-20.04, ubuntu-22.04, macos-12, macos-13, macos-14]
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04, macos-13, macos-14]
fail-fast: false

runs-on: ${{ matrix.os }}
Expand All @@ -20,10 +20,16 @@ jobs:
- uses: actions/checkout@v4

- name: Install missing software on ubuntu
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install valgrind
- name: Install missing software on ubuntu (clang++)
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
sudo apt-get update
sudo apt-get install libc++-18-dev
- name: make simplecpp
run: make -j$(nproc)
Expand All @@ -49,44 +55,42 @@ jobs:
./cmake.output/testrunner
- name: Run valgrind
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
# this valgrind version doesn't support DWARF 5 yet
make -j$(nproc) CXXFLAGS="-gdwarf-4"
make -j$(nproc)
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./testrunner
valgrind --leak-check=full --num-callers=50 --show-reachable=yes --track-origins=yes --gen-suppressions=all --error-exitcode=42 ./simplecpp simplecpp.cpp -e
- name: Run with libstdc++ debug mode
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'g++'
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'g++'
run: |
make clean
make -j$(nproc) test selfcheck CXXFLAGS="-g3 -D_GLIBCXX_DEBUG"
# TODO: change it to -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG when the compiler is at least Clang 18
- name: Run with libc++ debug mode
if: matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
- name: Run with libc++ hardening mode
if: matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_ENABLE_ASSERTIONS=1" LDFLAGS="-lc++"
make -j$(nproc) test selfcheck CXXFLAGS="-stdlib=libc++ -g3 -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG" LDFLAGS="-lc++"
- name: Run AddressSanitizer
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=address" LDFLAGS="-fsanitize=address"
env:
ASAN_OPTIONS: detect_stack_use_after_return=1

- name: Run UndefinedBehaviorSanitizer
if: matrix.os == 'ubuntu-22.04'
if: matrix.os == 'ubuntu-24.04'
run: |
make clean
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -fsanitize=undefined -fno-sanitize=signed-integer-overflow" LDFLAGS="-fsanitize=undefined -fno-sanitize=signed-integer-overflow"
# TODO: requires instrumented libc++
- name: Run MemorySanitizer
if: false && matrix.os == 'ubuntu-22.04' && matrix.compiler == 'clang++'
if: false && matrix.os == 'ubuntu-24.04' && matrix.compiler == 'clang++'
run: |
make clean
make -j$(nproc) test selfcheck CXXFLAGS="-O2 -g3 -stdlib=libc++ -fsanitize=memory" LDFLAGS="-lc++ -fsanitize=memory"
12 changes: 6 additions & 6 deletions .github/workflows/clang-tidy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on: [push, pull_request]
jobs:
build:

runs-on: ubuntu-22.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand All @@ -21,19 +21,19 @@ jobs:
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 18
sudo apt-get install clang-tidy-18
sudo ./llvm.sh 19
sudo apt-get install clang-tidy-19
- name: Verify clang-tidy configuration
run: |
clang-tidy-18 --verify-config
clang-tidy-19 --verify-config
- name: Prepare CMake
run: |
cmake -S . -B cmake.output -G "Unix Makefiles" -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DDISABLE_CPP03_SYNTAX_CHECK=ON
env:
CXX: clang-18
CXX: clang-19

- name: Clang-Tidy
run: |
run-clang-tidy-18 -q -j $(nproc) -p=cmake.output
run-clang-tidy-19 -q -j $(nproc) -p=cmake.output
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ option(DISABLE_CPP03_SYNTAX_CHECK "Disable the C++03 syntax check." OFF)

include(CheckCXXCompilerFlag)

if (WIN32)
# prevent simplifyPath_cppcheck() from wasting time on looking for a hypothetical network host
add_definitions(-DUNCHOST=$ENV{COMPUTERNAME})
endif()

function(add_compile_options_safe FLAG)
string(MAKE_C_IDENTIFIER "HAS_CXX_FLAG${FLAG}" mangled_flag)
check_cxx_compiler_flag(${FLAG} ${mangled_flag})
Expand Down
1 change: 0 additions & 1 deletion run-tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ def cleanup(out):
'c99-6_10_3_4_p6.c',
'expr_usual_conversions.c', # condition is true: 4U - 30 >= 0
'stdint.c',
'stringize_misc.c',

# GCC..
'diagnostic-pragma-1.c',
Expand Down
Loading

0 comments on commit 4e02592

Please sign in to comment.