Skip to content

Commit

Permalink
Fix up two different C problems. (#129)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
clalancette authored Aug 2, 2024
1 parent 409ae64 commit 7758ad4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion tracetools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tracetools/include/tracetools/tracetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <stdbool.h>

#include "tracetools/config.h"
#include "tracetools/visibility_control.hpp"
#include "tracetools/visibility_control.h"

#ifndef TRACETOOLS_DISABLED
/**
Expand Down Expand Up @@ -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`
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* library cannot have, but the consuming code must have inorder to link.
*/

#ifndef TRACETOOLS__VISIBILITY_CONTROL_HPP_
#define TRACETOOLS__VISIBILITY_CONTROL_HPP_
#ifndef TRACETOOLS__VISIBILITY_CONTROL_H_
#define TRACETOOLS__VISIBILITY_CONTROL_H_

// This logic was borrowed (then namespaced) from the examples on the gcc wiki:
// https://gcc.gnu.org/wiki/Visibility
Expand Down Expand Up @@ -53,4 +53,4 @@
#define TRACETOOLS_PUBLIC_TYPE
#endif

#endif // TRACETOOLS__VISIBILITY_CONTROL_HPP_
#endif // TRACETOOLS__VISIBILITY_CONTROL_H_
2 changes: 1 addition & 1 deletion tracetools/src/tracetools.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
}
// *INDENT-ON*

bool ros_trace_compile_status()
bool ros_trace_compile_status(void)
{
#ifndef TRACETOOLS_TRACEPOINTS_EXCLUDED
return true;
Expand Down

0 comments on commit 7758ad4

Please sign in to comment.