Move `extern "C" specifications for C++ to where they are needed

This should fix errors when compiling C++ code with modules enabled on clang.
This commit is contained in:
Kaspar M. Rohrer
2025-03-29 23:51:20 +01:00
committed by Qi Wang
parent 3688dfb5c3
commit 80e9001af3
3 changed files with 16 additions and 6 deletions

View File

@@ -6,9 +6,6 @@ cat <<EOF
#ifndef JEMALLOC_H_ #ifndef JEMALLOC_H_
#define JEMALLOC_H_ #define JEMALLOC_H_
#pragma GCC system_header #pragma GCC system_header
#ifdef __cplusplus
extern "C" {
#endif
EOF EOF
@@ -21,8 +18,5 @@ for hdr in jemalloc_defs.h jemalloc_rename.h jemalloc_macros.h \
done done
cat <<EOF cat <<EOF
#ifdef __cplusplus
}
#endif
#endif /* JEMALLOC_H_ */ #endif /* JEMALLOC_H_ */
EOF EOF

View File

@@ -3,6 +3,10 @@
* of namespace management, and should be omitted in application code unless * of namespace management, and should be omitted in application code unless
* JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle@install_suffix@.h). * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle@install_suffix@.h).
*/ */
#ifdef __cplusplus
extern "C" {
#endif
extern JEMALLOC_EXPORT const char *@je_@malloc_conf; extern JEMALLOC_EXPORT const char *@je_@malloc_conf;
extern JEMALLOC_EXPORT const char *@je_@malloc_conf_2_conf_harder; extern JEMALLOC_EXPORT const char *@je_@malloc_conf_2_conf_harder;
extern JEMALLOC_EXPORT void (*@je_@malloc_message)(void *cbopaque, extern JEMALLOC_EXPORT void (*@je_@malloc_message)(void *cbopaque,
@@ -79,3 +83,7 @@ JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
void JEMALLOC_SYS_NOTHROW *@je_@pvalloc(size_t size) JEMALLOC_CXX_THROW void JEMALLOC_SYS_NOTHROW *@je_@pvalloc(size_t size) JEMALLOC_CXX_THROW
JEMALLOC_ATTR(malloc); JEMALLOC_ATTR(malloc);
#endif #endif
#ifdef __cplusplus
}
#endif

View File

@@ -1,3 +1,7 @@
#ifdef __cplusplus
extern "C" {
#endif
typedef struct extent_hooks_s extent_hooks_t; typedef struct extent_hooks_s extent_hooks_t;
/* /*
@@ -75,3 +79,7 @@ struct extent_hooks_s {
extent_split_t *split; extent_split_t *split;
extent_merge_t *merge; extent_merge_t *merge;
}; };
#ifdef __cplusplus
}
#endif