cmake enable -Wcast-align and disable per module

This commit is contained in:
Daniel Agar 2019-03-16 11:23:17 -04:00
parent 13dba60149
commit b35d048566
68 changed files with 129 additions and 65 deletions

View File

@ -34,6 +34,8 @@
px4_add_module(
MODULE modules__syslink
MAIN syslink
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
STACK_MAIN 1300
SRCS
syslink_main.cpp
@ -41,5 +43,4 @@ px4_add_module(
syslink_memory.cpp
syslink_params.c
syslink.c
DEPENDS
)

View File

@ -66,6 +66,7 @@ function(px4_add_common_flags)
-Werror
-Warray-bounds
-Wcast-align
-Wdisabled-optimization
-Wdouble-promotion
-Wfatal-errors
@ -79,8 +80,6 @@ function(px4_add_common_flags)
-Wunknown-pragmas
-Wunused-variable
#-Wcast-align # TODO: fix and enable
# disabled warnings
-Wno-implicit-fallthrough # set appropriate level and update
-Wno-missing-field-initializers

View File

@ -118,6 +118,10 @@ function(px4_add_module)
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp)
target_include_directories(${MODULE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
if(COMPILE_FLAGS)
target_compile_options(${MODULE}_original PRIVATE ${COMPILE_FLAGS})
endif()
if(DEPENDS)
# using target_link_libraries for dependencies provides linking
# as well as interface include and libraries

View File

@ -54,6 +54,7 @@ add_library(px4_layer
${SHMEM_SRCS}
)
target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4")
target_compile_options(px4_layer PRIVATE -Wno-cast-align) # TODO: fix and enable
target_link_libraries(px4_layer PRIVATE work_queue)
target_link_libraries(px4_layer PRIVATE px4_daemon)

View File

@ -133,6 +133,7 @@ function(px4_os_add_flags)
-fmath-errno
-Wno-unknown-warning-option
-Wno-cast-align
)
# Clear -rdynamic flag which fails for hexagon

View File

@ -34,6 +34,8 @@
px4_add_module(
MODULE drivers__bmp280
MAIN bmp280
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
STACK_MAIN
1200
SRCS

View File

@ -33,7 +33,6 @@
px4_add_module(
MODULE drivers__barometer__lps22hb
MAIN lps22hb
COMPILE_FLAGS
SRCS
lps22hb_main.cpp
LPS22HB.cpp

View File

@ -35,11 +35,9 @@ px4_add_module(
MAIN lps25h
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
lps25h.cpp
lps25h_i2c.cpp
lps25h_spi.cpp
DEPENDS
)

View File

@ -30,17 +30,13 @@
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
set(srcs
mpl3115a2_i2c.cpp
mpl3115a2.cpp
)
px4_add_module(
MODULE drivers__mpl3115a2
MAIN mpl3115a2
STACK_MAIN 1200
COMPILE_FLAGS
SRCS ${srcs}
DEPENDS
-Wno-cast-align # TODO: fix and enable
SRCS
mpl3115a2_i2c.cpp
mpl3115a2.cpp
)

View File

@ -30,18 +30,15 @@
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
set(srcs
ms5611_spi.cpp
ms5611_i2c.cpp
ms5611.cpp
)
px4_add_module(
MODULE drivers__ms5611
MAIN ms5611
STACK_MAIN 1500
COMPILE_FLAGS
SRCS ${srcs}
DEPENDS
-Wno-cast-align # TODO: fix and enable
SRCS
ms5611_spi.cpp
ms5611_i2c.cpp
ms5611.cpp
)

View File

@ -37,4 +37,5 @@ add_library(drivers_boards_common_arch
board_reset.c
)
add_dependencies(drivers_boards_common_arch prebuild_targets)
target_compile_options(drivers_boards_common_arch PRIVATE -Wno-cast-align) # TODO: fix and enable
target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch)

View File

@ -39,4 +39,5 @@ add_library(drivers_boards_common_arch
board_critmon.c
)
add_dependencies(drivers_boards_common_arch prebuild_targets)
target_compile_options(drivers_boards_common_arch PRIVATE -Wno-cast-align) # TODO: fix and enable
target_link_libraries(drivers_boards_common_arch PRIVATE nuttx_arch)

View File

@ -34,9 +34,10 @@ px4_add_module(
MODULE drivers__leddar_one
MAIN leddar_one
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
leddar_one.cpp
MODULE_CONFIG
module.yaml
DEPENDS
)

View File

@ -34,11 +34,10 @@ px4_add_module(
MODULE drivers__ll40ls
MAIN ll40ls
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
ll40ls.cpp
LidarLite.cpp
LidarLiteI2C.cpp
LidarLitePWM.cpp
DEPENDS
)

View File

@ -34,8 +34,7 @@ px4_add_module(
MODULE drivers__mb12xx
MAIN mb12xx
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
mb12xx.cpp
DEPENDS
)

View File

@ -33,6 +33,8 @@
px4_add_module(
MODULE drivers__sf0x
MAIN sf0x
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
sf0x.cpp
sf0x_parser.cpp

View File

@ -31,10 +31,10 @@
#
############################################################################
px4_add_module(
MODULE drivers__sf1xx
MAIN sf1xx
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
sf1xx.cpp
DEPENDS

View File

@ -34,8 +34,7 @@ px4_add_module(
MODULE drivers__srf02
MAIN srf02
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
srf02.cpp
DEPENDS
)

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN teraranger
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
teraranger.cpp
DEPENDS

View File

@ -34,11 +34,10 @@ px4_add_module(
MODULE drivers__tfmini
MAIN tfmini
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
tfmini.cpp
tfmini_parser.cpp
MODULE_CONFIG
module.yaml
DEPENDS
)

View File

@ -1,7 +1,41 @@
############################################################################
#
# Copyright (c) 2019 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
px4_add_module(
MODULE drivers__vl53lxx
MAIN vl53lxx
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
vl53lxx.cpp
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :

View File

@ -37,6 +37,8 @@ px4_add_module(
MODULE drivers__gps
MAIN gps
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
gps.cpp
devices/src/gps_helper.cpp

View File

@ -35,7 +35,7 @@ px4_add_module(
MAIN adis16448
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
adis16448.cpp
DEPENDS
)

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN adis16477
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
ADIS16477.cpp
ADIS16477_gyro.cpp

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN adis16497
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
ADIS16497.cpp
ADIS16497_gyro.cpp

View File

@ -34,8 +34,7 @@ px4_add_module(
MODULE drivers__bma180
MAIN bma180
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
bma180.cpp
DEPENDS
)

View File

@ -34,9 +34,10 @@ px4_add_module(
MODULE drivers__bmi055
MAIN bmi055
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
BMI055_accel.cpp
BMI055_gyro.cpp
bmi055_main.cpp
)

View File

@ -35,10 +35,9 @@ px4_add_module(
MAIN bmi160
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
bmi160.cpp
bmi160_gyro.cpp
bmi160_main.cpp
DEPENDS
)

View File

@ -35,7 +35,7 @@ px4_add_module(
MAIN fxas21002c
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
fxas21002c.cpp
DEPENDS
)

View File

@ -35,7 +35,7 @@ px4_add_module(
MAIN fxos8701cq
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
fxos8701cq.cpp
DEPENDS
)

View File

@ -35,8 +35,7 @@ px4_add_module(
MAIN l3gd20
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
l3gd20.cpp
DEPENDS
)

View File

@ -35,8 +35,7 @@ px4_add_module(
MAIN lsm303d
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
lsm303d.cpp
DEPENDS
)

View File

@ -34,8 +34,7 @@ px4_add_module(
MODULE drivers__irlock
MAIN irlock
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
irlock.cpp
DEPENDS
)

View File

@ -41,3 +41,4 @@ add_library(drivers_arch
)
add_dependencies(drivers_arch prebuild_targets)
target_link_libraries(drivers_arch PRIVATE drivers_board)
target_compile_options(drivers_arch PRIVATE -Wno-cast-align) # TODO: fix and enable

View File

@ -35,8 +35,7 @@ px4_add_module(
MAIN bmm150
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
bmm150.cpp
DEPENDS
)

View File

@ -35,10 +35,9 @@ px4_add_module(
MAIN hmc5883
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
hmc5883_i2c.cpp
hmc5883_spi.cpp
hmc5883.cpp
DEPENDS
)

View File

@ -33,8 +33,9 @@
px4_add_module(
MODULE drivers__ist8310
MAIN ist8310
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
STACK_MAIN 1500
SRCS
ist8310.cpp
)

View File

@ -35,11 +35,10 @@ px4_add_module(
MAIN lis3mdl
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
lis3mdl_i2c.cpp
lis3mdl_spi.cpp
lis3mdl_main.cpp
lis3mdl.cpp
DEPENDS
)

View File

@ -35,9 +35,9 @@ px4_add_module(
MAIN qmc5883
STACK_MAIN 1500
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
qmc5883_i2c.cpp
qmc5883_spi.cpp
qmc5883.cpp
DEPENDS
)

View File

@ -35,10 +35,10 @@ px4_add_module(
MAIN rm3100
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
rm3100_i2c.cpp
rm3100_spi.cpp
rm3100_main.cpp
rm3100.cpp
DEPENDS
)

View File

@ -34,6 +34,8 @@
px4_add_module(
MODULE drivers__pmw3901
MAIN pmw3901
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
STACK_MAIN 1200
SRCS
pmw3901.cpp

View File

@ -36,7 +36,7 @@ px4_add_module(
STACK_MAIN 1024
COMPILE_FLAGS
-Wno-pmf-conversions
-Wno-cast-align # TODO: fix and enable
SRCS
pwm_input.cpp
DEPENDS
)

View File

@ -35,8 +35,7 @@ px4_add_module(
MAIN px4flow
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
px4flow.cpp
DEPENDS
)

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN px4io
STACK_MAIN 1816
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
px4io.cpp
px4io_uploader.cpp

View File

@ -41,3 +41,4 @@ add_library(drivers_arch
)
add_dependencies(drivers_arch prebuild_targets)
target_link_libraries(drivers_arch PRIVATE drivers_board)
target_compile_options(drivers_arch PRIVATE -Wno-cast-align) # TODO: fix and enable

View File

@ -63,6 +63,7 @@ add_definitions(
-DUAVCAN_PLATFORM=${UAVCAN_PLATFORM}
)
add_compile_options(-Wno-cast-align) # TODO: fix and enable
add_subdirectory(libuavcan EXCLUDE_FROM_ALL)
add_dependencies(uavcan prebuild_targets)

View File

@ -52,6 +52,7 @@ add_definitions(
-DUAVCAN_USE_EXTERNAL_SNPRINT
)
add_compile_options(-Wno-cast-align) # TODO: fix and enable
add_subdirectory(${LIBUAVCAN_DIR} uavcanesc_libuavcan)
add_dependencies(uavcan prebuild_targets)

View File

@ -52,6 +52,7 @@ add_definitions(
-DUAVCAN_USE_EXTERNAL_SNPRINT
)
add_compile_options(-Wno-cast-align) # TODO: fix and enable
add_subdirectory(${LIBUAVCAN_DIR} uavcannode_libuavcan)
add_dependencies(uavcan prebuild_targets)

View File

@ -32,3 +32,4 @@
############################################################################
px4_add_library(CollisionPrevention CollisionPrevention.cpp)
target_compile_options(CollisionPrevention PRIVATE -Wno-cast-align) # TODO: fix and enable

@ -1 +1 @@
Subproject commit 4b2eb055e534a09323c4f5c467aaff63c98dce7c
Subproject commit 06277ef49fb8c9fad18d56ef40e8bc9fe1655a65

View File

@ -103,6 +103,8 @@ add_custom_command(
# Create Flight Tasks Library
###########################################
add_compile_options(-Wno-cast-align) # TODO: fix and enable
px4_add_library(FlightTasks
FlightTasks.cpp
FlightTasks_generated.cpp

View File

@ -149,7 +149,11 @@ if (NOT "${PX4_BOARD}" MATCHES "px4_io")
target_link_libraries(parameters PRIVATE perf tinybson)
target_compile_definitions(parameters PRIVATE -DMODULE_NAME="parameters")
target_compile_options(parameters PRIVATE -Wno-sign-compare) # TODO: fix this
target_compile_options(parameters
PRIVATE
-Wno-cast-align # TODO: fix and enable
-Wno-sign-compare # TODO: fix and enable
)
else()
add_library(parameters ${PX4_SOURCE_DIR}/src/platforms/empty.c)
endif()

View File

@ -37,5 +37,9 @@ add_library(flashparams
)
add_dependencies(flashparams prebuild_targets)
target_compile_definitions(flashparams PRIVATE -DMODULE_NAME="flashparams")
target_compile_options(flashparams PRIVATE -Wno-sign-compare) # TODO: fix this
target_compile_options(flashparams
PRIVATE
-Wno-sign-compare # TODO: fix this
-Wno-cast-align # TODO: fix and enable
)
target_link_libraries(flashparams PRIVATE nuttx_arch)

View File

@ -39,6 +39,7 @@ px4_add_module(
STACK_MAIN 4096
STACK_MAX 2450
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
accelerometer_calibration.cpp
airspeed_calibration.cpp

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN dataman
STACK_MAIN 1200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
dataman.cpp
)

View File

@ -37,6 +37,7 @@ px4_add_module(
PRIORITY "SCHED_PRIORITY_MAX-30"
STACK_MAIN 2200
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
logger.cpp
log_writer.cpp

View File

@ -39,6 +39,7 @@ px4_add_module(
STACK_MAIN 1600
STACK_MAX 1600
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
SRCS

View File

@ -42,6 +42,7 @@ px4_add_module(
#-DMAVLINK_FTP_DEBUG
-DMavlinkStream=MavlinkStreamTest
-DMavlinkFTP=MavlinkFTPTest
-Wno-cast-align # TODO: fix and enable
SRCS
mavlink_tests.cpp
mavlink_ftp_test.cpp

View File

@ -35,6 +35,8 @@ include(hexagon_sdk)
px4_add_module(
MODULE modules__muorb__krait
MAIN muorb
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
INCLUDES
${HEXAGON_SDK_INCLUDES}
${PX4_BINARY_DIR}/platforms/posix

View File

@ -60,6 +60,7 @@ px4_add_module(
MAIN simulator
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
SRCS

View File

@ -36,6 +36,7 @@ px4_add_module(
MAIN accelsim
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align # TODO: fix and enable
SRCS
accelsim.cpp
DEPENDS

View File

@ -36,6 +36,7 @@ px4_add_module(
MAIN measairspeedsim
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align # TODO: fix and enable
SRCS
airspeedsim.cpp
meas_airspeed_sim.cpp

View File

@ -36,6 +36,7 @@ px4_add_module(
MAIN barosim
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align # TODO: fix and enable
SRCS
baro.cpp
DEPENDS

View File

@ -36,6 +36,7 @@ px4_add_module(
MAIN gpssim
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align # TODO: fix and enable
SRCS
gpssim.cpp
DEPENDS

View File

@ -36,6 +36,7 @@ px4_add_module(
MAIN gyrosim
COMPILE_FLAGS
-Wno-double-promotion
-Wno-cast-align # TODO: fix and enable
STACK_MAIN 1200
SRCS
gyrosim.cpp

View File

@ -51,6 +51,7 @@ if (NOT "${PX4_PLATFORM}" MATCHES "nuttx")
work_thread.c
)
target_compile_definitions(work_queue PRIVATE MODULE_NAME="work_queue")
target_compile_options(work_queue PRIVATE -Wno-cast-align) # TODO: fix and enable
add_dependencies(work_queue prebuild_targets)
endif()

View File

@ -35,8 +35,7 @@ px4_add_module(
MAIN bl_update
STACK_MAIN 4096
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
bl_update.c
DEPENDS
)

View File

@ -35,6 +35,7 @@ px4_add_module(
MAIN hardfault_log
STACK_MAIN 2100
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
SRCS
hardfault_log.c
DEPENDS