Skip to content

Commit 47d27e1

Browse files
Use leading underscore for internal macros
Signed-off-by: Christophe Bedard <[email protected]>
1 parent 991243a commit 47d27e1

File tree

3 files changed

+44
-44
lines changed

3 files changed

+44
-44
lines changed

tracetools/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ EXCLUDE_SYMBOLS = \
3535
"_GET_MACRO_TRACEPOINT" \
3636
"_GET_MACRO_DO_TRACEPOINT" \
3737
"_GET_MACRO_DECLARE_TRACEPOINT" \
38-
"DECLARE_TRACEPOINT"
38+
"_DECLARE_TRACEPOINT"
3939
"TRACEPOINT" \
4040
"TRACEPOINT_ENABLED" \
4141
"DO_TRACEPOINT" \

tracetools/include/tracetools/tracetools.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
_DECLARE_TRACEPOINT_ARGS, _DECLARE_TRACEPOINT_ARGS, _DECLARE_TRACEPOINT_ARGS, \
8181
_DECLARE_TRACEPOINT_ARGS, _DECLARE_TRACEPOINT_ARGS, _DECLARE_TRACEPOINT_ARGS, \
8282
_DECLARE_TRACEPOINT_NOARGS, shoud_not_be_called_without_any_arguments)
83+
# define _DECLARE_TRACEPOINT(...) \
84+
_GET_MACRO_DECLARE_TRACEPOINT(__VA_ARGS__)(__VA_ARGS__)
8385

8486
/// Call a tracepoint.
8587
/**
@@ -114,13 +116,11 @@
114116
*/
115117
# define TRACETOOLS_DO_TRACEPOINT(...) \
116118
_GET_MACRO_DO_TRACEPOINT(__VA_ARGS__)(__VA_ARGS__)
117-
# define DECLARE_TRACEPOINT(...) \
118-
_GET_MACRO_DECLARE_TRACEPOINT(__VA_ARGS__)(__VA_ARGS__)
119119
#else
120120
# define TRACETOOLS_TRACEPOINT(...) ((void) (0))
121121
# define TRACETOOLS_TRACEPOINT_ENABLED(event_name) false
122122
# define TRACETOOLS_DO_TRACEPOINT(...) ((void) (0))
123-
# define DECLARE_TRACEPOINT(...)
123+
# define _DECLARE_TRACEPOINT(...)
124124
#endif // TRACETOOLS_DISABLED
125125

126126
// TODO(christophebedard) remove in Rolling after Iron release
@@ -171,7 +171,7 @@ TRACETOOLS_PUBLIC bool ros_trace_compile_status();
171171
*
172172
* \param[in] context_handle pointer to the `rcl_context_t` handle
173173
*/
174-
DECLARE_TRACEPOINT(
174+
_DECLARE_TRACEPOINT(
175175
rcl_init,
176176
const void * context_handle)
177177

@@ -185,7 +185,7 @@ DECLARE_TRACEPOINT(
185185
* \param[in] node_name node name
186186
* \param[in] node_namespace node namespace
187187
*/
188-
DECLARE_TRACEPOINT(
188+
_DECLARE_TRACEPOINT(
189189
rcl_node_init,
190190
const void * node_handle,
191191
const void * rmw_handle,
@@ -200,7 +200,7 @@ DECLARE_TRACEPOINT(
200200
* \param[in] rmw_publisher_handle pointer to the publisher's `rmw_publisher_t` handle
201201
* \param[in] gid pointer to the publisher's DDS/rmw GID
202202
*/
203-
DECLARE_TRACEPOINT(
203+
_DECLARE_TRACEPOINT(
204204
rmw_publisher_init,
205205
const void * rmw_publisher_handle,
206206
const uint8_t * gid)
@@ -217,7 +217,7 @@ DECLARE_TRACEPOINT(
217217
* \param[in] topic_name full topic name
218218
* \param[in] queue_depth publisher history depth
219219
*/
220-
DECLARE_TRACEPOINT(
220+
_DECLARE_TRACEPOINT(
221221
rcl_publisher_init,
222222
const void * publisher_handle,
223223
const void * node_handle,
@@ -233,7 +233,7 @@ DECLARE_TRACEPOINT(
233233
* \param[in] publisher_handle not used, but kept for API/ABI stability
234234
* \param[in] message pointer to the message being published
235235
*/
236-
DECLARE_TRACEPOINT(
236+
_DECLARE_TRACEPOINT(
237237
rclcpp_publish,
238238
const void * publisher_handle,
239239
const void * message)
@@ -247,7 +247,7 @@ DECLARE_TRACEPOINT(
247247
* \param[in] publisher_handle pointer to the publisher's `rcl_publisher_t` handle
248248
* \param[in] message pointer to the message being published
249249
*/
250-
DECLARE_TRACEPOINT(
250+
_DECLARE_TRACEPOINT(
251251
rcl_publish,
252252
const void * publisher_handle,
253253
const void * message)
@@ -259,7 +259,7 @@ DECLARE_TRACEPOINT(
259259
*
260260
* \param[in] message pointer to the message being published
261261
*/
262-
DECLARE_TRACEPOINT(
262+
_DECLARE_TRACEPOINT(
263263
rmw_publish,
264264
const void * message)
265265

@@ -271,7 +271,7 @@ DECLARE_TRACEPOINT(
271271
* \param[in] rmw_subscription_handle pointer to the publisher's `rmw_subscription_t` handle
272272
* \param[in] gid pointer to the subscription's DDS/rmw GID
273273
*/
274-
DECLARE_TRACEPOINT(
274+
_DECLARE_TRACEPOINT(
275275
rmw_subscription_init,
276276
const void * rmw_subscription_handle,
277277
const uint8_t * gid)
@@ -289,7 +289,7 @@ DECLARE_TRACEPOINT(
289289
* \param[in] topic_name full topic name
290290
* \param[in] queue_depth subscription history depth
291291
*/
292-
DECLARE_TRACEPOINT(
292+
_DECLARE_TRACEPOINT(
293293
rcl_subscription_init,
294294
const void * subscription_handle,
295295
const void * node_handle,
@@ -308,7 +308,7 @@ DECLARE_TRACEPOINT(
308308
* pointer to the `rcl_subscription_t` handle of the subscription this object belongs to
309309
* \param[in] subscription pointer to this subscription object (e.g. `rclcpp::*Subscription*`)
310310
*/
311-
DECLARE_TRACEPOINT(
311+
_DECLARE_TRACEPOINT(
312312
rclcpp_subscription_init,
313313
const void * subscription_handle,
314314
const void * subscription)
@@ -320,7 +320,7 @@ DECLARE_TRACEPOINT(
320320
* \param[in] subscription pointer to the subscription object this callback belongs to
321321
* \param[in] callback pointer to this callback object (e.g. `rclcpp::AnySubscriptionCallback`)
322322
*/
323-
DECLARE_TRACEPOINT(
323+
_DECLARE_TRACEPOINT(
324324
rclcpp_subscription_callback_added,
325325
const void * subscription,
326326
const void * callback)
@@ -337,7 +337,7 @@ DECLARE_TRACEPOINT(
337337
* or 0 (if no message or no info)
338338
* \param[in] taken whether a message was taken
339339
*/
340-
DECLARE_TRACEPOINT(
340+
_DECLARE_TRACEPOINT(
341341
rmw_take,
342342
const void * rmw_subscription_handle,
343343
const void * message,
@@ -351,7 +351,7 @@ DECLARE_TRACEPOINT(
351351
*
352352
* \param[in] message pointer to the message being taken
353353
*/
354-
DECLARE_TRACEPOINT(
354+
_DECLARE_TRACEPOINT(
355355
rcl_take,
356356
const void * message)
357357

@@ -362,7 +362,7 @@ DECLARE_TRACEPOINT(
362362
*
363363
* \param[in] message pointer to the message being taken
364364
*/
365-
DECLARE_TRACEPOINT(
365+
_DECLARE_TRACEPOINT(
366366
rclcpp_take,
367367
const void * message)
368368

@@ -377,7 +377,7 @@ DECLARE_TRACEPOINT(
377377
* \param[in] rmw_service_handle pointer to the service's `rmw_service_t` handle
378378
* \param[in] service_name full service name
379379
*/
380-
DECLARE_TRACEPOINT(
380+
_DECLARE_TRACEPOINT(
381381
rcl_service_init,
382382
const void * service_handle,
383383
const void * node_handle,
@@ -392,7 +392,7 @@ DECLARE_TRACEPOINT(
392392
* pointer to the `rcl_service_t` handle of the service this callback belongs to
393393
* \param[in] callback pointer to this callback object (e.g. `rclcpp::AnyServiceCallback`)
394394
*/
395-
DECLARE_TRACEPOINT(
395+
_DECLARE_TRACEPOINT(
396396
rclcpp_service_callback_added,
397397
const void * service_handle,
398398
const void * callback)
@@ -408,7 +408,7 @@ DECLARE_TRACEPOINT(
408408
* \param[in] rmw_client_handle pointer to the client's `rmw_client_t` handle
409409
* \param[in] service_name full client name
410410
*/
411-
DECLARE_TRACEPOINT(
411+
_DECLARE_TRACEPOINT(
412412
rcl_client_init,
413413
const void * client_handle,
414414
const void * node_handle,
@@ -423,7 +423,7 @@ DECLARE_TRACEPOINT(
423423
* \param[in] timer_handle pointer to the timer's `rcl_timer_t` handle
424424
* \param[in] period period in nanoseconds
425425
*/
426-
DECLARE_TRACEPOINT(
426+
_DECLARE_TRACEPOINT(
427427
rcl_timer_init,
428428
const void * timer_handle,
429429
int64_t period)
@@ -436,7 +436,7 @@ DECLARE_TRACEPOINT(
436436
* pointer to the `rcl_timer_t` handle of the timer this callback belongs to
437437
* \param[in] callback pointer to the callback object (`std::function`)
438438
*/
439-
DECLARE_TRACEPOINT(
439+
_DECLARE_TRACEPOINT(
440440
rclcpp_timer_callback_added,
441441
const void * timer_handle,
442442
const void * callback)
@@ -448,7 +448,7 @@ DECLARE_TRACEPOINT(
448448
* \param[in] timer_handle pointer to the timer's `rcl_timer_t` handle
449449
* \param[in] node_handle pointer to the `rcl_node_t` handle of the node the timer belongs to
450450
*/
451-
DECLARE_TRACEPOINT(
451+
_DECLARE_TRACEPOINT(
452452
rclcpp_timer_link_node,
453453
const void * timer_handle,
454454
const void * node_handle)
@@ -463,7 +463,7 @@ DECLARE_TRACEPOINT(
463463
* \param[in] function_symbol demangled symbol of the callback function/lambda,
464464
* see \ref get_symbol()
465465
*/
466-
DECLARE_TRACEPOINT(
466+
_DECLARE_TRACEPOINT(
467467
rclcpp_callback_register,
468468
const void * callback,
469469
const char * function_symbol)
@@ -477,7 +477,7 @@ DECLARE_TRACEPOINT(
477477
* `rclcpp::AnyServiceCallback`, timer `std::function`, etc.)
478478
* \param[in] is_intra_process whether this callback is done via intra-process or not
479479
*/
480-
DECLARE_TRACEPOINT(
480+
_DECLARE_TRACEPOINT(
481481
callback_start,
482482
const void * callback,
483483
const bool is_intra_process)
@@ -490,7 +490,7 @@ DECLARE_TRACEPOINT(
490490
* (e.g. `rclcpp::AnySubscriptionCallback`,
491491
* `rclcpp::AnyServiceCallback`, timer `std::function`, etc.)
492492
*/
493-
DECLARE_TRACEPOINT(
493+
_DECLARE_TRACEPOINT(
494494
callback_end,
495495
const void * callback)
496496

@@ -502,7 +502,7 @@ DECLARE_TRACEPOINT(
502502
* \param[in] node_handle pointer to the node handle
503503
* \param[in] state_machine pointer to the state machine
504504
*/
505-
DECLARE_TRACEPOINT(
505+
_DECLARE_TRACEPOINT(
506506
rcl_lifecycle_state_machine_init,
507507
const void * node_handle,
508508
const void * state_machine)
@@ -515,7 +515,7 @@ DECLARE_TRACEPOINT(
515515
* \param[in] start_label start state label
516516
* \param[in] goal_label goal state label
517517
*/
518-
DECLARE_TRACEPOINT(
518+
_DECLARE_TRACEPOINT(
519519
rcl_lifecycle_transition,
520520
const void * state_machine,
521521
const char * start_label,
@@ -525,7 +525,7 @@ DECLARE_TRACEPOINT(
525525
/**
526526
* Notes the start time of the executor phase that gets the next executable that's ready.
527527
*/
528-
DECLARE_TRACEPOINT(
528+
_DECLARE_TRACEPOINT(
529529
rclcpp_executor_get_next_ready)
530530

531531
/// `rclcpp_executor_wait_for_work`
@@ -534,7 +534,7 @@ DECLARE_TRACEPOINT(
534534
*
535535
* \param[in] timeout the timeout value for the wait call
536536
*/
537-
DECLARE_TRACEPOINT(
537+
_DECLARE_TRACEPOINT(
538538
rclcpp_executor_wait_for_work,
539539
const int64_t timeout)
540540

@@ -547,7 +547,7 @@ DECLARE_TRACEPOINT(
547547
*
548548
* \param[in] handle pointer to the `rcl` handle of the executable being executed
549549
*/
550-
DECLARE_TRACEPOINT(
550+
_DECLARE_TRACEPOINT(
551551
rclcpp_executor_execute,
552552
const void * handle)
553553

tracetools/src/tracetools.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@
2424
*/
2525
#ifndef TRACETOOLS_TRACEPOINTS_EXCLUDED
2626
# include "tracetools/tp_call.h"
27-
# define CONDITIONAL_TP(...) \
27+
# define _CONDITIONAL_TP(...) \
2828
tracepoint(TRACEPOINT_PROVIDER, __VA_ARGS__)
29-
# define CONDITIONAL_TP_ENABLED(event_name) \
29+
# define _CONDITIONAL_TP_ENABLED(event_name) \
3030
0 != tracepoint_enabled(ros2, event_name)
31-
# define CONDITIONAL_DO_TP(...) \
31+
# define _CONDITIONAL_DO_TP(...) \
3232
do_tracepoint(ros2, __VA_ARGS__)
3333
#else
34-
# define CONDITIONAL_TP(...) ((void) (0))
35-
# define CONDITIONAL_TP_ENABLED(...) false
36-
# define CONDITIONAL_DO_TP(...) ((void) (0))
34+
# define _CONDITIONAL_TP(...) ((void) (0))
35+
# define _CONDITIONAL_TP_ENABLED(...) false
36+
# define _CONDITIONAL_DO_TP(...) ((void) (0))
3737
#endif
3838

3939
#define TRACEPOINT_ARGS(...) __VA_ARGS__
@@ -42,28 +42,28 @@
4242
#define DEFINE_TRACEPOINT(event_name, _TP_PARAMS, _TP_ARGS) \
4343
void TRACETOOLS_TRACEPOINT(event_name, _TP_PARAMS) \
4444
{ \
45-
CONDITIONAL_TP(event_name, _TP_ARGS); \
45+
_CONDITIONAL_TP(event_name, _TP_ARGS); \
4646
} \
4747
bool TRACETOOLS_TRACEPOINT_ENABLED(event_name) \
4848
{ \
49-
return CONDITIONAL_TP_ENABLED(event_name); \
49+
return _CONDITIONAL_TP_ENABLED(event_name); \
5050
} \
5151
void TRACETOOLS_DO_TRACEPOINT(event_name, _TP_PARAMS) \
5252
{ \
53-
CONDITIONAL_DO_TP(event_name, _TP_ARGS); \
53+
_CONDITIONAL_DO_TP(event_name, _TP_ARGS); \
5454
}
5555
#define DEFINE_TRACEPOINT_NO_ARGS(event_name) \
5656
void TRACETOOLS_TRACEPOINT(event_name) \
5757
{ \
58-
CONDITIONAL_TP(event_name); \
58+
_CONDITIONAL_TP(event_name); \
5959
} \
6060
bool TRACETOOLS_TRACEPOINT_ENABLED(event_name) \
6161
{ \
62-
return CONDITIONAL_TP_ENABLED(event_name); \
62+
return _CONDITIONAL_TP_ENABLED(event_name); \
6363
} \
6464
void TRACETOOLS_DO_TRACEPOINT(event_name) \
6565
{ \
66-
CONDITIONAL_DO_TP(event_name); \
66+
_CONDITIONAL_DO_TP(event_name); \
6767
}
6868

6969
bool ros_trace_compile_status()

0 commit comments

Comments
 (0)