Skip to content

Commit

Permalink
Merge pull request #270 from FeignClaims/fix/undef_fortify_source
Browse files Browse the repository at this point in the history
fix: undef _FORTIFY_SOURCE before setting
  • Loading branch information
aminya authored Aug 12, 2024
2 parents 3e5ba3a + 8a526b6 commit d856abd
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
8 changes: 0 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,6 @@ jobs:
- os: "windows-2022"
compiler: "msvc"
vcvarsall: false
- os: "macos-11"
compiler: "gcc"
cmake: true
vcvarsall: true
- os: "macos-13"
compiler: "gcc"
cmake: true
vcvarsall: true
exclude:
# fails with an internal error
- os: "macos-12"
Expand Down
2 changes: 1 addition & 1 deletion src/Hardening.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function(
list(APPEND HARDENING_COMPILE_OPTIONS -Wstringop-overflow=4 -Wformat-overflow=2)
endif()

target_compile_definitions(${_project_name} INTERFACE $<$<CONFIG:Release,RelWithDebInfo>:_FORTIFY_SOURCE=3>)
target_compile_options(${_project_name} INTERFACE $<$<CONFIG:Release,RelWithDebInfo>:-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3>)
endif()

if(${ENABLE_ELF_PROTECTION})
Expand Down
4 changes: 4 additions & 0 deletions tests/myproj/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ project_options(
# CLANG_WARNINGS "-Weverything"
LINKER
"${LINKER}"

# Test if _FORTIFY_SOURCE is defined only once when ENABLE_OVERFLOW_PROTECTION
ENABLE_OVERFLOW_PROTECTION
CLANG_TIDY_EXTRA_ARGUMENTS "-warnings-as-errors=clang-diagnostic-macro-redefined"
)
# NOTE: project_options and project_warnings are defined inside project_options

Expand Down

0 comments on commit d856abd

Please sign in to comment.