From: Guinevere Larsen <guinevere@redhat.com>
To: andrew@andrewoates.com, gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix compile error due to [[noreturn]] with clang
Date: Tue, 22 Oct 2024 15:28:58 -0300 [thread overview]
Message-ID: <e91823db-1b71-4aea-a372-844a355432e9@redhat.com> (raw)
In-Reply-To: <20241020180001.67425-1-andrew@andrewoates.com>
On 10/20/24 3:00 PM, andrew@andrewoates.com wrote:
> From: Andrew Oates <andrew@andrewoates.com>
>
> 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. Removing ATTTRIBUTE_NORETURN on the
> declaration of host_callback::error resolves the issue.
Have you tried using ATTRIBUTE_NORETURN for gdb_os_error instead? If the
problem is the mismatch, I would prefer that we made them match over
removing information for the compiler.
Also, from my little knowledge in this area, this sounds like a clang
bug. I encourage you to report it to upstream clang, or I can do it
myself if you'd prefer.
--
Cheers,
Guinevere Larsen
She/Her/Hers
>
> 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).
> ---
> include/sim/callback.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/sim/callback.h b/include/sim/callback.h
> index f69f783abac..045ac3411af 100644
> --- a/include/sim/callback.h
> +++ b/include/sim/callback.h
> @@ -129,7 +129,7 @@ struct host_callback_struct
> In the case of gdb "exiting" means doing a longjmp back to the main
> command loop. */
> void (*error) (host_callback *, const char *, ...)
> - ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_2;
> + ATTRIBUTE_PRINTF_2;
>
> int last_errno; /* host format */
>
next prev parent reply other threads:[~2024-10-22 18:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-20 18:00 andrew
2024-10-22 18:28 ` Guinevere Larsen [this message]
2024-10-22 18:50 ` Andrew Oates
2024-10-22 19:10 ` Guinevere Larsen
2024-10-22 19:25 ` Andrew Oates
2024-10-22 19:37 ` Simon Marchi
2024-10-22 20:20 ` Andreas Schwab
2024-10-22 20:37 ` Simon Marchi
2024-10-22 20:53 ` Andreas Schwab
2024-10-24 0:40 ` Andrew Oates
2024-10-25 15:36 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e91823db-1b71-4aea-a372-844a355432e9@redhat.com \
--to=guinevere@redhat.com \
--cc=andrew@andrewoates.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox