Miscellaneous-NoEmptyStructsΒΆ
Structs/unions must not be empty
Required inputs: IR
sizeof(struct EmptyStruct { }) is 1 in C++,
but 0 in GNU C.
To avoid portability problems, empty structs should be avoided in C code.Possible Messages
Key |
Text |
Severity |
Disabled |
|---|---|---|---|
empty_struct |
Empty struct has undefined behavior |
None |
False |
empty_union |
Empty union has undefined behavior |
None |
False |
struct_without_named |
struct without named members has undefined behavior |
None |
False |
union_without_named |
union without named members has undefined behavior |
None |
False |
Options
This rule shares the following common options: exclude_in_macros, exclude_messages_in_system_headers, excludes, extend_exclude_to_macro_invocations, includes, justification_checker, languages, post_processing, provider, report_at, severity
The following places define options that affect this rule: Stylechecks, Analysis-GlobalOptions
This rule has no individual options.