On Sun, 28 Sep 2025, Alfie Richards wrote:
> Hi Joseph and Marek (or anyone else knowledgeable in the C front-end),
>
> I'm attempting to implement these diagnostics at the moment but I am
> struggling to find an implementation.
>
> The issue is for situations like:
>
> ```c
> int fn(void) asm ("name");
>
> int fn [[gnu::target_version("sve")]] (void) {
> ...
> }
> ```
>
> At the time of maybe_apply_renaming_pragma we have not processed
> target_version so cannot emit an error.
>
> At time of processing the target_version attribute, I cannot find a way to
> detect the previous decl was renamed to diagnose.
Checking DECL_ASSEMBLER_NAME_SET_P on the previous decl should work. Or
if you need to distinguish being set by the user from being set internally
by the compiler, also check IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME
(decl))[0] != '*' (I think).
--
Joseph S. Myers
[email protected]