From: Simon Marchi <simark@simark.ca>
To: Guinevere Larsen <guinevere@redhat.com>,
Andrew Oates <andrew@andrewoates.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Fix compile error due to [[noreturn]] with clang
Date: Tue, 22 Oct 2024 15:37:27 -0400 [thread overview]
Message-ID: <db8ad156-d18d-424b-8172-398e3fae455f@simark.ca> (raw)
In-Reply-To: <a75a068d-cd4e-4db0-98f8-22479952f20e@redhat.com>
On 2024-10-22 15:10, Guinevere Larsen wrote:
> On 10/22/24 3:50 PM, Andrew Oates wrote:
>>
>>
>> On Tue, Oct 22, 2024 at 2:29 PM Guinevere Larsen <guinevere@redhat.com> wrote:
>>
>> 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.
>>
>>
>> gdb_os_error used to have ATTRIBUTE_NORETURN on it, but that was removed in favor of [[noreturn]] in commit d9deb60b2e9e94b532f43a7d3ddddf5ddf6dbdd3 (which seems to have done ATTRIBUTE_NORETURN -> [[noreturn]] through most of the codebase).
>>
>> I'm definitely not an expert here, but I agree that if there's a way to annotate the function pointer instead so it can be assigned to a [[noreturn]] function, that would be better. I tried doing that but couldn't make it work.
>
> Yeah, [[noreturn]] only works for functions, not meant to be used by members or variables, so this wouldn't work. We have to walk back the [[noreturn]] change for this function if we want to continue adding this information for the compiler.
>
> I added Simon on CC since he's the one who made the original commit you pointed to. My reading seems to be that the patch is meant to modernize the code and isn't driven by an actual need, so I would think walking back this specific change should be ok, but I'll defer to Simon on this.
So, I can't reproduce the build failure when configuring with
`--enable-targets=all --enable-sim`. It looks like remote-sim.o doesn't
get built, which is odd given that the simulator is enabled. Sounds
like a bug?
When building GDB for the ARM target specifically, remote-sim.o does get
built and I see the failure.
Reverting to using the old attribute is fine with me, I don't see any
other way around.
Simon
next prev parent reply other threads:[~2024-10-22 19:37 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
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 [this message]
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=db8ad156-d18d-424b-8172-398e3fae455f@simark.ca \
--to=simark@simark.ca \
--cc=andrew@andrewoates.com \
--cc=gdb-patches@sourceware.org \
--cc=guinevere@redhat.com \
/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