From: Guinevere Larsen Date: Thu, 5 Jun 2025 19:41:29 +0000 (-0300) Subject: gdb/configure: Fix POSIX non-compliance X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7f1f81d6b2f96f0203df8e9cea1b0b5852b42091;p=thirdparty%2Fbinutils-gdb.git gdb/configure: Fix POSIX non-compliance My recent GDB commit: commit 4b42385c470c5f72f158f382f4d9c36f927aa84f Author: Guinevere Larsen Date: Wed Feb 12 08:25:46 2025 -0300 gdb: Make dwarf support optional at compile time Introduced a change that made the configure script not POSIX compliant, by using fallthrough in some case statements. This commit reworks that part of the change to only use if statements, so that no code is duplicated but things remain POSIX compliant. Reviewed-by: Sam James Approved-By: Tom Tromey --- diff --git a/gdb/configure b/gdb/configure index d0fb74d7cd4..866ddce7af1 100755 --- a/gdb/configure +++ b/gdb/configure @@ -29006,33 +29006,26 @@ else fi -case ${enable_gdb_compile}-${enable_gdb_dwarf_support} in - yes-no) - as_fn_error $? "enabling gdb compile requires dwarf support" "$LINENO" 5 - ;; - default-no) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Defaulting compile support to 'no'" >&5 -$as_echo "$as_me: WARNING: Defaulting compile support to 'no'" >&2;} - # Fallthrough. - ;& - no-*) +if test "${enable_gdb_compile}" = "default"; then + enable_gdb_compile=${enable_gdb_dwarf_support} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Defaulting compile support to '${enable_gdb_dwarf_support}'" >&5 +$as_echo "$as_me: WARNING: Defaulting compile support to '${enable_gdb_dwarf_support}'" >&2;} +fi + +if test "${enable_gdb_compile}" = "yes"; then + if test "${enable_gdb_dwarf_support}" = "no"; then + as_fn_error $? "enabling gdb compile requires dwarf support" "$LINENO" 5 + fi + +$as_echo "#define HAVE_COMPILE 1" >>confdefs.h + + CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)" +else # Even if compile support is not enabled, we need this file to define # the "compile" command. CONFIG_OBS="$CONFIG_OBS compile/compile.o" CONFIG_SRCS="$CONFIG_SRCS compile/compile.c" - ;; - default-yes) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Defaulting compile support to 'yes'" >&5 -$as_echo "$as_me: WARNING: Defaulting compile support to 'yes'" >&2;} - # Fallthrough. - ;& - yes-*) - -$as_echo "#define HAVE_COMPILE 1" >>confdefs.h - - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)" - ;; -esac +fi # ---------------------------- # # Check for source highlight. # diff --git a/gdb/configure.ac b/gdb/configure.ac index 9e418821604..52405f4face 100644 --- a/gdb/configure.ac +++ b/gdb/configure.ac @@ -1250,29 +1250,23 @@ AC_ARG_ENABLE([gdb-compile], [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdb-compile])], [enable_gdb_compile=default]) -case ${enable_gdb_compile}-${enable_gdb_dwarf_support} in - yes-no) - AC_MSG_ERROR([enabling gdb compile requires dwarf support]) - ;; - default-no) - AC_MSG_WARN([Defaulting compile support to 'no']) - # Fallthrough. - ;& - no-*) +if test "${enable_gdb_compile}" = "default"; then + enable_gdb_compile=${enable_gdb_dwarf_support} + AC_MSG_WARN([Defaulting compile support to '${enable_gdb_dwarf_support}']) +fi + +if test "${enable_gdb_compile}" = "yes"; then + if test "${enable_gdb_dwarf_support}" = "no"; then + AC_MSG_ERROR([enabling gdb compile requires dwarf support]) + fi + AC_DEFINE(HAVE_COMPILE, 1, [Define if compiling support to gdb compile.]) + CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)" +else # Even if compile support is not enabled, we need this file to define # the "compile" command. CONFIG_OBS="$CONFIG_OBS compile/compile.o" CONFIG_SRCS="$CONFIG_SRCS compile/compile.c" - ;; - default-yes) - AC_MSG_WARN([Defaulting compile support to 'yes']) - # Fallthrough. - ;& - yes-*) - AC_DEFINE(HAVE_COMPILE, 1, [Define if compiling support to gdb compile.]) - CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GCC_COMPILE_OBS)" - ;; -esac +fi # ---------------------------- # # Check for source highlight. #