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

Shrink the size of the tz_offset variable. #13

Merged
merged 1 commit into from
Apr 9, 2021

Conversation

clalancette
Copy link
Contributor

This will fix a warning when building under TSan like:

benchmark/src/timers.cc: In function ‘std::string benchmark::LocalDateTimeString()’:
src/timers.cc:241:15: warning: ‘char* strncat(char*, const char*, size_t)’ output may be truncated copying 108 bytes from a string of length 127 [-Wstringop-truncation]
241 | std::strncat(storage, tz_offset, sizeof(storage) - timestamp_len - 1);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See also google/benchmark#1110 , where
this change was merged upstream.

Signed-off-by: Chris Lalancette clalancette@openrobotics.org

This will fix a warning when building under TSan like:

benchmark/src/timers.cc: In function ‘std::string benchmark::LocalDateTimeString()’:
src/timers.cc:241:15: warning: ‘char* strncat(char*, const char*, size_t)’ output may be truncated copying 108 bytes from a string of length 127 [-Wstringop-truncation]
241 | std::strncat(storage, tz_offset, sizeof(storage) - timestamp_len - 1);
| ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

See also google/benchmark#1110 , where
this change was merged upstream.

Signed-off-by: Chris Lalancette <clalancette@openrobotics.org>
@clalancette
Copy link
Contributor Author

This should fix the one warning we are seeing in https://ci.ros2.org/view/nightly/job/nightly_linux_thread_sanitizer/744/gcc/ .

Here's normal CI:

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

And here is a TSan job:

  • Linux TSan Build Status

@clalancette
Copy link
Contributor Author

The warnings on Linux and macOS are unrelated, and should be solved by ros2/rmw_cyclonedds#300 . Windows is green, so going ahead and merging this one.

@clalancette clalancette merged commit 5300f46 into main Apr 9, 2021
@clalancette clalancette deleted the clalancette/shrink-tz_offset-size branch April 9, 2021 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants