From b7f69bb521ff0e33cb0696841ef9bdff19392a87 Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Fri, 1 Mar 2024 08:20:52 -0800 Subject: [PATCH] Update compile flags (#98) --- CMakeLists.txt | 7 ++++--- projects/can_transceiver/src/can_transceiver_ros_intf.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb6f877..d75e252 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,9 +23,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug") elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") endif() -# Enable all warnings as errors except unused parameter because auto-generated protobuf files trigger it, -# and clang-tidy can cover it without false-flagging the protobuf files. -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Wextra -Wpedantic -Werror -Wno-unused-parameter -pthread") +# Enable all warnings as errors except nested-anon-types, as it allows us to declare an unnamed struct within an +# anonymous union, which is allowed in the C++ standard. This appears to be a warning specific to clang++ with +# -Wpedantic, and does not appear with g++ or MSVC +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20 -Wall -Wextra -Wpedantic -Werror -Wno-nested-anon-types -pthread") message(WARNING "Building Network Systems with build type '${CMAKE_BUILD_TYPE}' " "and flags: '${CMAKE_CXX_FLAGS}'") diff --git a/projects/can_transceiver/src/can_transceiver_ros_intf.cpp b/projects/can_transceiver/src/can_transceiver_ros_intf.cpp index 2cc531d..35b96d6 100644 --- a/projects/can_transceiver/src/can_transceiver_ros_intf.cpp +++ b/projects/can_transceiver/src/can_transceiver_ros_intf.cpp @@ -160,7 +160,7 @@ class CanTransceiverIntf : public rclcpp::Node * * @param mock_gps mock_gps received from the Mock GPS topic */ - void subMockGpsCb(msg::GPS mock_gps) + void subMockGpsCb(msg::GPS /*mock_gps*/) { // TODO(lross03): implement this }