Skip to content

Commit 09e14a4

Browse files
fingolfinKristofferC
authored andcommitted
Fix "anonymous types declared in an anonymous union" warnings (#44807)
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)
1 parent 7cfc43f commit 09e14a4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/julia.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ typedef struct _jl_line_info_node_t {
233233
intptr_t inlined_at;
234234
} jl_line_info_node_t;
235235

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

395396
// purity results
397+
#ifdef JL_USE_ANON_UNIONS_FOR_PURITY_FLAGS
398+
// see also encode_effects() and decode_effects() in `base/compiler/types.jl`,
396399
union {
397400
uint32_t ipo_purity_bits;
398401
struct {
@@ -413,6 +416,10 @@ typedef struct _jl_code_instance_t {
413416
uint8_t nonoverlayed:1;
414417
} purity_flags;
415418
};
419+
#else
420+
uint32_t ipo_purity_bits;
421+
uint32_t purity_bits;
422+
#endif
416423
jl_value_t *argescapes; // escape information of call arguments
417424

418425
// compilation state cache

0 commit comments

Comments
 (0)