Skip to content

  • Projects
  • Groups
  • Snippets
  • Help
  • This project
    • Loading...
  • Sign in / Register
B
benchmark
  • Project
    • Overview
    • Details
    • Activity
    • Cycle Analytics
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Charts
  • Issues 0
    • Issues 0
    • List
    • Board
    • Labels
    • Milestones
  • Merge Requests 0
    • Merge Requests 0
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Charts
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Chen Yisong
  • benchmark
  • Repository

Switch branch/tag
  • benchmark
  • src
  • timers.cc
Find file
BlameHistoryPermalink
  • Chris Lalancette's avatar
    Shrink the tz_offset size to 41. (#1110) · 07578d82
    Chris Lalancette authored Apr 09, 2021
    When building with gcc TSan on, and in Debug mode, we see a warning
    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);
          |   ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    While this is essentially a false positive (we never expect
    the number of bytes in tz_offset to be too large), the compiler can't
    actually tell that.  Shrink the size of tz_offset to a smaller, but still safe
    size to eliminate this warning.
    Signed-off-by: 's avatarChris Lalancette <clalancette@openrobotics.org>
    07578d82
timers.cc 8.66 KB
EditWeb IDE
×

Replace timers.cc

Attach a file by drag & drop or click to upload


Cancel
A new branch will be created in your fork and a new merge request will be started.