gdb, gdbserver, gdbsupport: use [[noreturn]] instead of ATTRIBUTE_NORETURN

C++ 11 has a built-in attribute for this, no need to use a compat macro.

Change-Id: I90e4220d26e8f3949d91761f8a13cd9c37da3875
Reviewed-by: Lancelot Six <lancelot.six@amd.com>
This commit is contained in:
Simon Marchi 2024-07-16 16:02:12 -04:00
parent 9153eb8a7f
commit d9deb60b2e
26 changed files with 75 additions and 80 deletions

View File

@ -876,7 +876,7 @@ extern void cmd_show_list (struct cmd_list_element *, int);
/* Used everywhere whenever at least one parameter is required and
none is specified. */
extern void error_no_arg (const char *) ATTRIBUTE_NORETURN;
[[noreturn]] extern void error_no_arg (const char *);
/* Command line saving and repetition.

View File

@ -2253,7 +2253,7 @@ dwarf2_get_symbol_read_needs (gdb::array_view<const gdb_byte> expr,
/* A helper function that throws an unimplemented error mentioning a
given DWARF operator. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
unimplemented (unsigned int op)
{
const char *name = get_DW_OP_name (op);

View File

@ -894,7 +894,7 @@ unblock_signal (int sig)
/* Called to handle fatal signals. SIG is the signal number. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
handle_fatal_signal (int sig)
{
#ifdef TUI

View File

@ -326,32 +326,32 @@ extern SCM gdbscm_make_type_error (const char *subr, int arg_pos,
extern SCM gdbscm_make_invalid_object_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_invalid_object_error (const char *subr, int arg_pos,
SCM bad_value, const char *error)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_invalid_object_error (const char *subr,
int arg_pos,
SCM bad_value,
const char *error);
extern SCM gdbscm_make_out_of_range_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_out_of_range_error (const char *subr, int arg_pos,
SCM bad_value, const char *error)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_out_of_range_error (const char *subr,
int arg_pos, SCM bad_value,
const char *error);
extern SCM gdbscm_make_misc_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_misc_error (const char *subr, int arg_pos,
SCM bad_value, const char *error)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_misc_error (const char *subr, int arg_pos,
SCM bad_value, const char *error);
extern void gdbscm_throw (SCM exception) ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_throw (SCM exception);
struct gdbscm_gdb_exception;
extern SCM gdbscm_scm_from_gdb_exception
(const gdbscm_gdb_exception &exception);
extern void gdbscm_throw_gdb_exception (gdbscm_gdb_exception exception)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_throw_gdb_exception
(gdbscm_gdb_exception exception);
extern void gdbscm_print_exception_with_stack (SCM port, SCM stack,
SCM key, SCM args);
@ -368,8 +368,8 @@ extern excp_matcher_func gdbscm_user_error_p;
extern SCM gdbscm_make_memory_error (const char *subr, const char *msg,
SCM args);
extern void gdbscm_memory_error (const char *subr, const char *msg, SCM args)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void gdbscm_memory_error (const char *subr,
const char *msg, SCM args);
/* scm-safe-call.c */

View File

@ -1544,7 +1544,7 @@ decode_line_2 (struct linespec_state *self,
/* Throw an appropriate error when SYMBOL is not found (optionally in
FILENAME). */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
symbol_not_found_error (const char *symbol, const char *filename)
{
if (symbol == NULL)
@ -1586,7 +1586,7 @@ symbol_not_found_error (const char *symbol, const char *filename)
/* Throw an appropriate error when an unexpected token is encountered
in the input. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
unexpected_linespec_error (linespec_parser *parser)
{
linespec_token token;
@ -1613,7 +1613,7 @@ unexpected_linespec_error (linespec_parser *parser)
/* Throw an undefined label error. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
undefined_label_error (const char *function, const char *label)
{
if (function != NULL)
@ -1628,7 +1628,7 @@ undefined_label_error (const char *function, const char *label)
/* Throw a source file not found error. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
source_file_not_found_error (const char *name)
{
throw_error (NOT_FOUND_ERROR, _("No source file named %s."), name);

View File

@ -31,7 +31,7 @@
/* Helper function to display various possible errors when reading
MTE tags. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
aarch64_mte_linux_peek_error (int error)
{
switch (error)
@ -53,7 +53,7 @@ aarch64_mte_linux_peek_error (int error)
/* Helper function to display various possible errors when writing
MTE tags. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
aarch64_mte_linux_poke_error (int error)
{
switch (error)

View File

@ -84,13 +84,12 @@ extern void gdb_flush_out_err ();
/* Report an error that happened when starting to trace the inferior
(i.e., when the "traceme_fun" callback is called on fork_inferior)
and bail out. This function does not return. */
extern void trace_start_error (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
[[noreturn]] extern void trace_start_error (const char *fmt, ...)
ATTRIBUTE_PRINTF (1, 2);
/* Like "trace_start_error", but the error message is constructed by
combining STRING with the system error message for errno. This
function does not return. */
extern void trace_start_error_with_name (const char *string)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void trace_start_error_with_name (const char *string);
#endif /* NAT_FORK_INFERIOR_H */

View File

@ -548,7 +548,7 @@ mnsh_handle_readlink (int sock, const char *filename)
/* The helper process. Never returns. Must be async-signal-safe. */
static void mnsh_main (int sock) ATTRIBUTE_NORETURN;
[[noreturn]] static void mnsh_main (int sock);
static void
mnsh_main (int sock)

View File

@ -948,7 +948,7 @@ private:
int gdbpy_print_python_errors_p (void);
void gdbpy_print_stack (void);
void gdbpy_print_stack_or_quit ();
void gdbpy_handle_exception () ATTRIBUTE_NORETURN;
[[noreturn]] void gdbpy_handle_exception ();
/* A wrapper around calling 'error'. Prefixes the error message with an
'Error occurred in Python' string. Use this in C++ code if we spot
@ -958,8 +958,7 @@ void gdbpy_handle_exception () ATTRIBUTE_NORETURN;
This always calls error, and never returns. */
void gdbpy_error (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
[[noreturn]] void gdbpy_error (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
gdbpy_ref<> python_string_to_unicode (PyObject *obj);
gdb::unique_xmalloc_ptr<char> unicode_to_target_string (PyObject *unicode_str);

View File

@ -69,8 +69,7 @@ static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
static void gdb_os_error (host_callback *, const char *, ...)
ATTRIBUTE_NORETURN;
[[noreturn]] static void gdb_os_error (host_callback *, const char *, ...);
/* Naming convention:

View File

@ -1539,7 +1539,7 @@ static void remote_console_output (const char *msg, ui_file *stream);
static void remote_btrace_reset (remote_state *rs);
static void remote_unpush_and_throw (remote_target *target);
[[noreturn]] static void remote_unpush_and_throw (remote_target *target);
/* For "remote". */
@ -6150,7 +6150,7 @@ remote_unpush_target (remote_target *target)
fileio_handles_invalidate_target (target);
}
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
remote_unpush_and_throw (remote_target *target)
{
remote_unpush_target (target);

View File

@ -2439,7 +2439,7 @@ lookup_symbol_in_objfile_from_linkage_name (struct objfile *objfile,
/* A helper function that throws an exception when a symbol was found
in a psymtab but not in a symtab. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
error_in_psymtab_expansion (enum block_enum block_index, const char *name,
struct compunit_symtab *cust)
{

View File

@ -56,7 +56,7 @@
#include "cli/cli-decode.h"
#include "cli/cli-style.h"
static void generic_tls_error (void) ATTRIBUTE_NORETURN;
[[noreturn]] static void generic_tls_error (void);
static void default_rcmd (struct target_ops *, const char *, struct ui_file *);
@ -64,7 +64,7 @@ static int default_verify_memory (struct target_ops *self,
const gdb_byte *data,
CORE_ADDR memaddr, ULONGEST size);
static void tcomplain (void) ATTRIBUTE_NORETURN;
[[noreturn]] static void tcomplain (void);
/* Mapping between target_info objects (which have address identity)
and corresponding open/factory function/callback. Each add_target

View File

@ -2490,7 +2490,7 @@ extern int default_memory_insert_breakpoint (struct gdbarch *,
extern void initialize_targets (void);
extern void noprocess (void) ATTRIBUTE_NORETURN;
[[noreturn]] extern void noprocess (void);
extern void target_require_runnable (void);

View File

@ -24,7 +24,7 @@
/* See tid-parse.h. */
void ATTRIBUTE_NORETURN
[[noreturn]] void
invalid_thread_id_error (const char *string)
{
error (_("Invalid thread ID: %s"), string);

View File

@ -26,7 +26,7 @@ struct thread_info;
/* Issue an invalid thread ID error, pointing at STRING, the invalid
ID. */
extern void ATTRIBUTE_NORETURN invalid_thread_id_error (const char *string);
[[noreturn]] extern void invalid_thread_id_error (const char *string);
/* Parse TIDSTR as a per-inferior thread ID, in either INF_NUM.THR_NUM
or THR_NUM form. In the latter case, the missing INF_NUM is filled

View File

@ -42,7 +42,7 @@ extern void read_command_file (FILE *);
extern void init_history (void);
extern void command_loop (void);
extern int quit_confirm (void);
extern void quit_force (int *, int) ATTRIBUTE_NORETURN;
[[noreturn]] extern void quit_force (int *, int);
extern void quit_command (const char *, int);
extern void quit_cover (void);
extern void execute_command (const char *, int);

View File

@ -192,7 +192,7 @@ verror (const char *string, va_list args)
/* Emit a message and abort. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
abort_with_message (const char *msg)
{
if (current_ui == NULL)

View File

@ -93,8 +93,8 @@ struct gdb_xml_parser
ATTRIBUTE_PRINTF (2, 0);
/* Issue an error message, and stop parsing. */
void verror (const char *format, va_list ap)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
[[noreturn]] void verror (const char *format, va_list ap)
ATTRIBUTE_PRINTF (2, 0);
void body_text (const XML_Char *text, int length);
void start_element (const XML_Char *name, const XML_Char **attrs);

View File

@ -191,8 +191,9 @@ void gdb_xml_debug (struct gdb_xml_parser *parser, const char *format, ...)
/* Issue an error message from one of PARSER's handlers, and stop
parsing. */
void gdb_xml_error (struct gdb_xml_parser *parser, const char *format, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
[[noreturn]] void gdb_xml_error (struct gdb_xml_parser *parser,
const char *format, ...)
ATTRIBUTE_PRINTF (2, 3);
/* Find the attribute named NAME in the set of parsed attributes
ATTRIBUTES. Returns NULL if not found. */

View File

@ -421,7 +421,7 @@ gdbreplay_usage (FILE *stream)
/* Main function. This is called by the real "main" function,
wrapped in a TRY_CATCH that handles any uncaught exceptions. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
captured_main (int argc, char *argv[])
{
FILE *fp;

View File

@ -4038,7 +4038,7 @@ test_memory_tagging_functions (void)
/* Main function. This is called by the real "main" function,
wrapped in a TRY_CATCH that handles any uncaught exceptions. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
captured_main (int argc, char *argv[])
{
int bad_attach;

View File

@ -31,7 +31,7 @@
the filesystem of small embedded targets with core files. If in
development mode however, abort, producing core files to help with
debugging GDBserver. */
static void ATTRIBUTE_NORETURN
[[noreturn]] static void
abort_or_exit ()
{
#ifdef DEVELOPMENT

View File

@ -191,7 +191,7 @@ throw_exception (gdb_exception &&exception)
gdb_assert_not_reached ("invalid return reason");
}
static void ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0)
[[noreturn]] static void ATTRIBUTE_PRINTF (3, 0)
throw_it (enum return_reason reason, enum errors error, const char *fmt,
va_list ap)
{

View File

@ -336,27 +336,26 @@ struct gdb_quit_bad_alloc
/* Throw an exception (as described by "struct gdb_exception"),
landing in the inner most containing exception handler established
using TRY/CATCH. */
extern void throw_exception (gdb_exception &&exception)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void throw_exception (gdb_exception &&exception);
/* Throw an exception by executing a LONG JUMP to the inner most
containing exception handler established using TRY_SJLJ. Necessary
in some cases where we need to throw GDB exceptions across
third-party library code (e.g., readline). */
extern void throw_exception_sjlj (const struct gdb_exception &exception)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void throw_exception_sjlj (const gdb_exception &exception);
/* Convenience wrappers around throw_exception that throw GDB
errors. */
extern void throw_verror (enum errors, const char *fmt, va_list ap)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 0);
extern void throw_vquit (const char *fmt, va_list ap)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 0);
extern void throw_error (enum errors error, const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
extern void throw_quit (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
extern void throw_forced_quit (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
[[noreturn]] extern void throw_verror (enum errors, const char *fmt,
va_list ap)
ATTRIBUTE_PRINTF (2, 0);
[[noreturn]] extern void throw_vquit (const char *fmt, va_list ap)
ATTRIBUTE_PRINTF (1, 0);
[[noreturn]] extern void throw_error (enum errors error, const char *fmt, ...)
ATTRIBUTE_PRINTF (2, 3);
[[noreturn]] extern void throw_quit (const char *fmt, ...)
ATTRIBUTE_PRINTF (1, 2);
[[noreturn]] [[noreturn]] extern void throw_forced_quit (const char *fmt, ...)
ATTRIBUTE_PRINTF (1, 2);
#endif /* COMMON_COMMON_EXCEPTIONS_H */

View File

@ -36,11 +36,10 @@ extern void vwarning (const char *fmt, va_list args)
a printf- or vprintf-style argument list. These functions do not
return. The function "verror" must be provided by the client. */
extern void error (const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 2);
[[noreturn]] extern void error (const char *fmt, ...) ATTRIBUTE_PRINTF (1, 2);
extern void verror (const char *fmt, va_list args)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (1, 0);
[[noreturn]] extern void verror (const char *fmt, va_list args)
ATTRIBUTE_PRINTF (1, 0);
/* An internal error was detected. Internal errors indicate
programming errors such as assertion failures, as opposed to
@ -53,16 +52,16 @@ extern void verror (const char *fmt, va_list args)
automatically. The function "internal_verror" must be provided
by the client. */
extern void internal_error_loc (const char *file, int line,
const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 4);
[[noreturn]] extern void internal_error_loc (const char *file, int line,
const char *fmt, ...)
ATTRIBUTE_PRINTF (3, 4);
#define internal_error(fmt, ...) \
internal_error_loc (__FILE__, __LINE__, fmt, ##__VA_ARGS__)
extern void internal_verror (const char *file, int line,
const char *fmt, va_list args)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (3, 0);
[[noreturn]] extern void internal_verror (const char *file, int line,
const char *fmt, va_list args)
ATTRIBUTE_PRINTF (3, 0);
/* An internal problem was detected, but the requested operation can
still proceed. Internal warnings indicate programming errors as
@ -93,14 +92,13 @@ extern std::string perror_string (const char *prefix, int errnum = 0);
STRING with the system error message for errno. If ERRNUM is given,
then use it in place of errno. This function does not return. */
extern void perror_with_name (const char *string, int errnum = 0)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void perror_with_name (const char *string, int errnum = 0);
/* Call this function to handle memory allocation failures. This
function does not return. This function must be provided by the
client. */
extern void malloc_failure (long size) ATTRIBUTE_NORETURN;
[[noreturn]] extern void malloc_failure (long size);
/* Flush stdout and stderr. Must be provided by the client. */
@ -124,8 +122,8 @@ extern const char *strwinerror (ULONGEST error);
including STRING and the system text for the given error
number. */
extern void throw_winerror_with_name (const char *string, ULONGEST err)
ATTRIBUTE_NORETURN;
[[noreturn]] extern void throw_winerror_with_name (const char *string,
ULONGEST err);
#endif /* USE_WIN32API */