This repository has been archived by the owner on Dec 29, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Suppress invalid stringop-truncation warnings
GCC tries to detect possible losses of the null terminator; see e.g. https://developers.redhat.com/blog/2018/05/24/detecting-string-truncation-with-gcc-8/ In this case we already check if the null terminator is missing, and exit the program, but GCC does not detect this workaround. Just suppress these warnings using #pragma Before ------ Build error on Fedora 31 ``` In file included from /usr/include/string.h:495, from /usr/include/glib-2.0/glib/gtestutils.h:30, from /usr/include/glib-2.0/glib.h:85, from helper.h:18, from helper.c:15: In function 'strncpy', inlined from 'main' at helper.c:404:9: /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'strncpy', inlined from 'main' at helper.c:411:17: /usr/include/bits/string_fortified.h:106:10: error: '__builtin_strncpy' specified bound 100 equals destination size [-Werror=stringop-truncation] 106 | return __builtin___strncpy_chk (__dest, __src, __len, __bos (__dest)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors m ``` After ----- Builds fine
- Loading branch information