Skip to content

Commit

Permalink
suppress false positive from clang-tidy
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodall <william@osrfoundation.org>
  • Loading branch information
wjwwood committed Mar 16, 2022
1 parent cae279a commit 9359573
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions rcl/src/rcl/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,11 @@ static
void
rcl_logging_ext_lib_output_handler(
const rcutils_log_location_t * location,
int severity, const char * name, rcutils_time_point_value_t timestamp,
const char * format, va_list * args)
int severity,
const char * name,
rcutils_time_point_value_t timestamp,
const char * format,
va_list * args)
{
rcl_ret_t status;
char msg_buf[1024] = "";
Expand All @@ -188,7 +191,9 @@ rcl_logging_ext_lib_output_handler(
};

va_list args_clone;
va_copy(args_clone, *args);
// The args are initialized, but clang-tidy cannot tell.
// It may be related to this bug: https://bugs.llvm.org/show_bug.cgi?id=41311
va_copy(args_clone, *args); // NOLINT(clang-analyzer-valist.Uninitialized)
status = rcutils_char_array_vsprintf(&msg_array, format, args_clone);
va_end(args_clone);

Expand Down
11 changes: 8 additions & 3 deletions rcl/src/rcl/logging_rosout.c
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,11 @@ rcl_ret_t rcl_logging_rosout_fini_publisher_for_node(

void rcl_logging_rosout_output_handler(
const rcutils_log_location_t * location,
int severity, const char * name, rcutils_time_point_value_t timestamp,
const char * format, va_list * args)
int severity,
const char * name,
rcutils_time_point_value_t timestamp,
const char * format,
va_list * args)
{
rosout_map_entry_t entry;
rcl_ret_t status = RCL_RET_OK;
Expand All @@ -251,7 +254,9 @@ void rcl_logging_rosout_output_handler(
};

va_list args_clone;
va_copy(args_clone, *args);
// The args are initialized, but clang-tidy cannot tell.
// It may be related to this bug: https://bugs.llvm.org/show_bug.cgi?id=41311
va_copy(args_clone, *args); // NOLINT(clang-analyzer-valist.Uninitialized)
RCL_RET_FROM_RCUTIL_RET(status, rcutils_char_array_vsprintf(&msg_array, format, args_clone));
va_end(args_clone);
if (RCL_RET_OK != status) {
Expand Down

0 comments on commit 9359573

Please sign in to comment.