icu
icu copied to clipboard
ICU-21780 suppress stringop-trunction warnings
Currently there are a few stringop-truncation warning generated with gcc 11.2.1, for example:
In file included from ucurr.cpp:25:
In constructor ‘CReg::CReg(const UChar*, const char*)’,
inlined from ‘static const void* CReg::reg(const UChar*,
const char*,
UErrorCode*)’
at ucurr.cpp:397:41,
inlined from ‘const void* ucurr_register_70(const UChar*,
const char*,
UErrorCode*)’
at ucurr.cpp:469:25:
cstring.h:43:70: warning:
‘char* strncpy(char*, const char*, size_t)’ output truncated before
terminating nul copying as many bytes from a string as its length
[-Wstringop-truncation]
43 | #define uprv_strncpy(dst, src, size)
U_STANDARD_CPP_NAMESPACE strncpy(dst, src, size)
ucurr.cpp:387:9: note: in expansion of macro ‘uprv_strncpy’
387 | uprv_strncpy(id, _id, len);
| ^~~~~~~~~~~~
ucurr.cpp: In function ‘const void* ucurr_register_70(const UChar*,
const char*,
UErrorCode*)’:
cstring.h:37:57: note: length computed here
37 | #define uprv_strlen(str) U_STANDARD_CPP_NAMESPACE strlen(str)
ucurr.cpp:381:32: note: in expansion of macro ‘uprv_strlen’
381 | int32_t len = (int32_t)uprv_strlen(_id);
| ^~~~~~~~~~~
This commit adds a GCC ignore for this warnings.
Checklist
- [x] Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-21780
- [x] Required: The PR title must be prefixed with a JIRA Issue number.
- [x] Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
- [x] Required: Each commit message must be prefixed with a JIRA Issue number.
- [X] Issue accepted (done by Technical Committee after discussion)
- [ ] Tests included, if applicable
- [ ] API docs and/or User Guide docs changed or added, if applicable
ping
@FrankYFTang My motivation for attempting to address these issues was because of these warnings showing up on Node.js builds. I'm currently not working on Node.js and won't have any time to pursue this any further I'm afraid. If anyone would like to take over that would be great and if not please feel free to close this PR. Thanks
@FrankYFTang My motivation for attempting to address these issues was because of these warnings showing up on Node.js builds. I'm currently not working on Node.js and won't have any time to pursue this any further I'm afraid. If anyone would like to take over that would be great and if not please feel free to close this PR. Thanks
ok. Thanks for letting me know.