Skip to content

Commit

Permalink
Add -Wconversion flag to protect future developments (#1053) (#1815)
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 26, 2024
1 parent 8bf8a6c commit 24fcfe7
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion controller_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(controller_interface)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -Wconversion)
endif()

find_package(ament_cmake REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion controller_manager/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(controller_manager)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -Wconversion)
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
Expand Down
2 changes: 1 addition & 1 deletion hardware_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(hardware_interface)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -Wconversion)
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
Expand Down
6 changes: 4 additions & 2 deletions hardware_interface/src/component_parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,8 @@ ComponentInfo parse_complex_component_from_xml(const tinyxml2::XMLElement * comp
component.command_interfaces.push_back(parse_interfaces_from_xml(command_interfaces_it));
component.command_interfaces.back().data_type =
parse_data_type_attribute(command_interfaces_it);
component.command_interfaces.back().size = parse_size_attribute(command_interfaces_it);
component.command_interfaces.back().size =
static_cast<int>(parse_size_attribute(command_interfaces_it));
command_interfaces_it = command_interfaces_it->NextSiblingElement(kCommandInterfaceTag);
}

Expand All @@ -358,7 +359,8 @@ ComponentInfo parse_complex_component_from_xml(const tinyxml2::XMLElement * comp
{
component.state_interfaces.push_back(parse_interfaces_from_xml(state_interfaces_it));
component.state_interfaces.back().data_type = parse_data_type_attribute(state_interfaces_it);
component.state_interfaces.back().size = parse_size_attribute(state_interfaces_it);
component.state_interfaces.back().size =
static_cast<int>(parse_size_attribute(state_interfaces_it));
state_interfaces_it = state_interfaces_it->NextSiblingElement(kStateInterfaceTag);
}

Expand Down
2 changes: 1 addition & 1 deletion joint_limits/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra)
add_compile_options(-Wall -Wextra -Wconversion)
endif()

find_package(ament_cmake REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion transmission_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.5)
project(transmission_interface)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(-Wall -Wextra -Wpedantic -Wconversion)
endif()

set(THIS_PACKAGE_INCLUDE_DEPENDS
Expand Down

0 comments on commit 24fcfe7

Please sign in to comment.