mirror of
https://github.com/osmarks/ngircd.git
synced 2025-01-31 17:49:11 +00:00
Disable GCC -Wformat-truncation when suported
Pass -Wno-format-truncation when this is supported by GCC so silence warnings like this: conf.c: In function ‘Read_Config’: conf.c:985:60: warning: ‘snprintf’ output may be truncated before the last format character [-Wformat-truncation=] 985 | snprintf(file, sizeof(file), "%s/%s", | ^ conf.c:985:25: note: ‘snprintf’ output 2 or more bytes (assuming 257) into a destination of size 256 985 | snprintf(file, sizeof(file), "%s/%s", | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 986 | Conf_IncludeDir, entry->d_name); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The warning is correct, but this is basically why we use snprintf() in the first place.
This commit is contained in:
parent
d702ebab0a
commit
1d527eaf17
13
configure.ng
13
configure.ng
@ -125,6 +125,18 @@ main(int argc, char **argv)
|
|||||||
])
|
])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
AC_DEFUN([GCC_W_NO_FORMAT_TRUNC],[
|
||||||
|
result=yes
|
||||||
|
AC_MSG_CHECKING([whether ${CC} accepts -Wno-format-truncation])
|
||||||
|
old_cflags="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -Wno-format-truncation"
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],[],[result=no])
|
||||||
|
echo $result
|
||||||
|
if test "X$result" = "Xno"; then
|
||||||
|
CFLAGS="$old_cflags"
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
|
||||||
# -- Hard coded system and compiler dependencies/features/options ... --
|
# -- Hard coded system and compiler dependencies/features/options ... --
|
||||||
|
|
||||||
if test "$GCC" = "yes"; then
|
if test "$GCC" = "yes"; then
|
||||||
@ -132,6 +144,7 @@ if test "$GCC" = "yes"; then
|
|||||||
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
|
CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
|
||||||
|
|
||||||
GCC_STACK_PROTECT_CC
|
GCC_STACK_PROTECT_CC
|
||||||
|
GCC_W_NO_FORMAT_TRUNC
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
|
Loading…
Reference in New Issue
Block a user