maint: suppress bogus noreturn warnings

* configure.ac: Move the single-binary code before the
gcc-warnings code, so that the latter can depend on the former.
Suppress -Wsuggest-attribute=noreturn with single binaries,
to avoid diagnostics like the following:
  src/expr.c: In function 'single_binary_main_expr':
  error: function might be candidate for attribute 'noreturn'
Problem reported by Pádraig Brady in:
https://lists.gnu.org/r/coreutils/2022-01/msg00061.html
This commit is contained in:
Paul Eggert
2022-01-31 22:08:56 -08:00
parent 1b552e73e8
commit 59da65b7fe

View File

@@ -84,6 +84,36 @@ AC_DEFUN([gl_GCC_VERSION_IFELSE],
]
)
AC_ARG_ENABLE([single-binary],
[AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
[Compile all the tools in a single binary, reducing the overall size.
When compiled this way, shebangs (default when enabled) or symlinks are
installed for each tool that points to the single binary.])],
[gl_single_binary=no ;
case $enableval in
yes) gl_single_binary=shebangs ;;
no|shebangs|symlinks) gl_single_binary=$enableval ;;
*) AC_MSG_ERROR([bad value $enableval for single-binary option.
Options are: symlinks, shebangs, no.]) ;;
esac],
[gl_single_binary=no]
)
AC_ARG_ENABLE([single-binary-exceptions],
[AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
[When used with --enable-single-binary, exclude the PROG_LIST from
it, so these programs are compiled as separated files
(comma-separated, default none))])],
[gl_single_binary_exceptions=$enableval],
[gl_single_binary_exceptions=]
)
if test "$gl_single_binary" = 'symlinks'; then
if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
AC_MSG_ERROR([program name transformations are not currently supported
with --enable-single-binary=symlinks.])
fi
fi
AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
AC_ARG_ENABLE([gcc-warnings],
[AS_HELP_STRING([--enable-gcc-warnings@<:@=TYPE@:>@],
[control generation of GCC warnings. The TYPE 'no' disables
@@ -148,6 +178,12 @@ if test $gl_gcc_warnings != no; then
nw="$nw -Winline" # system.h's readdir_ignoring_dot_and_dotdot
nw="$nw -Wvector-operation-performance" # warns about randperm.c
# Suppress noreturn warnings with single binaries; otherwise
# GCC complains about the renamed 'main' not being declared noreturn
# because 'main_exit' calls 'exit' when linting.
if test "$gl_single_binary" != no; then
nw="$nw -Wsuggest-attribute=noreturn"
fi
# Using -Wstrict-overflow is a pain, but the alternative is worse.
# For an example, see the code that provoked this report:
@@ -226,36 +262,6 @@ if test $gl_gcc_warnings != no; then
AC_SUBST([GNULIB_TEST_WARN_CFLAGS])
fi
AC_ARG_ENABLE([single-binary],
[AS_HELP_STRING([--enable-single-binary=[shebangs|symlinks]],
[Compile all the tools in a single binary, reducing the overall size.
When compiled this way, shebangs (default when enabled) or symlinks are
installed for each tool that points to the single binary.])],
[gl_single_binary=no ;
case $enableval in
yes) gl_single_binary=shebangs ;;
no|shebangs|symlinks) gl_single_binary=$enableval ;;
*) AC_MSG_ERROR([bad value $enableval for single-binary option.
Options are: symlinks, shebangs, no.]) ;;
esac],
[gl_single_binary=no]
)
AC_ARG_ENABLE([single-binary-exceptions],
[AS_HELP_STRING([--enable-single-binary-exceptions=PROG_LIST],
[When used with --enable-single-binary, exclude the PROG_LIST from
it, so these programs are compiled as separated files
(comma-separated, default none))])],
[gl_single_binary_exceptions=$enableval],
[gl_single_binary_exceptions=]
)
if test "$gl_single_binary" = 'symlinks'; then
if ! test "`echo ls | sed \"$program_transform_name\"`" = 'ls'; then
AC_MSG_ERROR([program name transformations are not currently supported
with --enable-single-binary=symlinks.])
fi
fi
AM_CONDITIONAL([SINGLE_BINARY], [test "$gl_single_binary" != no])
AC_FUNC_FORK
optional_bin_progs=