Skip to content

Commit

Permalink
Fix exception parameter not being used (#194)
Browse files Browse the repository at this point in the history
### Public-Facing Changes
None

### Description
- Enables stricter clang compilation flags
- Fix unused exception parameter

fixes #193
  • Loading branch information
achim-k authored Mar 10, 2023
1 parent 40521a9 commit c99ef97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

macro(enable_strict_compiler_warnings target)
target_compile_options(${target} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/WX /W4>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror -Wold-style-cast -Wfloat-equal>
)
if (MSVC)
target_compile_options(${target} PRIVATE /WX /W4)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wold-style-cast -Wfloat-equal -Wmost -Wunused-exception-parameter)
else()
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic -Werror -Wold-style-cast -Wfloat-equal)
endif()
endmacro()

find_package(nlohmann_json QUIET)
Expand Down
4 changes: 2 additions & 2 deletions ros1_foxglove_bridge/src/ros1_foxglove_bridge_nodelet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -453,8 +453,8 @@ class FoxgloveBridge : public nodelet::Nodelet {
try {
channelPublicationIt->second.publish(msg);
} catch (const std::exception& ex) {
ROS_ERROR("Failed to publish message on topic '%s'",
channelPublicationIt->second.getTopic().c_str());
ROS_ERROR("Failed to publish message on topic '%s': %s",
channelPublicationIt->second.getTopic().c_str(), ex.what());
}
}

Expand Down

0 comments on commit c99ef97

Please sign in to comment.