[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [PATCH] lib/{fdt, ukdebug, uksched, vfscore}: add "extern C" to header files
Reviewed-by: Simon Kuenzer <simon.kuenzer@xxxxxxxxx> On 06.09.2018 13:50, Florian Schmidt wrote: Some header files were missing C linkage declarations, leading to linker errors when using a C++ application. Two remarks: * for lib/uksched/include/uk/wait_types.h, also reordered the initialization of uk_waitq_entry members in DEFINE_WAIT to follow the layout of the struct. This otherwise produces compiler errors about non-trivial initializers when used with g++. * for libfdt, strictly speaking, only libfdt.h needs the "extern C", because the other two header files don't declare functions for external use. But it also doesn't hurt, and better safe than sorry in case someone adds any at a later point. Signed-off-by: Florian Schmidt <florian.schmidt@xxxxxxxxx> --- lib/fdt/include/fdt.h | 8 ++++++++ lib/fdt/include/libfdt.h | 8 ++++++++ lib/fdt/include/libfdt_env.h | 8 ++++++++ lib/ukdebug/include/uk/assert.h | 8 ++++++++ lib/ukdebug/include/uk/hexdump.h | 9 +++++++++ lib/ukdebug/include/uk/print.h | 8 ++++++++ lib/uksched/include/uk/wait.h | 7 +++++++ lib/uksched/include/uk/wait_types.h | 10 +++++++++- lib/vfscore/include/vfscore/file.h | 8 ++++++++ 9 files changed, 73 insertions(+), 1 deletion(-) diff --git a/lib/fdt/include/fdt.h b/lib/fdt/include/fdt.h index 526aedb..eba829a 100644 --- a/lib/fdt/include/fdt.h +++ b/lib/fdt/include/fdt.h @@ -52,6 +52,10 @@ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */+#ifdef __cplusplus+extern "C" { +#endif + #ifndef __ASSEMBLY__struct fdt_header {@@ -108,4 +112,8 @@ struct fdt_property { #define FDT_V16_SIZE FDT_V3_SIZE #define FDT_V17_SIZE (FDT_V16_SIZE + sizeof(fdt32_t))+#ifdef __cplusplus+} +#endif + #endif /* _FDT_H */ diff --git a/lib/fdt/include/libfdt.h b/lib/fdt/include/libfdt.h index a248b1b..05dedbd 100644 --- a/lib/fdt/include/libfdt.h +++ b/lib/fdt/include/libfdt.h @@ -54,6 +54,10 @@ #include <libfdt_env.h> #include <fdt.h>+#ifdef __cplusplus+extern "C" { +#endif + #define FDT_FIRST_SUPPORTED_VERSION 0x10 #define FDT_LAST_SUPPORTED_VERSION 0x11@@ -1865,4 +1869,8 @@ int fdt_overlay_apply(void *fdt, void *fdto); const char *fdt_strerror(int errval); +#ifdef __cplusplus+} +#endif + #endif /* _LIBFDT_H */ diff --git a/lib/fdt/include/libfdt_env.h b/lib/fdt/include/libfdt_env.h index 952056c..6c41fb6 100644 --- a/lib/fdt/include/libfdt_env.h +++ b/lib/fdt/include/libfdt_env.h @@ -57,6 +57,10 @@ #include <stdlib.h> #include <string.h>+#ifdef __cplusplus+extern "C" { +#endif + #ifdef __CHECKER__ #define FDT_FORCE __attribute__((force)) #define FDT_BITWISE __attribute__((bitwise)) @@ -109,4 +113,8 @@ static inline fdt64_t cpu_to_fdt64(uint64_t x) #undef CPU_TO_FDT16 #undef EXTRACT_BYTE+#ifdef __cplusplus+} +#endif + #endif /* _LIBFDT_ENV_H */ diff --git a/lib/ukdebug/include/uk/assert.h b/lib/ukdebug/include/uk/assert.h index 09001fb..e623536 100644 --- a/lib/ukdebug/include/uk/assert.h +++ b/lib/ukdebug/include/uk/assert.h @@ -44,6 +44,10 @@ #include <uk/print.h> #include <uk/config.h>+#ifdef __cplusplus+extern "C" { +#endif + #if CONFIG_LIBUKDEBUG_ENABLE_ASSERT #define UK_ASSERT(x) \ do { \ @@ -86,4 +90,8 @@ ukplat_terminate(UKPLAT_CRASH); \ } while (0)+#ifdef __cplusplus+} +#endif + #endif /* __UKDEBUG_ASSERT_H__ */ diff --git a/lib/ukdebug/include/uk/hexdump.h b/lib/ukdebug/include/uk/hexdump.h index 4d32647..5539eed 100644 --- a/lib/ukdebug/include/uk/hexdump.h +++ b/lib/ukdebug/include/uk/hexdump.h @@ -41,6 +41,10 @@ #include <stdio.h> #include <uk/print.h>+#ifdef __cplusplus+extern "C" { +#endif + #define UK_HXDF_ADDR (1) /* show address column */ #define UK_HXDF_ASCIISEC (2) /* show ascii section */@@ -214,4 +218,9 @@ int uk_hexdumpsn(char *str, size_t size, const void *data, size_t len,(UK_HXDF_ADDR | UK_HXDF_ASCIISEC | UK_HXDF_GRPQWORD \ | UK_HXDF_COMPRESS), \ 2, NULL) + +#ifdef __cplusplus +} +#endif + #endif /* __UKDEBUG_HEXDUMP_H__ */ diff --git a/lib/ukdebug/include/uk/print.h b/lib/ukdebug/include/uk/print.h index c5c5557..965082c 100644 --- a/lib/ukdebug/include/uk/print.h +++ b/lib/ukdebug/include/uk/print.h @@ -42,6 +42,10 @@ #include <uk/essentials.h> #include <uk/config.h>+#ifdef __cplusplus+extern "C" { +#endif + #ifdef __IN_LIBUKDEBUG__ /* * These defines are doing the trick to compile the functions @@ -151,4 +155,8 @@ static inline void uk_printd(int lvl __unused, const char *fmt __unused, ...) uk_printd((dlvl), (fmt), ##__VA_ARGS__); \ } while (0)+#ifdef __cplusplus+} +#endif + #endif /* __UKDEBUG_PRINT_H__ */ diff --git a/lib/uksched/include/uk/wait.h b/lib/uksched/include/uk/wait.h index 7ec5a20..905ba38 100644 --- a/lib/uksched/include/uk/wait.h +++ b/lib/uksched/include/uk/wait.h @@ -31,6 +31,9 @@ #include <uk/sched.h> #include <uk/wait_types.h>+#ifdef __cplusplus+extern "C" { +#endifstatic inlinevoid uk_waitq_init(struct uk_waitq *wq) @@ -135,4 +138,8 @@ void uk_waitq_wake_up(struct uk_waitq *wq) ukplat_lcpu_restore_irqf(flags); }+#ifdef __cplusplus+} +#endif + #endif /* __UK_SCHED_WAIT_H__ */ diff --git a/lib/uksched/include/uk/wait_types.h b/lib/uksched/include/uk/wait_types.h index 1ef5959..209e493 100644 --- a/lib/uksched/include/uk/wait_types.h +++ b/lib/uksched/include/uk/wait_types.h @@ -28,6 +28,10 @@#include <uk/list.h> +#ifdef __cplusplus+extern "C" { +#endif + struct uk_waitq_entry { int waiting; struct uk_thread *thread; @@ -44,8 +48,12 @@ UK_STAILQ_HEAD(uk_waitq, struct uk_waitq_entry);#define DEFINE_WAIT(name) \struct uk_waitq_entry name = { \ - .thread = uk_thread_current(), \ .waiting = 0, \ + .thread = uk_thread_current(), \ +} + +#ifdef __cplusplus } +#endif#endif /* __UK_SCHED_WAIT_TYPES_H__ */diff --git a/lib/vfscore/include/vfscore/file.h b/lib/vfscore/include/vfscore/file.h index 2c3d72b..978c81f 100644 --- a/lib/vfscore/include/vfscore/file.h +++ b/lib/vfscore/include/vfscore/file.h @@ -39,6 +39,10 @@ #include <stdint.h> #include <sys/types.h>+#ifdef __cplusplus+extern "C" { +#endif + struct vfscore_file;struct vfscore_fops {@@ -57,4 +61,8 @@ void vfscore_put_fd(int fd); void vfscore_install_fd(int fd, struct vfscore_file *file); struct vfscore_file *vfscore_get_file(int fd);+#ifdef __cplusplus+} +#endif + #endif /* __VFSCORE_FILE_H__ */ _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |