summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Peress <peress@google.com>2022-07-12 10:26:06 -0600
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-21 13:29:29 +0000
commitff6ab0a5c2a5b030a9dbfdb4a614a75175f9911d (patch)
tree00fd837b6e04ef209f41e0b909e59202e4eeeded
parent0063d16e0c0daa666c02f48a1fd8036abf3266f5 (diff)
downloadchrome-ec-ff6ab0a5c2a5b030a9dbfdb4a614a75175f9911d.tar.gz
cpp: update headers to better support C++
- Add extern "C" to console.h - Add extern "C" to host_command.h - Update BUILD_HOST_COMMAND since C++ requires fields to be initialized in order BRANCH=none BUG=none TEST=zmake testall Signed-off-by: Yuval Peress <peress@google.com> Change-Id: I88e185346de653811b1ae9250631269b5e7e00d0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3758785 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--include/console.h8
-rw-r--r--include/host_command.h20
2 files changed, 22 insertions, 6 deletions
diff --git a/include/console.h b/include/console.h
index 192e24e8f9..716b70d38f 100644
--- a/include/console.h
+++ b/include/console.h
@@ -16,6 +16,10 @@
#include "zephyr_console_shim.h"
#endif
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/*
* Define uart_shell_stop() and uart_shell_start() functions to start/stop the
* running shell. To avoid having a guard on the build type, non-Zephyr builds
@@ -271,4 +275,8 @@ void console_has_input(void);
#endif /* HAS_TASK_CONSOLE */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __CROS_EC_CONSOLE_H */
diff --git a/include/host_command.h b/include/host_command.h
index 9ebb5989a3..4861e77a35 100644
--- a/include/host_command.h
+++ b/include/host_command.h
@@ -12,6 +12,10 @@
#include "common.h"
#include "ec_commands.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/* Args for host command handler */
struct host_cmd_handler_args {
/*
@@ -359,17 +363,17 @@ stub_send_response_callback(struct host_cmd_handler_args *args)
#define BUILD_HOST_COMMAND(CMD, VERSION, RESPONSE, PARAMS) \
{ \
- .command = (CMD), .version = (VERSION), \
.send_response = stub_send_response_callback, \
- .response_size = 0, \
+ .command = (CMD), .version = (VERSION), \
+ COND_CODE_0(IS_EMPTY(PARAMS), \
+ (.params = &(PARAMS), \
+ .params_size = sizeof(PARAMS)), \
+ (.params = NULL, .params_size = 0)), \
COND_CODE_0(IS_EMPTY(RESPONSE), \
(.response = &(RESPONSE), \
.response_max = sizeof(RESPONSE)), \
(.response = NULL, .response_max = 0)), \
- COND_CODE_0(IS_EMPTY(PARAMS), \
- (.params = &(PARAMS), \
- .params_size = sizeof(PARAMS)), \
- (.params = NULL, .params_size = 0)) \
+ .response_size = 0, \
}
#define BUILD_HOST_COMMAND_RESPONSE(CMD, VERSION, RESPONSE) \
@@ -382,4 +386,8 @@ stub_send_response_callback(struct host_cmd_handler_args *args)
BUILD_HOST_COMMAND(CMD, VERSION, EMPTY, EMPTY)
#endif /* CONFIG_ZTEST */
+#ifdef __cplusplus
+}
+#endif
+
#endif /* __CROS_EC_HOST_COMMAND_H */