]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Apply [noreturn] in more places
authorTom Tromey <tom@tromey.com>
Thu, 15 Jan 2026 17:38:02 +0000 (10:38 -0700)
committerTom Tromey <tom@tromey.com>
Thu, 15 Jan 2026 19:52:43 +0000 (12:52 -0700)
I looked at adding -Wmissing-noreturn to the warning flags.  This
resulted in too many false reports, IMO, so I am not planning to
submit it.

However, it did point out a few spots that legitimately should have
[[noreturn]].

In making this patch, my criterion was to mark up a function whose
contract is that it always throws an exception.  I did not include
functions that just happen to always throw (e.g.,
default_infcall_mmap).  That is, this patch uses the attribute as a
form of documentation and not really for its code-generation
application.

Tested by rebuilding.

Approved-By: Simon Marchi <simon.marchi@efficios.com>
gdb/cli/cli-utils.h
gdb/dwarf2/loc.h
gdb/event-top.h
gdb/exec.h
gdb/extension.h
gdb/gdbcore.h
gdb/infcall.h
gdb/parser-defs.h
gdb/typeprint.h
gdb/utils.h
gdb/value.h

index cc0e880346d2f74c33dea5e01fef64768a20b6ef..1a7cf448ffb61de3c50e425673fd7ba664fca736 100644 (file)
@@ -50,8 +50,8 @@ extern ULONGEST get_ulongest (const char **pp, int trailer = '\0');
 /* Throws an error telling the user that ARGS starts with an option
    unrecognized by COMMAND.  */
 
-extern void report_unrecognized_option_error (const char *command,
-                                             const char *args);
+[[noreturn]] extern void report_unrecognized_option_error (const char *command,
+                                                          const char *args);
 
 
 /* Builds the help string for a command documented by PREFIX,
index f397417c1bccc32abc2546c3e8260e2ddc4bd40c..d175ba679412ee5c862e19d152e422c4af1fd5bb 100644 (file)
@@ -273,7 +273,7 @@ extern int dwarf_reg_to_regnum_or_error (struct gdbarch *arch,
 /* Helper function which throws an error if a synthetic pointer is
    invalid.  */
 
-extern void invalid_synthetic_pointer ();
+[[noreturn]] extern void invalid_synthetic_pointer ();
 
 /* Fetch the value pointed to by a synthetic pointer.  */
 
index eb1226efec0b2bae36819738dc07cffa732c8822..a7d31d56a5d44e7b7d32c2494a23f2864a37ae95 100644 (file)
@@ -64,7 +64,7 @@ extern void set_force_quit_flag ();
 
 /* Control C eventually causes this to be called, at a convenient time.  */
 
-extern void quit ();
+[[noreturn]] extern void quit ();
 
 /* Helper for the QUIT macro.  */
 
index 346d15e1e9842bc9477b390c448404160e29c7ed..98fbfdf2512e680de7ab37b6da74fd3baab7a149 100644 (file)
@@ -108,6 +108,6 @@ extern void try_open_exec_file (const char *exec_file_host,
 
 /* Report a "No executable file specified" error.  */
 
-extern void no_executable_specified_error ();
+[[noreturn]] extern void no_executable_specified_error ();
 
 #endif /* GDB_EXEC_H */
index ee34022450d370693bc66280ae16db110a5ccc31..e351b5b672ed558ca6ba4a28dcf0b7868269749c 100644 (file)
@@ -247,7 +247,7 @@ extern int ext_lang_present_p (const struct extension_language_defn *);
 
 extern int ext_lang_initialized_p (const struct extension_language_defn *);
 
-extern void throw_ext_lang_unsupported
+[[noreturn]] extern void throw_ext_lang_unsupported
   (const struct extension_language_defn *);
 
 /* Accessors for "public" attributes of the extension language definition.  */
index b99109f6696549e01194e2b5aff66a47e37595bd..89586e0c6ecff3a5045ba0321a54dd22e6d9eb16 100644 (file)
@@ -35,7 +35,8 @@ extern int have_core_file_p (void);
 
 /* Report a memory error with error().  */
 
-extern void memory_error (enum target_xfer_status status, CORE_ADDR memaddr);
+[[noreturn]] extern void memory_error (enum target_xfer_status status,
+                                      CORE_ADDR memaddr);
 
 /* The string 'memory_error' would use as exception message.  */
 
index 0ac19213740c904400bca684cfafd6e8823a3be2..9074fecc364b24a3ac192ce1099b275d47773a50 100644 (file)
@@ -69,6 +69,7 @@ extern struct value *
    function to be included in the error message; may be NULL, in which
    case the error message doesn't include a function name.  */
 
-extern void error_call_unknown_return_type (const char *func_name);
+[[noreturn]] extern void error_call_unknown_return_type
+     (const char *func_name);
 
 #endif /* GDB_INFCALL_H */
index 5bea5e7b9c4bbc6d53f6679e2c051fd6f1d43801..cfa9d9c111da017a940f17af4615db5662d49920 100644 (file)
@@ -270,7 +270,7 @@ struct parser_state : public expr_builder
   /* Function called from the various parsers' yyerror functions to throw
      an error.  The error will include a message identifying the location
      of the error within the current expression.  */
-  void parse_error (const char *msg);
+  [[noreturn]] void parse_error (const char *msg);
 
   /* If this is nonzero, this block is used as the lexical context for
      symbol names.  */
index 3bfa1432abce08df4b9d17d179eadea5b3004cc4..36bfbd28743e12e2e76162f44f35bbcea29cb2df 100644 (file)
@@ -207,7 +207,7 @@ void type_print_unknown_return_type (struct ui_file *stream);
 /* Throw an error indicating that the user tried to use a symbol that
    has unknown type.  SYM_PRINT_NAME is the name of the symbol, to be
    included in the error message.  */
-extern void error_unknown_type (const char *sym_print_name);
+[[noreturn]] extern void error_unknown_type (const char *sym_print_name);
 
 extern void val_print_not_allocated (struct ui_file *stream);
 
index f11e85559cccd6077b9d91176b5a58f432ce2fee..531fae083d7a54076db22c0378227dac165fcbab 100644 (file)
@@ -327,7 +327,7 @@ extern void warn_cant_dump_core (const char *reason);
 /* Dump core trying to increase the core soft limit to hard limit
    first.  */
 
-extern void dump_core (void);
+[[noreturn]] extern void dump_core ();
 
 /* Copy NBITS bits from SOURCE to DEST starting at the given bit
    offsets.  Use the bit order as specified by BITS_BIG_ENDIAN.
index 8dc3192f637d7616d6a7baa0f0b3287df66c4f8a..1ef3acd60549eb3edd4d4bea0cc4bbd02d9b8915 100644 (file)
@@ -977,7 +977,7 @@ struct lval_funcs
 /* Throw an error complaining that the value has been optimized
    out.  */
 
-extern void error_value_optimized_out (void);
+[[noreturn]] extern void error_value_optimized_out ();
 
 /* Pointer to internal variable.  */
 #define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ()))