Remove empty initializers to ensure MSVC compatibility.

Add -Wgnu-empty-initializer to Clang builds to catch this issue in the future. Initialising arrays with empty braces is not part of the C standard and fails on MSVC. This commit should catch the issue earlier by detecting it in Clang.

PiperOrigin-RevId: 517373961
Change-Id: I518006e84151e8d5b45a7fe00ba7675dfb031ca0
This commit is contained in:
Alessio Quaglino
2023-03-17 04:01:26 -07:00
committed by Copybara-Service
parent 70959c1a2c
commit ee566eb880
5 changed files with 7 additions and 4 deletions
+1
View File
@@ -93,6 +93,7 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang
-Wno-int-in-bool-context
-Wno-sign-compare
-Wno-unknown-pragmas
-Wgnu-empty-initializer
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# Set -Wimplicit-fallthrough=5 to only allow fallthrough annotation via __attribute__.