From edf934b179dcd521b519fe8c973c615f48159c61 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Lo=C3=AFc=20Collignon?= Date: Fri, 28 Jun 2019 09:50:46 +0200 Subject: [PATCH] Fix warning when compiling with clang MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The 'maybe-uninitialized' warning option is a GCC's only flag. The equivalent one for Clang is 'possible-uninitialized'. Added the right flag based on the compiler. Bug-AGL: SPEC-2584 Change-Id: I09ce434dfda21996cefbf0b527b43d666a042e0e Signed-off-by: Loïc Collignon --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3962da28..54f03b3f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,11 @@ link_libraries(-Wl,--as-needed -Wl,--gc-sections -Wl,--no-undefined) add_compile_options(-Wall -Wextra -Wconversion) add_compile_options(-Wno-unused-parameter) # frankly not using a parameter does it care? add_compile_options(-Wno-sign-compare -Wno-sign-conversion) -add_compile_options(-Werror=maybe-uninitialized) +if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + add_compile_options(-Werror=maybe-uninitialized) +elseif(${CMAKE_C_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + add_compile_options(-Werror=sometimes-uninitialized) +endif() add_compile_options(-Werror=implicit-function-declaration) add_compile_options(-ffunction-sections -fdata-sections) add_compile_options(-fPIC) -- 2.16.6