Message ID | 20181012013637.10220-1-suyj.fnst@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | btrfs-progs: fix compile warning when using gcc8 to compile btrfs-progs | expand |
On Fri, Oct 12, 2018 at 09:36:37AM +0800, Su Yanjun wrote: > When using gcc8 compiles utils.c, it complains as below: > > utils.c:852:45: warning: '%s' directive output may be truncated writing > up to 4095 bytes into a region of size 4084 [-Wformat-truncation=] > snprintf(path, sizeof(path), "/dev/mapper/%s", name); > ^~ ~~~~ > In file included from /usr/include/stdio.h:873, > from utils.c:20: > /usr/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' > output between 13 and 4108 bytes into a destination of size 4096 > return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > __bos (__s), __fmt, __va_arg_pack ()); > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > This isn't a type of warning we care about, particularly when PATH_MAX > is much less than either. > > Using the GCC option -Wno-format-truncation to disable this. Disabling for the default build is probably ok, but I'd rather keep the warning in the extended set that's defined in Makefile.extrawarn. Please update the patch and also pick a more specific subject line, there's another patch with exactly same text but completely different set of changes. Thanks.
diff --git a/configure.ac b/configure.ac index df02f20655d9..c626beca8b77 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ LIBBTRFS_MAJOR=0 LIBBTRFS_MINOR=1 LIBBTRFS_PATCHLEVEL=2 -CFLAGS=${CFLAGS:-"-g -O1 -Wall -D_FORTIFY_SOURCE=2"} +CFLAGS=${CFLAGS:-"-g -O1 -Wall -D_FORTIFY_SOURCE=2 -Wno-format-truncation"} AC_SUBST([CFLAGS]) AC_PREREQ([2.60])
When using gcc8 compiles utils.c, it complains as below: utils.c:852:45: warning: '%s' directive output may be truncated writing up to 4095 bytes into a region of size 4084 [-Wformat-truncation=] snprintf(path, sizeof(path), "/dev/mapper/%s", name); ^~ ~~~~ In file included from /usr/include/stdio.h:873, from utils.c:20: /usr/include/bits/stdio2.h:67:10: note: '__builtin___snprintf_chk' output between 13 and 4108 bytes into a destination of size 4096 return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This isn't a type of warning we care about, particularly when PATH_MAX is much less than either. Using the GCC option -Wno-format-truncation to disable this. Signed-off-by: Su Yanjun <suyj.fnst@cn.fujitsu.com> --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)