Skip to content

Commit

Permalink
cmake enable -Wcast-align and disable per module
Browse files Browse the repository at this point in the history
  • Loading branch information
dagar committed Mar 16, 2019
1 parent 13dba60 commit b35d048
Show file tree
Hide file tree
Showing 68 changed files with 129 additions and 65 deletions.
3 changes: 2 additions & 1 deletion boards/bitcraze/crazyflie/syslink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@
px4_add_module(
MODULE modules__syslink
MAIN syslink
COMPILE_FLAGS
-Wno-cast-align # TODO: fix and enable
STACK_MAIN 1300
SRCS
syslink_main.cpp
syslink_bridge.cpp
syslink_memory.cpp
syslink_params.c
syslink.c
DEPENDS
)
3 changes: 1 addition & 2 deletions cmake/px4_add_common_flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ function(px4_add_common_flags)
-Werror

-Warray-bounds
-Wcast-align
-Wdisabled-optimization
-Wdouble-promotion
-Wfatal-errors
Expand All @@ -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
Expand Down
4 changes: 4 additions & 0 deletions cmake/px4_add_module.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions platforms/posix/src/px4_layer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions platforms/qurt/cmake/px4_impl_os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/drivers/barometer/bmp280/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/drivers/barometer/lps22hb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
px4_add_module(
MODULE drivers__barometer__lps22hb
MAIN lps22hb
COMPILE_FLAGS
SRCS
lps22hb_main.cpp
LPS22HB.cpp
Expand Down
4 changes: 1 addition & 3 deletions src/drivers/barometer/lps25h/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

12 changes: 4 additions & 8 deletions src/drivers/barometer/mpl3115a2/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

13 changes: 5 additions & 8 deletions src/drivers/barometer/ms5611/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

1 change: 1 addition & 0 deletions src/drivers/boards/common/kinetis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
1 change: 1 addition & 0 deletions src/drivers/boards/common/stm32/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 2 additions & 1 deletion src/drivers/distance_sensor/leddar_one/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
3 changes: 1 addition & 2 deletions src/drivers/distance_sensor/ll40ls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

3 changes: 1 addition & 2 deletions src/drivers/distance_sensor/mb12xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

2 changes: 2 additions & 0 deletions src/drivers/distance_sensor/sf0x/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/distance_sensor/sf1xx/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/distance_sensor/srf02/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

1 change: 1 addition & 0 deletions src/drivers/distance_sensor/teraranger/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/distance_sensor/tfmini/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

36 changes: 35 additions & 1 deletion src/drivers/distance_sensor/vl53lxx/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 :
2 changes: 2 additions & 0 deletions src/drivers/gps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/drivers/imu/adis16448/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
1 change: 1 addition & 0 deletions src/drivers/imu/adis16477/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/drivers/imu/adis16497/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions src/drivers/imu/bma180/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

3 changes: 2 additions & 1 deletion src/drivers/imu/bmi055/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

3 changes: 1 addition & 2 deletions src/drivers/imu/bmi160/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

2 changes: 1 addition & 1 deletion src/drivers/imu/fxas21002c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
2 changes: 1 addition & 1 deletion src/drivers/imu/fxos8701cq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
3 changes: 1 addition & 2 deletions src/drivers/imu/l3gd20/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

3 changes: 1 addition & 2 deletions src/drivers/imu/lsm303d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

3 changes: 1 addition & 2 deletions src/drivers/irlock/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

1 change: 1 addition & 0 deletions src/drivers/kinetis/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit b35d048

Please sign in to comment.