[clang] [Clang][Sema]: Allow flexible arrays in unions and alone in structs (PR #84428)

Kees Cook via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 11 16:22:25 PDT 2024


kees wrote:

> There are currently over 200 separate unions using the work-around.

Specifically, this is what Linux uses for getting C99 flexible arrays in unions and alone in structs:

```
#define DECLARE_FLEX_ARRAY(TYPE, NAME)        \
        struct { \
                struct { } __empty_ ## NAME; \
                TYPE NAME[]; \
        }
```

The conversion from the "struct hack" to C99 flexible arrays is complete, except for this wart.

https://github.com/llvm/llvm-project/pull/84428


More information about the cfe-commits mailing list