Skip to content

Commit

Permalink
update C++ standard (c++11 -> c++14)
Browse files Browse the repository at this point in the history
 - temporarily disable snapdragon builds until toolchain is updated
  • Loading branch information
dagar authored Jan 22, 2020
1 parent cf195b0 commit b47eaa6
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .ci/Jenkinsfile-compile
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down
4 changes: 2 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions .ycm_extra_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
# headers will be compiled as C headers. You don't want that so ALWAYS specify
# a "-std=<something>".
# 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.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ project(px4 CXX C ASM)

set(package-contact "[email protected]")

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)
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions msg/templates/urtps/microRTPS_agent_CMakeLists.txt.em
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 2 additions & 1 deletion platforms/nuttx/NuttX/Make.defs.in
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,15 @@ CFLAGS = $(ARCHINCLUDES) \
-Wno-type-limits

CXXFLAGS = $(ARCHXXINCLUDES) \
-std=gnu++11 \
-std=c++14 \
-nostdinc++ \
${CMAKE_CXX_FLAGS} \
$(FLAGS) \
-fcheck-new \
-fno-builtin \
-fno-exceptions \
-fno-rtti \
-fno-sized-deallocation \
-nostdinc++ \
-Wno-double-promotion \
-Wno-missing-declarations
Expand Down
2 changes: 2 additions & 0 deletions platforms/nuttx/cmake/px4_impl_os.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ function(px4_os_add_flags)
# prevent using the toolchain's std c++ library
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-nostdinc++>)

add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-fno-sized-deallocation>)

add_definitions(
-D__PX4_NUTTX

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit b47eaa6

Please sign in to comment.