Skip to content

Commit

Permalink
CMake: Compile with -ftrivial-auto-var-init=zero
Browse files Browse the repository at this point in the history
As per upstream guidance [0] we should compile the sources with this
flag in order to not hit issues with using uninitialized variables.

[0] https://android-review.googlesource.com/c/platform/system/core/+/2963911/1#message-01ebff378bb51f7815b6ed8b035a57fbce0418ab

Fixes nmeum#133
  • Loading branch information
lweiss-fairphone authored and anatol committed Mar 20, 2024
1 parent 3f3b2d8 commit 59ff36d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vendor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ if(APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_DARWIN_C_SOURCE -D__DARWIN_C_LEVEL=__DARWIN_C_FULL")
endif()

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftrivial-auto-var-init=zero")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrivial-auto-var-init=zero")

# Android seems to use various attributes supported by clang but not by
# GCC which causes it to emit lots of warnings. Since these attributes
# don't seem to effect runtime behaviour simply disable the warnings.
Expand Down

0 comments on commit 59ff36d

Please sign in to comment.