File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2424# include <stdio.h>
2525# include <stdlib.h>
2626
27+ // This is to avoid compilation warnings in C++ with ' -Wold-style-cast' .
28+ # ifdef __cplusplus
29+ # define RCUTILS_CAST_DURATION(x) (static_cast < rcutils_duration_value_t > (x))
30+ # else
31+ # define RCUTILS_CAST_DURATION(x) ((rcutils_duration_value_t)x)
32+ # endif
33+
2734# ifdef __cplusplus
2835extern " C"
2936{
@@ -174,7 +181,7 @@ typedef bool (* RclLogFilter)();
174181 * A macro initializing and checking the ` throttle ` condition.
175182 */
176183# define RCUTILS_LOG_CONDITION_THROTTLE_BEFORE(get_time_point_value, duration) { \
177- static rcutils_duration_value_t __rcutils_logging_duration = RCUTILS_MS_TO_NS ((rcutils_duration_value_t) duration); \
184+ static rcutils_duration_value_t __rcutils_logging_duration = RCUTILS_MS_TO_NS (RCUTILS_CAST_DURATION ( duration) ); \
178185 static rcutils_time_point_value_t __rcutils_logging_last_logged = 0 ; \
179186 rcutils_time_point_value_t __rcutils_logging_now = 0 ; \
180187 bool __rcutils_logging_condition = true ; \
You can’t perform that action at this time.
0 commit comments