From: Paul Eggert Date: Tue, 1 Feb 2022 06:08:56 +0000 (-0800) Subject: maint: suppress bogus noreturn warnings X-Git-Tag: v9.1~71 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=59da65b7fed99d024af1f801cc4a53ca1ca8ee06;p=thirdparty%2Fcoreutils.git 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 --- diff --git a/configure.ac b/configure.ac index bfbc68cf78..453baccff7 100644 --- a/configure.ac +++ b/configure.ac @@ -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=