mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 00:44:37 -06:00
Compile test project with pedantic
This commit is contained in:
parent
8e498c2c2f
commit
62d3b6ee10
1
.github/actions/spelling/expect.txt
vendored
1
.github/actions/spelling/expect.txt
vendored
@ -1732,6 +1732,7 @@ virtualbox
|
||||
virtualenv
|
||||
virtualization
|
||||
virtualized
|
||||
vla
|
||||
vlist
|
||||
vm
|
||||
VMIN
|
||||
|
||||
@ -9,19 +9,48 @@ set(FPRIME_FRAMEWORK_PATH "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Location of F
|
||||
set(FPRIME_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}" CACHE PATH "Root path of F prime project" FORCE)
|
||||
|
||||
# This cmake project is only intended to be used by CI and developers to test F-prime. We enable
|
||||
# -Wall and -Wextra on this particular project as a canary to warn about compilation errors without
|
||||
# impacting real projects, where a warning from an untested compiler could break the build.
|
||||
# -Wall and -Wextra on this particular project as a canary to warn about compilation
|
||||
# errors without impacting real projects, where a warning from an untested compiler could break the
|
||||
# build.
|
||||
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>
|
||||
-Wno-unused-parameter
|
||||
)
|
||||
|
||||
# Turn on pedantic checks for clang, but disable specific checks that F' doesn't comply with.
|
||||
# GCC doesn't support disabling specific pedantic checks, so skip pedantic on GCC for now.
|
||||
#
|
||||
# Disable the unused parameter warning for now. F' has a lot of interfaces, so unused method
|
||||
# parameters are common in the F prime code base. Eventually all intentionally unused parameters
|
||||
# should be annotated to avoid this error.
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -Wno-unused-parameter")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror -Wold-style-cast -Wno-unused-parameter")
|
||||
# -Wno-unused-parameter: Disable the unused parameter warning for now. F' has a lot of interfaces,
|
||||
# so unused method parameters are common in the F prime code base. Eventually all intentionally
|
||||
# unused parameters should be annotated to avoid this error.
|
||||
#
|
||||
# -Wno-gnu-zero-variadic-macro-arguments: gnu extension required to allow FW_ASSERT to support 0+
|
||||
# optional arguments
|
||||
#
|
||||
# -Wno-vla-extension: Variable length arrays are required to support sending to async serializable
|
||||
# ports. https://github.com/nasa/fprime/issues/945
|
||||
#
|
||||
# -Wno-zero-length-array: maximum port message size calculated by using sizeof on an array the size
|
||||
# of all the port's arguments. When port has no argument array is zero sized. Array is used at
|
||||
# compile time only.
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
add_compile_options(
|
||||
-pedantic
|
||||
-Wno-gnu-zero-variadic-macro-arguments
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-vla-extension>
|
||||
$<$<COMPILE_LANGUAGE:CXX>:-Wno-zero-length-array>
|
||||
)
|
||||
endif()
|
||||
|
||||
# For this testing cmake project, enable AddressSanitizer, a runtime memory sanitizer, on all unit tests
|
||||
set (CMAKE_C_FLAGS_TESTING "${CMAKE_C_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")
|
||||
set (CMAKE_CXX_FLAGS_TESTING "${CMAKE_CXX_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")
|
||||
set (CMAKE_LINKER_FLAGS_TESTING "${CMAKE_LINKER_FLAGS_TESTING} -fno-omit-frame-pointer -fsanitize=address")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Testing" OR CMAKE_BUILD_TYPE STREQUAL "TESTING")
|
||||
add_compile_options(-fno-omit-frame-pointer -fsanitize=address)
|
||||
add_link_options(-fno-omit-frame-pointer -fsanitize=address)
|
||||
endif()
|
||||
|
||||
# Include the build for F prime.
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/cmake/FPrime.cmake")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user