Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rcl_lifecycle] Add warnings #830

Merged
merged 2 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion rcl_lifecycle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ if(NOT CMAKE_CXX_STANDARD)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
add_compile_options(
-Wall -Wextra -Wpedantic
-Wformat=2 -Wconversion -Wshadow -Wsign-conversion
)
endif()

set(rcl_lifecycle_sources
Expand Down
2 changes: 1 addition & 1 deletion rcl_lifecycle/include/rcl_lifecycle/data_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ typedef struct rcl_lifecycle_state_t
/// String with state name: Unconfigured, Inactive, Active or Finalized
const char * label;
/// Identifier of the state
unsigned int id;
uint8_t id;

/// Pointer to a struct with the valid transitions
rcl_lifecycle_transition_t * valid_transitions;
Expand Down
2 changes: 1 addition & 1 deletion rcl_lifecycle/include/rcl_lifecycle/rcl_lifecycle.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ RCL_WARN_UNUSED
rcl_ret_t
rcl_lifecycle_state_init(
rcl_lifecycle_state_t * state,
unsigned int id,
uint8_t id,
const char * label,
const rcl_allocator_t * allocator);

Expand Down
2 changes: 1 addition & 1 deletion rcl_lifecycle/src/rcl_lifecycle.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ rcl_lifecycle_get_zero_initialized_state()
rcl_ret_t
rcl_lifecycle_state_init(
rcl_lifecycle_state_t * state,
unsigned int id,
uint8_t id,
const char * label,
const rcl_allocator_t * allocator)
{
Expand Down
2 changes: 1 addition & 1 deletion rcl_lifecycle/test/test_rcl_lifecycle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ TEST(TestRclLifecycle, lifecycle_state) {
EXPECT_EQ(nullptr, state.label);

rcl_allocator_t allocator = rcl_get_default_allocator();
unsigned int expected_id = 42;
uint8_t expected_id = 42;
const char expected_label[] = "label";
rcl_ret_t ret = rcl_lifecycle_state_init(&state, expected_id, &expected_label[0], nullptr);
EXPECT_EQ(RCL_RET_INVALID_ARGUMENT, ret);
Expand Down