From 817dc0f90b1e429b9430a53a1a78f8119f2b362a Mon Sep 17 00:00:00 2001 From: Dirk Thomas Date: Fri, 15 May 2020 12:41:56 -0700 Subject: [PATCH] warn about unused return value for set_logger_level Signed-off-by: Dirk Thomas --- rcl/include/rcl/logging_external_interface.h | 9 +++++++++ rcl/include/rcl/macros.h | 8 ++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/rcl/include/rcl/logging_external_interface.h b/rcl/include/rcl/logging_external_interface.h index 60e2fed1b9..97961a772d 100644 --- a/rcl/include/rcl/logging_external_interface.h +++ b/rcl/include/rcl/logging_external_interface.h @@ -19,6 +19,10 @@ #include "rcl/types.h" #include "rcl/visibility_control.h" +#ifdef __cplusplus +extern "C" { +#endif + /// Initialize the external logging library. /** * \param[in] config_file The location of a config file that the external @@ -78,6 +82,11 @@ rcl_logging_external_log(int severity, const char * name, const char * msg); * \return RCL_RET_ERROR if an unspecified error occurs. */ RCL_PUBLIC +RCL_WARN_UNUSED rcl_ret_t rcl_logging_external_set_logger_level(const char * name, int level); +#ifdef __cplusplus +} +#endif + #endif // RCL__LOGGING_EXTERNAL_INTERFACE_H_ diff --git a/rcl/include/rcl/macros.h b/rcl/include/rcl/macros.h index cbf5b89d01..2729f920f8 100644 --- a/rcl/include/rcl/macros.h +++ b/rcl/include/rcl/macros.h @@ -20,14 +20,10 @@ extern "C" { #endif -#ifndef _WIN32 /// Ignored return values of functions with this macro will emit a warning. -# define RCL_WARN_UNUSED __attribute__((warn_unused_result)) -#else -# define RCL_WARN_UNUSED _Check_return_ -#endif +#define RCL_WARN_UNUSED RCUTILS_WARN_UNUSED -#define RCL_UNUSED(x) (void)(x) +#define RCL_UNUSED(x) RCUTILS_UNUSED(x) #ifdef __cplusplus }