Skip to content

Commit 081ddab

Browse files
authored
Merge pull request #1007 from Cyan4973/no_externc_guard
allow removal of extern "C" guards in C++ mode
2 parents ef7e3f4 + 9998b5d commit 081ddab

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ The following macros can be set at compilation time to modify `libxxhash`'s beha
143143
This build flag is useful for embedded environments without dynamic allocation.
144144
- `XXH_memcpy`, `XXH_memset`, `XXH_memcmp` : redirect `memcpy()`, `memset()` and `memcmp()` to some user-selected symbol at compile time.
145145
Redirecting all 3 removes the need to include `<string.h>` standard library.
146+
- `XXH_NO_EXTERNC_GUARD`: When `xxhash.h` is compiled in C++ mode, removes the `extern "C" { .. }` block guard.
146147
- `XXH_DEBUGLEVEL` : When set to any value >= 1, enables `assert()` statements.
147148
This (slightly) slows down execution, but may help finding bugs during debugging sessions.
148149

xxhash.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@
241241
* xxHash prototypes and implementation
242242
*/
243243

244-
#if defined (__cplusplus)
244+
#if defined(__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD)
245245
extern "C" {
246246
#endif
247247

@@ -7338,6 +7338,6 @@ XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed)
73387338
#endif /* XXH_IMPLEMENTATION */
73397339

73407340

7341-
#if defined (__cplusplus)
7341+
#if defined (__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD)
73427342
} /* extern "C" */
73437343
#endif

0 commit comments

Comments
 (0)