Empty structure size is different between C and C++. To prevent clang warning when compiling this include file in C++ programs, remove empty structures.
Showing the changes to include/linux (1 of 1 file). Show all
Unified · Split
| @@ -1540,10 +1540,14 @@ struct lightbar_program { · 1539 unmodified lines | |||
| 1540 | struct ec_params_lightbar { | 1540 | struct ec_params_lightbar { |
| 1541 | uint8_t cmd; /* Command (see enum lightbar_command) */ | 1541 | uint8_t cmd; /* Command (see enum lightbar_command) */ |
| 1542 | union { | 1542 | union { |
| 1543 | struct { | 1543 | /* |
| 1544 | /* no args */ | 1544 | * The following commands have no args: |
| 1545 | } dump, off, on, init, get_seq, get_params_v0, get_params_v1, | 1545 | * |
| 1546 | version, get_brightness, get_demo, suspend, resume; | 1546 | * dump, off, on, init, get_seq, get_params_v0, get_params_v1, |
| 1547 | * version, get_brightness, get_demo, suspend, resume | ||
| 1548 | * | ||
| 1549 | * Don't use an empty struct, because C++ hates that. | ||
| 1550 | */ | ||
| 1547 | 1551 | ||
| 1548 | struct __ec_todo_unpacked { | 1552 | struct __ec_todo_unpacked { |
| 1549 | uint8_t num; | 1553 | uint8_t num; |
| @@ -1597,11 +1601,13 @@ struct ec_response_lightbar { · 47 unmodified lines | |||
| 1597 | uint8_t red, green, blue; | 1601 | uint8_t red, green, blue; |
| 1598 | } get_rgb; | 1602 | } get_rgb; |
| 1599 | 1603 | ||
| 1600 | struct { | 1604 | /* |
| 1601 | /* no return params */ | 1605 | * The following commands have no response: |
| 1602 | } off, on, init, set_brightness, seq, reg, set_rgb, | 1606 | * |
| 1603 | demo, set_params_v0, set_params_v1, | 1607 | * off, on, init, set_brightness, seq, reg, set_rgb, |
| 1604 | set_program, manual_suspend_ctrl, suspend, resume; | 1608 | * set_params_v0, set_params_v1, set_program, |
| 1609 | * manual_suspend_ctrl, suspend, resume | ||
| 1610 | */ | ||
| 1605 | }; | 1611 | }; |
| 1606 | } __ec_todo_packed; | 1612 | } __ec_todo_packed; |
| 1607 | 1613 | ||
| @@ -3021,9 +3027,7 @@ enum charge_state_params { · 1413 unmodified lines | |||
| 3021 | struct ec_params_charge_state { | 3027 | struct ec_params_charge_state { |
| 3022 | uint8_t cmd; /* enum charge_state_command */ | 3028 | uint8_t cmd; /* enum charge_state_command */ |
| 3023 | union { | 3029 | union { |
| 3024 | struct { | 3030 | /* get_state has no args */ |
| 3025 | /* no args */ | ||
| 3026 | } get_state; | ||
| 3027 | 3031 | ||
| 3028 | struct __ec_todo_unpacked { | 3032 | struct __ec_todo_unpacked { |
| 3029 | uint32_t param; /* enum charge_state_param */ | 3033 | uint32_t param; /* enum charge_state_param */ |
| @@ -3049,9 +3053,8 @@ struct ec_response_charge_state { · 19 unmodified lines | |||
| 3049 | struct __ec_align4 { | 3053 | struct __ec_align4 { |
| 3050 | uint32_t value; | 3054 | uint32_t value; |
| 3051 | } get_param; | 3055 | } get_param; |
| 3052 | struct { | 3056 | |
| 3053 | /* no return values */ | 3057 | /* set_param returns no args */ |
| 3054 | } set_param; | ||
| 3055 | }; | 3058 | }; |
| 3056 | } __ec_align4; | 3059 | } __ec_align4; |
| 3057 | 3060 | ||