Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: undef _FORTIFY_SOURCE before setting #270

Merged
merged 3 commits into from
Aug 12, 2024
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
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
Loading