Skip to content

Commit

Permalink
Fix "anonymous types declared in an anonymous union" warnings (#44807)
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
fingolfin authored and KristofferC committed Apr 19, 2022
1 parent 7cfc43f commit 09e14a4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/julia.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ typedef struct _jl_line_info_node_t {
intptr_t inlined_at;
} jl_line_info_node_t;

// the following mirrors `struct EffectsOverride` in `base/compiler/types.jl`
typedef union __jl_purity_overrides_t {
struct {
uint8_t ipo_consistent : 1;
Expand Down Expand Up @@ -393,6 +394,8 @@ typedef struct _jl_code_instance_t {
//TODO: uint8_t absolute_max; // whether true max world is unknown

// purity results
#ifdef JL_USE_ANON_UNIONS_FOR_PURITY_FLAGS
// see also encode_effects() and decode_effects() in `base/compiler/types.jl`,
union {
uint32_t ipo_purity_bits;
struct {
Expand All @@ -413,6 +416,10 @@ typedef struct _jl_code_instance_t {
uint8_t nonoverlayed:1;
} purity_flags;
};
#else
uint32_t ipo_purity_bits;
uint32_t purity_bits;
#endif
jl_value_t *argescapes; // escape information of call arguments

// compilation state cache
Expand Down

0 comments on commit 09e14a4

Please sign in to comment.