]> git.ipfire.org Git - thirdparty/ccache.git/commit
Fix minitrace.c compilation error with GCC 7.3
authorJoel Rosdahl <joel@rosdahl.net>
Mon, 22 Apr 2019 13:22:07 +0000 (15:22 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Mon, 22 Apr 2019 13:22:07 +0000 (15:22 +0200)
commit0f5f9c3b50feafd053166e0577d2b71cdd1b03d9
tree93cff7bfbb4f8cfa2ebeb401bcde7d9017edd243
parent61c65322dce2f4f6ac82205aeddced2429a69a8b
Fix minitrace.c compilation error with GCC 7.3

The error/warning looks like this:

src/minitrace.c: In function ‘mtr_flush’:
src/minitrace.c:256:54: error: ‘%.*s’ directive output may be truncated writing up to 700 bytes into a region of size 252 [-Werror=format-truncation=]
     snprintf(arg_buf, ARRAY_SIZE(arg_buf), "\"%s\":\"%.*s\"", raw->arg_name, 700, raw->a_str);
                                                      ^~~~
In file included from /usr/include/stdio.h:862:0,
                 from src/minitrace.c:9:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:64:10: note: ‘__builtin___snprintf_chk’ output 6 or more bytes (assuming 706) into a destination of size 256
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/minitrace.c