From 7952cbcaa7926b60d179206d17fb3bb445ed4fa4 Mon Sep 17 00:00:00 2001 From: Chris Lalancette Date: Fri, 2 Aug 2024 17:04:59 +0000 Subject: [PATCH] Fix up two different C problems. The first one was that the visibility_control file was marked as a C++ header, but was included in a C header. Avoid that by just making visibility_control a C header. The second problem is that, in C, a function with no arguments technically takes "any" arguments. Fix ros_trace_compile_status() to have void arguments, which ensures that no arguments can be passed. Signed-off-by: Chris Lalancette --- tracetools/CMakeLists.txt | 2 +- tracetools/include/tracetools/tracetools.h | 4 ++-- .../{visibility_control.hpp => visibility_control.h} | 0 tracetools/src/tracetools.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) rename tracetools/include/tracetools/{visibility_control.hpp => visibility_control.h} (100%) diff --git a/tracetools/CMakeLists.txt b/tracetools/CMakeLists.txt index d9784c6f..4460a2d3 100644 --- a/tracetools/CMakeLists.txt +++ b/tracetools/CMakeLists.txt @@ -50,7 +50,7 @@ set(SOURCES set(HEADERS include/${PROJECT_NAME}/tracetools.h include/${PROJECT_NAME}/utils.hpp - include/${PROJECT_NAME}/visibility_control.hpp + include/${PROJECT_NAME}/visibility_control.h ) if(NOT TRACETOOLS_TRACEPOINTS_EXCLUDED) # We only need these if we're using LTTng diff --git a/tracetools/include/tracetools/tracetools.h b/tracetools/include/tracetools/tracetools.h index ad89a061..66d06917 100644 --- a/tracetools/include/tracetools/tracetools.h +++ b/tracetools/include/tracetools/tracetools.h @@ -32,7 +32,7 @@ #include #include "tracetools/config.h" -#include "tracetools/visibility_control.hpp" +#include "tracetools/visibility_control.h" #ifndef TRACETOOLS_DISABLED /** @@ -134,7 +134,7 @@ extern "C" /** * \return `true` if tracing is enabled, `false` otherwise */ -TRACETOOLS_PUBLIC bool ros_trace_compile_status(); +TRACETOOLS_PUBLIC bool ros_trace_compile_status(void); /// `rcl_init` /** diff --git a/tracetools/include/tracetools/visibility_control.hpp b/tracetools/include/tracetools/visibility_control.h similarity index 100% rename from tracetools/include/tracetools/visibility_control.hpp rename to tracetools/include/tracetools/visibility_control.h diff --git a/tracetools/src/tracetools.c b/tracetools/src/tracetools.c index 2a7653cb..8f35ad07 100644 --- a/tracetools/src/tracetools.c +++ b/tracetools/src/tracetools.c @@ -68,7 +68,7 @@ } // *INDENT-ON* -bool ros_trace_compile_status() +bool ros_trace_compile_status(void) { #ifndef TRACETOOLS_TRACEPOINTS_EXCLUDED return true;