Skip to content
Snippets Groups Projects
Commit 6c3c18b7 authored by Lorenz Meier's avatar Lorenz Meier
Browse files

Robustify toolchain string matching

parent e0d346e4
No related branches found
No related tags found
No related merge requests found
......@@ -512,7 +512,7 @@ function(px4_add_common_flags)
list(APPEND warnings -Wframe-larger-than=1024)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
# QuRT 6.4.X compiler identifies as Clang but does not support this option
if (NOT ${OS} STREQUAL "qurt")
list(APPEND warnings
......@@ -540,7 +540,7 @@ function(px4_add_common_flags)
-fdata-sections
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
list(APPEND optimization_flags
-fno-strength-reduce
-fno-builtin-printf
......@@ -554,7 +554,7 @@ function(px4_add_common_flags)
-Wnested-externs
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
if (NOT ${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
list(APPEND c_warnings
-Wold-style-declaration
-Wmissing-parameter-type
......@@ -633,16 +633,10 @@ function(px4_add_common_flags)
-DCONFIG_ARCH_BOARD_${board_config}
)
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(added_exe_link_flags
-Wl,--warn-common
-Wl,--gc-sections
)
else()
set(added_exe_link_flags
-Wl,--warn-common
)
endif()
# output
foreach(var ${inout_vars})
......
set(WARNINGS
-Wall
-Werror
-Wextra
-Wdouble-promotion
-Wshadow
-Wfloat-equal
-Wframe-larger-than=1024
-Wpointer-arith
-Wlogical-op
-Wmissing-declarations
-Wno-unused-parameter
-Werror=format-security
-Werror=array-bounds
-Wfatal-errors
-Wformat=1
-Werror=unused-but-set-variable
-Werror=unused-variable
-Werror=double-promotion
-Werror=reorder
-Werror=uninitialized
-Werror=init-self
-Werror=return-type
-Werror=deprecated
-Werror=unused-private-field
-Wno-packed
-Wno-frame-larger-than=
-Wno-varargs
#-Wcast-qual - generates spurious noreturn attribute warnings,
# try again later
#-Wconversion - would be nice, but too many "risky-but-safe"
# conversions in the code
#-Wcast-align - would help catch bad casts in some cases,
# but generates too many false positives
)
set(OPT_FLAGS
-Os -g3
)
#=============================================================================
# c flags
#
set(C_WARNINGS
-Wbad-function-cast
-Wstrict-prototypes
-Wold-style-declaration
-Wmissing-parameter-type
-Wmissing-prototypes
-Wnested-externs
)
set(C_FLAGS
-std=gnu99
-fno-common
-fsanitize=address
-fno-omit-frame-pointer
)
#=============================================================================
# cxx flags
#
set(CXX_WARNINGS
-Wno-missing-field-initializers
-Wno-varargs
)
set(CXX_FLAGS
-fno-exceptions
-fno-rtti
-std=gnu++0x
-fno-threadsafe-statics
-fsanitize=address
-fno-omit-frame-pointer
-DCONFIG_WCHAR_BUILTIN
-D__CUSTOM_FILE_IO__
)
#=============================================================================
# ld flags
#
set(LD_FLAGS
-fsanitize=address
-Wl,--warn-common
-Wl,--gc-sections
)
#=============================================================================
# misc flags
#
set(VISIBILITY_FLAGS
-fvisibility=hidden
"-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h"
)
set(EXE_LINK_FLAGS)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment