parent
5781044edd
commit
a9e8784c04
3 changed files with 35 additions and 1 deletions
|
@ -22,7 +22,7 @@ if(NOT CMAKE_CXX_STANDARD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
add_compile_options(-Wall -Wextra -Wpedantic)
|
add_compile_options(-Wall -Wextra -Wpedantic -Wimplicit-fallthrough)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(ament_cmake_ros REQUIRED)
|
find_package(ament_cmake_ros REQUIRED)
|
||||||
|
|
29
rmw_cyclonedds_cpp/src/fallthrough_macro.hpp
Normal file
29
rmw_cyclonedds_cpp/src/fallthrough_macro.hpp
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2019 ADLINK Technology via Rover Robotics and Dan Rose
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
#ifndef FALLTHROUGH_MACRO_HPP_
|
||||||
|
#define FALLTHROUGH_MACRO_HPP_
|
||||||
|
|
||||||
|
#if __has_cpp_attribute(fallthrough) || (__cplusplus >= 201603L)
|
||||||
|
// C++17
|
||||||
|
#define FALLTHROUGH [[fallthrough]]
|
||||||
|
#elif __has_cpp_attribute(clang::fallthrough)
|
||||||
|
// Clang
|
||||||
|
#define FALLTHROUGH [[clang::fallthrough]]
|
||||||
|
#else
|
||||||
|
// gcc
|
||||||
|
#define FALLTHROUGH /* fallthrough */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // FALLTHROUGH_MACRO_HPP_
|
|
@ -45,6 +45,7 @@
|
||||||
#include "rmw/sanity_checks.h"
|
#include "rmw/sanity_checks.h"
|
||||||
#include "rmw/validate_node_name.h"
|
#include "rmw/validate_node_name.h"
|
||||||
|
|
||||||
|
#include "fallthrough_macro.hpp"
|
||||||
#include "Serialization.hpp"
|
#include "Serialization.hpp"
|
||||||
#include "rmw/impl/cpp/macros.hpp"
|
#include "rmw/impl/cpp/macros.hpp"
|
||||||
|
|
||||||
|
@ -354,12 +355,16 @@ extern "C" rmw_ret_t rmw_set_log_severity(rmw_log_severity_t severity)
|
||||||
return RMW_RET_INVALID_ARGUMENT;
|
return RMW_RET_INVALID_ARGUMENT;
|
||||||
case RMW_LOG_SEVERITY_DEBUG:
|
case RMW_LOG_SEVERITY_DEBUG:
|
||||||
mask |= DDS_LC_DISCOVERY | DDS_LC_THROTTLE | DDS_LC_CONFIG;
|
mask |= DDS_LC_DISCOVERY | DDS_LC_THROTTLE | DDS_LC_CONFIG;
|
||||||
|
FALLTHROUGH;
|
||||||
case RMW_LOG_SEVERITY_INFO:
|
case RMW_LOG_SEVERITY_INFO:
|
||||||
mask |= DDS_LC_INFO;
|
mask |= DDS_LC_INFO;
|
||||||
|
FALLTHROUGH;
|
||||||
case RMW_LOG_SEVERITY_WARN:
|
case RMW_LOG_SEVERITY_WARN:
|
||||||
mask |= DDS_LC_WARNING;
|
mask |= DDS_LC_WARNING;
|
||||||
|
FALLTHROUGH;
|
||||||
case RMW_LOG_SEVERITY_ERROR:
|
case RMW_LOG_SEVERITY_ERROR:
|
||||||
mask |= DDS_LC_ERROR;
|
mask |= DDS_LC_ERROR;
|
||||||
|
FALLTHROUGH;
|
||||||
case RMW_LOG_SEVERITY_FATAL:
|
case RMW_LOG_SEVERITY_FATAL:
|
||||||
mask |= DDS_LC_FATAL;
|
mask |= DDS_LC_FATAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue