mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-23 01:53:38 +08:00
Fix compile error due to [[noreturn]] with clang
Since commit d9deb60b2e
, I get the
following compiler error when building binutils (cross-compiling) on
macos:
CXX remote-sim.o
../../gdb/remote-sim.c:334:28: error: assigning to 'void (*)(host_callback *, const char *, ...) __attribute__((noreturn))' (aka 'void (*)(host_callback_struct *, const char *, ...) __attribute__((noreturn))') from incompatible type 'void (host_callback
*, const char *, ...)' (aka 'void (host_callback_struct *, const char *, ...)')
gdb_callback.error = gdb_os_error;
^~~~~~~~~~~~
1 error generated.
This appears to be due to the mismatch between ATTRIBUTE_NORETURN and
[[noreturn]] on gdb_os_error. Reverting the change for gdb_os_error
resolves the issue. Removing ATTTRIBUTE_NORETURN on the
declaration of host_callback::error also works, but deprives the
compiler of data.
Tested by compiling on macos both with the system clang, as well as with
GCC 14. With clang, remote-sim.c does not compile (per above) without
this patch. With GCC, it compiles with and without the patch (it
doesn't link, but AFAICT that is unrelated).
The clang bug is reported upstream at
https://github.com/llvm/llvm-project/issues/113511
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
parent
76367d2314
commit
086a2beb15
@ -69,7 +69,8 @@ static void gdb_os_vprintf_filtered (host_callback *, const char *, va_list);
|
||||
|
||||
static void gdb_os_evprintf_filtered (host_callback *, const char *, va_list);
|
||||
|
||||
[[noreturn]] static void gdb_os_error (host_callback *, const char *, ...);
|
||||
static void gdb_os_error (host_callback *, const char *, ...)
|
||||
ATTRIBUTE_NORETURN;
|
||||
|
||||
/* Naming convention:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user