Skip to content

Commit

Permalink
[WIP] test Clang build against regulator.h
Browse files Browse the repository at this point in the history
Use unnamed union/struct in struct regulator to overcome Clang
being very strict as built with on -Wgnu-variable-sized-type-not-at-end.

Details at OP-TEE#6486.

Signed-off-by: Etienne Carriere <[email protected]>
  • Loading branch information
etienne-lms committed Nov 23, 2023
1 parent f3d285d commit a930c38
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions core/include/drivers/regulator.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,13 @@ struct regulator {
unsigned int refcount;
struct mutex lock; /* Concurrent access protection */
struct voltages_fallback {
struct regulator_voltages desc;
int levels[3];
union {
struct regulator_voltages desc;
struct {
uint8_t hdr[sizeof(struct regulator_voltages)];
int levels[3];
};
};
} voltages_fallback;
size_t levels_count_fallback;
SLIST_ENTRY(regulator) link;
Expand Down

0 comments on commit a930c38

Please sign in to comment.