Commit 6e933fe3 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

boilerplate/ancillaries: prevent false positive with -Wstringop-truncation

namecpy() is meant to copying NUL terminated strings even if this
incurs potential truncation of the source argument if need be, prevent
GCC 8.x from detecting a false positive when -Wstringop-truncation is
in effect.

Signed-off-by: Philippe Gerum's avatarPhilippe Gerum <>
parent cdc63fe2
......@@ -34,7 +34,7 @@ void __namecpy_requires_character_array_as_destination(void);
({ \
if (!__builtin_types_compatible_p(typeof(__dst), char[])) \
__namecpy_requires_character_array_as_destination(); \
strncpy((__dst), __src, sizeof(__dst) - 1); \
strncpy((__dst), __src, sizeof(__dst)); \
__dst[sizeof(__dst) - 1] = '\0'; \
__dst; \
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment