Files
OpenCellular/util
Randall Spangler 7d2ce0c47e ec_commands: Remove zero-size structs
The size of empty structs (and unions) varies between C and C++.  When
including in C++ code our external API in ec_commands.h header with
extern "C".  clang will complain (correctly) for all empty structs:
       error: empty struct has size 0 in C, size 1 in C++
       [-Werror,-Wextern-c-compat]

Remove them from the ec_commands.h header file.

ectool.c has some ugly macros which assume subcommands have both
requests and responses.  Change those macros so they only reference
the non-empty sub-structs.  The macros are still ugly, but generate
identical output, and don't rely upon zero-length structs.

BUG=chromium:792408
BRANCH=none
TEST=manual

	1) Compile the following using 'clang -Wall -Werror':

	   #include <stdint.h>
	   extern "C" {
	   #include "include/ec_commands.h"
	   }
	   int main(void) { return 0; }

	   It compiles without error.

	2) Copy the lb_command_paramcount, ms_command_sizes, and
	   cs_paramcount globals from ectool.c to a dummy .c file and
	   compile with 'gcc -S' to generate assembly.  Do the same
	   after applying this patch.

	   Confirm the arrays have the same contents.

Change-Id: Iad76f10315b97205b42118ce070463071fe97128
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/820649
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-12-13 12:33:37 -08:00
..
2017-03-01 05:04:04 -08:00
2016-06-02 17:02:51 -07:00
2013-07-01 16:14:16 -07:00
2015-06-18 19:07:00 +00:00
2015-12-08 12:28:57 -08:00
2016-02-10 18:19:24 -08:00
2017-12-13 12:33:37 -08:00
2012-11-01 14:09:34 -07:00
2017-12-06 20:24:14 -08:00
2016-02-05 06:02:49 -08:00
2014-02-17 17:35:43 +00:00
2017-06-28 21:50:50 -07:00
2014-01-15 04:52:54 +00:00
2017-09-15 08:46:32 -07:00
2016-02-05 06:02:49 -08:00