gdb-add-index always generates an error when libdebuginfod wasn't compiled in
[binutils-gdb.git] / gdb / debuginfod-support.c
index 6dc08fc29b6ae00f5a8c64a1512ab9d43ed5f906..5f04a2b38ca25ab3ccb52a1bcdd0a630b7fc9b28 100644 (file)
@@ -193,17 +193,14 @@ debuginfod_is_enabled ()
          if (off == gdb::string_view::npos)
            break;
          url_view = url_view.substr (off);
-#if defined (__s390x__) || defined (__powerpc64__)
-         /* g++ 11.2.1 on s390x and g++ 11.3.1 on ppc64le seem convinced
-            url_view might be of SIZE_MAX length.  And so complains
-            because the length of an array can only be PTRDIFF_MAX.  */
+         /* g++ 11.2.1 on s390x, g++ 11.3.1 on ppc64le and g++ 11 on
+            hppa seem convinced url_view might be of SIZE_MAX length.
+            And so complains because the length of an array can only
+            be PTRDIFF_MAX.  */
          DIAGNOSTIC_PUSH
          DIAGNOSTIC_IGNORE_STRINGOP_OVERREAD
-#endif
          off = url_view.find_first_of (' ');
-#if defined (__s390x__) || defined (__powerpc64__)
          DIAGNOSTIC_POP
-#endif
          gdb_printf
            (_("  <%ps>\n"),
             styled_string (file_name_style.style (),
@@ -371,7 +368,9 @@ set_debuginfod_enabled (const char *value)
 #if defined(HAVE_LIBDEBUGINFOD)
   debuginfod_enabled = value;
 #else
-  error (NO_IMPL);
+  /* Disabling debuginfod when gdb is not built with it is a no-op.  */
+  if (value != debuginfod_off)
+    error (NO_IMPL);
 #endif
 }