Add 'extern' statements to public headers for C++ compatibility

This commit is contained in:
Andrew Johnson 2024-07-01 13:30:20 +03:00 committed by Charlie Gordon
parent f9d1029ea3
commit af084de6f9
5 changed files with 41 additions and 1 deletions

View file

@ -29,6 +29,10 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_WIN32) #if defined(_WIN32)
#include <windows.h> #include <windows.h>
#endif #endif
@ -527,4 +531,8 @@ int js_cond_timedwait(js_cond_t *cond, js_mutex_t *mutex, uint64_t timeout);
#endif /* !defined(EMSCRIPTEN) && !defined(__wasi__) */ #endif /* !defined(EMSCRIPTEN) && !defined(__wasi__) */
#ifdef __cplusplus
} /* extern "C" { */
#endif
#endif /* CUTILS_H */ #endif /* CUTILS_H */

View file

@ -27,6 +27,10 @@
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
#ifdef __cplusplus
extern "C" {
#endif
#if INTPTR_MAX >= INT64_MAX && !defined(_WIN32) && !defined(__TINYC__) #if INTPTR_MAX >= INT64_MAX && !defined(_WIN32) && !defined(__TINYC__)
#define LIMB_LOG2_BITS 6 #define LIMB_LOG2_BITS 6
#else #else
@ -532,4 +536,8 @@ static inline int bfdec_resize(bfdec_t *r, limb_t len)
} }
int bfdec_normalize_and_round(bfdec_t *r, limb_t prec1, bf_flags_t flags); int bfdec_normalize_and_round(bfdec_t *r, limb_t prec1, bf_flags_t flags);
#ifdef __cplusplus
} /* extern "C" { */
#endif
#endif /* LIBBF_H */ #endif /* LIBBF_H */

View file

@ -28,6 +28,10 @@
#include "libunicode.h" #include "libunicode.h"
#ifdef __cplusplus
extern "C" {
#endif
#define LRE_BOOL int /* for documentation purposes */ #define LRE_BOOL int /* for documentation purposes */
#define LRE_FLAG_GLOBAL (1 << 0) #define LRE_FLAG_GLOBAL (1 << 0)
@ -84,4 +88,8 @@ static inline int lre_js_is_ident_next(int c)
#undef LRE_BOOL #undef LRE_BOOL
#ifdef __cplusplus
} /* extern "C" { */
#endif
#endif /* LIBREGEXP_H */ #endif /* LIBREGEXP_H */

View file

@ -27,6 +27,10 @@
#include <stddef.h> #include <stddef.h>
#include <inttypes.h> #include <inttypes.h>
#ifdef __cplusplus
extern "C" {
#endif
#define LRE_BOOL int /* for documentation purposes */ #define LRE_BOOL int /* for documentation purposes */
#define LRE_CC_RES_LEN_MAX 3 #define LRE_CC_RES_LEN_MAX 3
@ -115,4 +119,8 @@ int unicode_prop(CharRange *cr, const char *prop_name);
#undef LRE_BOOL #undef LRE_BOOL
#ifdef __cplusplus
} /* extern "C" { */
#endif
#endif /* LIBUNICODE_H */ #endif /* LIBUNICODE_H */

8
list.h
View file

@ -28,6 +28,10 @@
#include <stddef.h> #include <stddef.h>
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
struct list_head { struct list_head {
struct list_head *prev; struct list_head *prev;
struct list_head *next; struct list_head *next;
@ -96,4 +100,8 @@ static inline int list_empty(struct list_head *el)
for(el = (head)->prev, el1 = el->prev; el != (head); \ for(el = (head)->prev, el1 = el->prev; el != (head); \
el = el1, el1 = el->prev) el = el1, el1 = el->prev)
#ifdef __cplusplus
} /* extern "C" { */
#endif
#endif /* LIST_H */ #endif /* LIST_H */