aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Oates <andrew@andrewoates.com>2024-10-25 19:35:34 -0400
committerTom Tromey <tromey@adacore.com>2024-11-01 11:13:54 -0600
commit086a2beb152c95ac43ac6b73859eb9e9081fc2df (patch)
tree59a1b5380f59bf31f90b4fe44ed655919e63363f
parent76367d23146136b457b1494285b807437a9fec60 (diff)
downloadbinutils-086a2beb152c95ac43ac6b73859eb9e9081fc2df.zip
binutils-086a2beb152c95ac43ac6b73859eb9e9081fc2df.tar.gz
binutils-086a2beb152c95ac43ac6b73859eb9e9081fc2df.tar.bz2
Fix compile error due to [[noreturn]] with clang
Since commit d9deb60b2e9e94b532f43a7d3ddddf5ddf6dbdd3, 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>
-rw-r--r--gdb/remote-sim.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/gdb/remote-sim.c b/gdb/remote-sim.c
index 67d3f4c..8e2a54f 100644
--- a/gdb/remote-sim.c
+++ b/gdb/remote-sim.c
@@ -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: