diff --git a/.ci/Jenkinsfile-compile b/.ci/Jenkinsfile-compile index 8c052254c7..a2302264b8 100644 --- a/.ci/Jenkinsfile-compile +++ b/.ci/Jenkinsfile-compile @@ -50,7 +50,7 @@ pipeline { ] def docker_builds = [ - armhf_builds, base_builds, nuttx_builds_archive, snapdragon_builds + armhf_builds, base_builds, nuttx_builds_archive//, snapdragon_builds ] for (def build_type = 0; build_type < docker_builds.size(); build_type++) { diff --git a/.vscode/settings.json b/.vscode/settings.json index c7cd978c67..c701da3002 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -56,8 +56,8 @@ "cortex-debug.enableTelemetry": false, "C_Cpp.clang_format_fallbackStyle": "none", "C_Cpp.configurationWarnings": "Disabled", - "C_Cpp.default.cppStandard": "c++11", - "C_Cpp.default.cStandard": "c99", + "C_Cpp.default.cppStandard": "c++14", + "C_Cpp.default.cStandard": "c11", "C_Cpp.default.intelliSenseMode": "gcc-x64", "C_Cpp.errorSquiggles": "Disabled", "C_Cpp.formatting": "Disabled", diff --git a/.ycm_extra_conf.py b/.ycm_extra_conf.py index 83086da9e4..4f7cfc2020 100644 --- a/.ycm_extra_conf.py +++ b/.ycm_extra_conf.py @@ -51,8 +51,8 @@ flags = [ # headers will be compiled as C headers. You don't want that so ALWAYS specify # a "-std=". # For a C project, you would set this to something like 'c99' instead of -# 'c++11'. -'-std=c++11', +# 'c++14'. +'-std=c++14', # ...and the same thing goes for the magic -x option which specifies the # language that the files to be compiled are written in. This is mostly # relevant for c++ headers. diff --git a/CMakeLists.txt b/CMakeLists.txt index cd2df2db54..81e7b0719b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,7 +191,7 @@ project(px4 CXX C ASM) set(package-contact "px4users@googlegroups.com") -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_C_STANDARD 11) set(CMAKE_C_STANDARD_REQUIRED ON) diff --git a/Makefile b/Makefile index b121e5ecef..4e815463b3 100644 --- a/Makefile +++ b/Makefile @@ -437,7 +437,7 @@ clang-tidy-quiet: px4_sitl_default-clang # TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all cppcheck: px4_sitl_default @mkdir -p "$(SRC_DIR)"/build/cppcheck - @cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++11 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null + @cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++14 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null @cppcheck-htmlreport --source-encoding=ascii --file="$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml --report-dir="$(SRC_DIR)"/build/cppcheck --source-dir="$(SRC_DIR)"/src/ shellcheck_all: diff --git a/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em b/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em index ca9d8388de..f2b7f6008a 100644 --- a/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em +++ b/msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em @@ -38,15 +38,15 @@ project(micrortps_agent) find_package(fastrtps REQUIRED) find_package(fastcdr REQUIRED) -# Set C++11 +# Set C++14 include(CheckCXXCompilerFlag) if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_CLANG OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - check_cxx_compiler_flag(--std=c++11 SUPPORTS_CXX11) + check_cxx_compiler_flag(--std=c++14 SUPPORTS_CXX14) if(SUPPORTS_CXX11) - add_compile_options(--std=c++11) + add_compile_options(--std=c++14) else() - message(FATAL_ERROR "Compiler doesn't support C++11") + message(FATAL_ERROR "Compiler doesn't support C++14") endif() endif() diff --git a/platforms/nuttx/NuttX/Make.defs.in b/platforms/nuttx/NuttX/Make.defs.in index 2e157b9e8a..3a7165f745 100644 --- a/platforms/nuttx/NuttX/Make.defs.in +++ b/platforms/nuttx/NuttX/Make.defs.in @@ -109,7 +109,7 @@ CFLAGS = $(ARCHINCLUDES) \ -Wno-type-limits CXXFLAGS = $(ARCHXXINCLUDES) \ - -std=gnu++11 \ + -std=c++14 \ -nostdinc++ \ ${CMAKE_CXX_FLAGS} \ $(FLAGS) \ @@ -117,6 +117,7 @@ CXXFLAGS = $(ARCHXXINCLUDES) \ -fno-builtin \ -fno-exceptions \ -fno-rtti \ + -fno-sized-deallocation \ -nostdinc++ \ -Wno-double-promotion \ -Wno-missing-declarations diff --git a/platforms/nuttx/cmake/px4_impl_os.cmake b/platforms/nuttx/cmake/px4_impl_os.cmake index a9ce19a321..8a601eb6f0 100644 --- a/platforms/nuttx/cmake/px4_impl_os.cmake +++ b/platforms/nuttx/cmake/px4_impl_os.cmake @@ -67,6 +67,8 @@ function(px4_os_add_flags) # prevent using the toolchain's std c++ library add_compile_options($<$:-nostdinc++>) + add_compile_options($<$:-fno-sized-deallocation>) + add_definitions( -D__PX4_NUTTX diff --git a/src/drivers/uavcan/uavcan_drivers/kinetis/driver/CMakeLists.txt b/src/drivers/uavcan/uavcan_drivers/kinetis/driver/CMakeLists.txt index 5278517b1b..dc88509ae5 100644 --- a/src/drivers/uavcan/uavcan_drivers/kinetis/driver/CMakeLists.txt +++ b/src/drivers/uavcan/uavcan_drivers/kinetis/driver/CMakeLists.txt @@ -2,6 +2,7 @@ include_directories( ./include ) +add_compile_options(-Wno-unused-variable) add_library(uavcan_kinetis_driver STATIC ./src/uc_kinetis_flexcan.cpp ./src/uc_kinetis_clock.cpp diff --git a/src/drivers/uavcan/uavcan_drivers/kinetis/driver/src/uc_kinetis_flexcan.cpp b/src/drivers/uavcan/uavcan_drivers/kinetis/driver/src/uc_kinetis_flexcan.cpp index 727efabbeb..171a6ecdf5 100644 --- a/src/drivers/uavcan/uavcan_drivers/kinetis/driver/src/uc_kinetis_flexcan.cpp +++ b/src/drivers/uavcan/uavcan_drivers/kinetis/driver/src/uc_kinetis_flexcan.cpp @@ -693,7 +693,7 @@ void CanIface::handleRxInterrupt(uavcan::uint32_t rx_iflags, uavcan::uint64_t ut frame.data[7] = rf.data.b7; volatile uavcan::uint32_t idhit = can_->RXFIR; - UNUSED(idhit); + (void)can_->TIMER; can_->IFLAG1 = flexcan::CAN_FIFO_NE;