]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/configure: Fix POSIX non-compliance
authorGuinevere Larsen <guinevere@redhat.com>
Thu, 5 Jun 2025 19:41:29 +0000 (16:41 -0300)
committerGuinevere Larsen <guinevere@redhat.com>
Fri, 6 Jun 2025 15:05:16 +0000 (12:05 -0300)
My recent GDB commit:

    commit 4b42385c470c5f72f158f382f4d9c36f927aa84f
    Author: Guinevere Larsen <guinevere@redhat.com>
    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 <sam@gentoo.org>
Approved-By: Tom Tromey <tom@tromey.com>
gdb/configure
gdb/configure.ac

index d0fb74d7cd481fbca542277f7267de275146f115..866ddce7af17a37d3caddb78236e054815a4cb96 100755 (executable)
@@ -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.  #
index 9e41882160401a1642e8f894355d32b65671133c..52405f4face10f93ab1f6f0d2bb22a8a415a8f04 100644 (file)
@@ -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.  #