On 8/26/25 6:39 AM, Alfie Richards wrote:
The 08/19/2025 14:06, Jason Merrill wrote:
On 8/19/25 4:49 AM, Alfie Richards wrote:
Adds the target_version and target_clones attributes to diagnostic messages
for target_version semantics.
This is because the target_version/target_clones attributes affect the identity
of the decls, so need to be represented in diagnostics for them.
After this change diagnostics look like:
c:
```
test.c:6:8: error: redefinition of ‘foo [[target_version("sve")]]’
6 | float foo () {return 1;}
| ^~~
```
c++:
```
test.cpp:6:8: error: redefinition of ‘[[target_version("sve")]] float foo()’
6 | float foo () {return 1;}
| ^~~
```
This is valid attribute syntax, but I'm not sure why we wouldn't want to put
the attribute immediately after the name for C++ as well?
Happy to change this to match C.
Would you prefer:
redefinition of ‘float foo [[target_version("sve")]] ()’
This one, which applies the attribute to the function.
or
redefinition of ‘float foo() [[target_version("sve")]]’
Not this one, which applies the attribute to the *type* of the function.
Jason
Both look a little awkward to me, but I am happy to go with whatever you prefer.
Thanks,
Alfie
Jason