Fix stringop-truncation GCC9 warning.
GCC9's stringop-truncation warning isn't happy about having the destination and the bound of a strncpy being equal since the resulting string will not be NULL-terminated: ~~~ src/aarch64/instrument-aarch64.cc: In constructor ‘vixl::aarch64::Counter::Counter(const char*, vixl::aarch64::CounterType)’: src/aarch64/instrument-aarch64.cc:35:10: error: ‘char* strncpy(char*, const char*, size_t)’ specified bound 256 equals destination size [-Werror=stringop-truncation] 35 | strncpy(name_, name, kCounterNameMaxLength); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~ However, we manually NULL-terminate right after so we're actually fine. It doesn't hurt to fix the warning though by reducing the bound by 1. See the third paragraph from https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/Warning-Options.html#index-Wstringop-truncation Change-Id: I74d37dbe13c0d04da9a24c71bc6ef6a92e8333ce
Loading
Please register or sign in to comment