From 5fac73a9f6e18d504a9ade6623a081d2969d9cf6 Mon Sep 17 00:00:00 2001 From: TaeminYeom Date: Wed, 24 Aug 2022 18:15:03 +0900 Subject: [PATCH] Add extern "C" keyword in header files Change-Id: Ie16f5ec1d1c18f5e20cd94d46ad63a3ad7ac58fc Signed-off-by: TaeminYeom (cherry picked from commit 52e7d17a5203b8b042989aa6d689d994835feb5a) --- src/libcommon/common.h | 8 ++++++++ src/libcommon/file.h | 8 ++++++++ src/libcommon/ini-parser.h | 9 +++++++++ src/libcommon/list.h | 8 ++++++++ src/libgdbus/dbus-iface-system.h | 7 +++++++ src/libgdbus/libgdbus.h | 8 +++++++- src/shared/log-macro.h | 9 +++++++++ src/shared/log.h | 8 ++++++++ 8 files changed, 64 insertions(+), 1 deletion(-) diff --git a/src/libcommon/common.h b/src/libcommon/common.h index 057bad4..178be64 100644 --- a/src/libcommon/common.h +++ b/src/libcommon/common.h @@ -19,6 +19,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Check if running on emulator * @@ -33,4 +37,8 @@ bool libsys_is_emulator(void); */ bool libsys_is_container(void); +#ifdef __cplusplus +} +#endif + #endif /* __LIBCOMMON_COMMON_H__ */ diff --git a/src/libcommon/file.h b/src/libcommon/file.h index 7154494..6622dfc 100644 --- a/src/libcommon/file.h +++ b/src/libcommon/file.h @@ -20,6 +20,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + /** * @brief Open file, read and close * @@ -92,4 +96,8 @@ int sys_set_str(char *fname, char *val); */ int libsys_parse_cmdline_scanf(const char *format, ...); +#ifdef __cplusplus +} +#endif + #endif /* __LIBCOMMON_FILE_H__ */ diff --git a/src/libcommon/ini-parser.h b/src/libcommon/ini-parser.h index 7af9f42..35e7480 100644 --- a/src/libcommon/ini-parser.h +++ b/src/libcommon/ini-parser.h @@ -25,6 +25,10 @@ #define MATCH(a, b) (!strncmp(a, b, strlen(a))) #define SET_CONF(a, b) (a = (b > 0.0 ? b : a)) +#ifdef __cplusplus +extern "C" { +#endif + struct parse_result { char *section; union { @@ -63,4 +67,9 @@ int config_parse(const char *file_name, int cb(struct parse_result *result, * @return 0 on success, negative if failed */ int libsys_config_parse_by_section(const char *file_name, int cb(const struct parse_result *, void *), void *user_data); + +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/libcommon/list.h b/src/libcommon/list.h index ab27843..d45dbec 100644 --- a/src/libcommon/list.h +++ b/src/libcommon/list.h @@ -21,6 +21,10 @@ #include +#ifdef __cplusplus +extern "C" { +#endif + #define SYS_G_LIST_PREPEND(a, b) \ a = g_list_prepend(a, (gpointer)b) #define SYS_G_LIST_APPEND(a, b) \ @@ -56,5 +60,9 @@ #define SYS_G_LIST_NEXT(a) \ g_list_next(a) +#ifdef __cplusplus +} +#endif + #endif diff --git a/src/libgdbus/dbus-iface-system.h b/src/libgdbus/dbus-iface-system.h index a5b838e..1096a78 100644 --- a/src/libgdbus/dbus-iface-system.h +++ b/src/libgdbus/dbus-iface-system.h @@ -19,6 +19,10 @@ #ifndef __DBUS_SYSTEM_IFACE_H__ #define __DBUS_SYSTEM_IFACE_H__ +#ifdef __cplusplus +extern "C" { +#endif + /* * Template * @@ -338,5 +342,8 @@ /* End of the Experimental for Specific device */ /***********************************************/ +#ifdef __cplusplus +} +#endif #endif diff --git a/src/libgdbus/libgdbus.h b/src/libgdbus/libgdbus.h index 6828b76..85e2ed0 100644 --- a/src/libgdbus/libgdbus.h +++ b/src/libgdbus/libgdbus.h @@ -28,6 +28,10 @@ #include "dbus-iface-system.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct { const unsigned char *data; int size; @@ -270,6 +274,8 @@ GVariant *gdbus_make_simple_array (const char *sig, int check_systemd_active (void); - +#ifdef __cplusplus +} +#endif #endif diff --git a/src/shared/log-macro.h b/src/shared/log-macro.h index 8532b37..6792243 100644 --- a/src/shared/log-macro.h +++ b/src/shared/log-macro.h @@ -20,6 +20,10 @@ #ifndef __LOG_MACRO_H__ #define __LOG_MACRO_H__ +#ifdef __cplusplus +extern "C" { +#endif + #ifdef ENABLE_DLOG #include #define _D(fmt, arg...) \ @@ -48,4 +52,9 @@ #define _SW(...) do { } while (0) #define _SE(...) do { } while (0) #endif + +#ifdef __cplusplus +} #endif + +#endif /* __LOG_MACRO_H__ */ diff --git a/src/shared/log.h b/src/shared/log.h index ad914a3..c5ee0fd 100644 --- a/src/shared/log.h +++ b/src/shared/log.h @@ -20,6 +20,10 @@ #ifndef __LOG_H__ #define __LOG_H__ +#ifdef __cplusplus +extern "C" { +#endif + #ifdef ENABLE_LIBDEVICED_DLOG #define ENABLE_DLOG #endif @@ -27,4 +31,8 @@ #define LOG_TAG "LIBSYSCOMMON" #include "shared/log-macro.h" +#ifdef __cplusplus +} #endif + +#endif /* __LOG_H__ */ -- 2.34.1