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

Fixed warnings - strict-prototypes #115

Draft
wants to merge 1 commit into
base: rolling
Choose a base branch
from
Draft
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
16 changes: 8 additions & 8 deletions tracetools/include/tracetools/tracetools.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,20 @@

// *INDENT-OFF*
# define _TRACEPOINT_NOARGS(event_name) \
(ros_trace_ ## event_name)()
(ros_trace_ ## event_name)(void)
# define _TRACEPOINT_ARGS(event_name, ...) \
(ros_trace_ ## event_name)(__VA_ARGS__)
# define _DO_TRACEPOINT_NOARGS(event_name) \
(ros_trace_do_ ## event_name)()
(ros_trace_do_ ## event_name)(void)
# define _DO_TRACEPOINT_ARGS(event_name, ...) \
(ros_trace_do_ ## event_name)(__VA_ARGS__)
# define _DECLARE_TRACEPOINT_NOARGS(event_name) \
TRACETOOLS_PUBLIC void ros_trace_ ## event_name(); \
TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(); \
TRACETOOLS_PUBLIC void ros_trace_do_ ## event_name();
TRACETOOLS_PUBLIC void ros_trace_ ## event_name(void); \
TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(void); \
TRACETOOLS_PUBLIC void ros_trace_do_ ## event_name(void);
# define _DECLARE_TRACEPOINT_ARGS(event_name, ...) \
TRACETOOLS_PUBLIC void ros_trace_ ## event_name(__VA_ARGS__); \
TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(); \
TRACETOOLS_PUBLIC bool ros_trace_enabled_ ## event_name(void); \
TRACETOOLS_PUBLIC void ros_trace_do_ ## event_name(__VA_ARGS__);

# define _GET_MACRO_TRACEPOINT(...) \
Expand Down Expand Up @@ -103,7 +103,7 @@
* This is the preferred method over calling the underlying function directly.
*/
# define TRACETOOLS_TRACEPOINT_ENABLED(event_name) \
ros_trace_enabled_ ## event_name()
ros_trace_enabled_ ## event_name(void)
Copy link
Member

@christophebedard christophebedard Apr 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not going to work (see build failures in GitHub CI), because these macros are used for both declaration and implementation+call. I'd need to split them up.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you wanted to, you could split out the other changes (or remove the changes involving macros above from this PR), since they should be fine:

  • ros_trace_compile_status() in this file
  • tracetools/src/status_tool.c
  • tracetools/src/tracetools.c

Then I can look into dealing with the changes to macros separately.

/// Call a tracepoint, without checking if it is enabled.
/**
* Combine this with `TRACEPOINT_ENABLED()` to check if a tracepoint is enabled before triggering
Expand Down Expand Up @@ -164,7 +164,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
4 changes: 3 additions & 1 deletion tracetools/src/status_tool.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
#include "tracetools/status.h"
#include "tracetools/tracetools.h"

int main()
int main(int argc, char * argv[])
{
(void)argc;
(void)argv;
#ifndef TRACETOOLS_DISABLED
return tracetools_status(ros_trace_compile_status());
#else
Expand Down
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
Loading