diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-11-08 09:31:32 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-11-08 12:19:30 +0100 |
commit | f0f1ae6e9fd7f8d2a5b64909071f3321b5eada4d (patch) | |
tree | 3bd4b5cea1aa45334b4a65bf551e8fcf2efebddb /soltools | |
parent | 9d7db7316ab2f3d1a6e578625d743e6004292fb4 (diff) |
Silence GCC 8.2.1 -Werror=format-truncation=
After 09841225fc055f8270cee3059253f923dd544797 "soltools: fix
-Werror=format-overflow" changed the sprintf into an snprintf, at least the
Fedora 29 "gcc (GCC) 8.2.1 20181011 (Red Hat 8.2.1-4)" now complains about
> [C ] soltools/mkdepend/include.c
> soltools/mkdepend/include.c: In function ‘remove_dotdot.constprop’:
> soltools/mkdepend/include.c:246:42: error: ‘snprintf’ output may be truncated before the last format character [-Werror=format-truncation=]
> int n = snprintf(buf, BUFSIZ, "%s%s%s", dir, *dir ? "/" : "", component);
> ^
> soltools/mkdepend/include.c:246:13: note: ‘snprintf’ output 1 or more bytes (assuming 8193) into a destination of size 8192
> int n = snprintf(buf, BUFSIZ, "%s%s%s", dir, *dir ? "/" : "", component);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This all looks not very helpful, lets limit the silencing to just GCC 8.2 (in
the hopes that later versions of GCC won't emit that warning any more, anyway).
Change-Id: I006964e4f32bbb52b6b90288e2d623797b8d38ea
Reviewed-on: https://gerrit.libreoffice.org/63068
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'soltools')
-rw-r--r-- | soltools/mkdepend/include.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/soltools/mkdepend/include.c b/soltools/mkdepend/include.c index 26a237bc827e..f47b9d8efeab 100644 --- a/soltools/mkdepend/include.c +++ b/soltools/mkdepend/include.c @@ -243,7 +243,15 @@ int issymbolic(char *dir, char *component) struct stat st; char buf[ BUFSIZ ], **pp; +#if defined __GNUC__ && __GNUC__ == 8 && __GNUC_MINOR__ == 2 && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wformat-truncation" + // silence "‘snprintf’ output may be truncated before the last format character" +#endif int n = snprintf(buf, BUFSIZ, "%s%s%s", dir, *dir ? "/" : "", component); +#if defined __GNUC__ && __GNUC__ == 8 && __GNUC_MINOR__ == 2 && !defined __clang__ +#pragma GCC diagnostic pop +#endif assert(n < BUFSIZ); (void) n; for (pp=notdotdot; *pp; pp++) |