cmake: fix build by reordering the cflags definitions
authorPetr Štetiar <ynezz@true.cz>
Wed, 29 Mar 2023 07:29:54 +0000 (09:29 +0200)
committerPetr Štetiar <ynezz@true.cz>
Wed, 31 May 2023 16:42:59 +0000 (18:42 +0200)
I've noticed bunch of build errors being emitted by clang-15/gcc-10:

 netifd.h:83:33: error: unused parameter 'level' [-Werror,-Wunused-parameter]

and it seems, that the order of definitions matters as -Wextra probably
enables previously disabled warnings like -Wno-unused-parameter.

So lets fix it, by reordering the cflags definitions.

Fixes: 463a1207f076 ("netifd: Activate -Wextra compile warnings")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
CMakeLists.txt

index b87c300fcc221a20cc047d56e8a4911ce4622508..5ad86954707bb7f3d8f65d1682664f232158c65f 100644 (file)
@@ -7,11 +7,12 @@ IF(NOT ${CMAKE_VERSION} LESS 3.0)
   check_c_compiler_flag(-Wimplicit-fallthrough HAS_IMPLICIT_FALLTHROUGH)
 ENDIF()
 
   check_c_compiler_flag(-Wimplicit-fallthrough HAS_IMPLICIT_FALLTHROUGH)
 ENDIF()
 
-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter)
+ADD_DEFINITIONS(-Wall -Werror)
 IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
        add_definitions(-Wextra -Werror=implicit-function-declaration)
        add_definitions(-Wformat -Werror=format-security -Werror=format-nonliteral)
 ENDIF()
 IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6)
        add_definitions(-Wextra -Werror=implicit-function-declaration)
        add_definitions(-Wformat -Werror=format-security -Werror=format-nonliteral)
 ENDIF()
+ADD_DEFINITIONS(-Os --std=gnu99 -Wmissing-declarations -Wno-unused-parameter -Wno-unused-but-set-parameter)
 
 IF(HAS_IMPLICIT_FALLTHROUGH)
   ADD_DEFINITIONS(-Wimplicit-fallthrough)
 
 IF(HAS_IMPLICIT_FALLTHROUGH)
   ADD_DEFINITIONS(-Wimplicit-fallthrough)