Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "anonymous types declared in an anonymous union" warnings #44807

Merged
merged 1 commit into from
Apr 10, 2022

Conversation

fingolfin
Copy link
Contributor

They look like this:

    CC src/processor.o
In file included from /Users/mhorn/Projekte/Julia/julia.master/src/processor.cpp:10:
In file included from ./processor.h:5:
./julia.h:395:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:405:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.

and come from code that was introduced by @Keno in PR #43852.

But it turns out that the union is not used at all! So I'm simply removing
the offending union. Perhaps it is needed for some future work, but it should
be trivial to add it back if needed. If that happens, I suggest a comment
is added that explain why this looks similar to but has different layout
compared to the typedef _jl_purity_overrides_t also in julia.h.

@fingolfin
Copy link
Contributor Author

Note that this also affects release-1.8, so ideally it should be backported.

@giordano giordano requested a review from Keno March 31, 2022 12:09
@giordano giordano added the backport 1.8 Change should be backported to release-1.8 label Mar 31, 2022
@giordano
Copy link
Contributor

Related issue: #44314

@fingolfin
Copy link
Contributor Author

Can't this just be merged? There is zero risk, is there? At the worst, reverting it is trivial...

Copy link
Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might want to preserve a comment here? (similar to how we write ssaflags above in the file)

@staticfloat
Copy link
Member

Keno says this is fine, as long as the structure is preserved in a comment, per Jameson's request.

They look like this:
```
    CC src/processor.o
In file included from /Users/mhorn/Projekte/Julia/julia.master/src/processor.cpp:10:
In file included from ./processor.h:5:
./julia.h:395:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:405:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
```
and come from code that was introduced by @Keno in PR JuliaLang#43852.

But it turns out that the union is not used at all! So I'm simply removing
the offending union. Perhaps it is needed for some future work, but it should
be trivial to add it back if needed. If that happens, I suggest a comment
is added that explain why this looks similar to but has different layout
compared to the `typedef _jl_purity_overrides_t` also in `julia.h`.
@fingolfin
Copy link
Contributor Author

I've now retained the union, commented out. I don't know how to make it similar to ssaflags, though.

@DilumAluthge DilumAluthge requested review from vtjnash and Keno and removed request for Keno April 8, 2022 03:24
@staticfloat
Copy link
Member

Yeah, this looks fine to me. Thanks!

@staticfloat staticfloat merged commit bb91e62 into JuliaLang:master Apr 10, 2022
KristofferC pushed a commit that referenced this pull request Apr 19, 2022
They look like this:
```
    CC src/processor.o
In file included from /Users/mhorn/Projekte/Julia/julia.master/src/processor.cpp:10:
In file included from ./processor.h:5:
./julia.h:395:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
./julia.h:405:9: warning: anonymous types declared in an anonymous union are an extension [-Wnested-anon-types]
        struct {
        ^
2 warnings generated.
```
and come from code that was introduced by @Keno in PR #43852.

But it turns out that the union is not used at all! So I'm simply removing
the offending union. Perhaps it is needed for some future work, but it should
be trivial to add it back if needed. If that happens, I suggest a comment
is added that explain why this looks similar to but has different layout
compared to the `typedef _jl_purity_overrides_t` also in `julia.h`.

(cherry picked from commit bb91e62)
@KristofferC KristofferC mentioned this pull request Apr 19, 2022
67 tasks
@KristofferC KristofferC removed the backport 1.8 Change should be backported to release-1.8 label May 26, 2022
@fingolfin fingolfin deleted the mh/fix-anon-anon-warnings branch January 26, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants