Skip to content

Commit

Permalink
Fixes mpaland#76: Now preventing clang and gcc from replacing our ali…
Browse files Browse the repository at this point in the history
…ased functions with strength-reduced actual standard library functions.
  • Loading branch information
eyalroz committed Feb 21, 2022
1 parent 957cedd commit 5b1a3de
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ if (CMAKE_C_COMPILER_ID STREQUAL "MSVC")
elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_C_COMPILER_ID STREQUAL "Clang")
target_compile_options(printf PRIVATE -Wall -Wextra -pedantic -Wconversion)
if (ALIAS_STANDARD_FUNCTION_NAMES)
# This is important for preventing our aliased implementation
# from being replaced, e.g. printf("%c", 'a') by putchar('a');
# clang and GCC apparently do this as an optimization
target_compile_options(printf PUBLIC -fno-builtin-printf)
endif()
endif()

if (BUILD_TESTS)
Expand Down

0 comments on commit 5b1a3de

Please sign in to comment.