Skip to content

Commit

Permalink
allow removal of extern "C" guards in C++ mode
Browse files Browse the repository at this point in the history
using new build macro XXH_NO_EXTERNC_GUARD
  • Loading branch information
Cyan4973 committed Jan 29, 2025
1 parent ef7e3f4 commit 9998b5d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ The following macros can be set at compilation time to modify `libxxhash`'s beha
This build flag is useful for embedded environments without dynamic allocation.
- `XXH_memcpy`, `XXH_memset`, `XXH_memcmp` : redirect `memcpy()`, `memset()` and `memcmp()` to some user-selected symbol at compile time.
Redirecting all 3 removes the need to include `<string.h>` standard library.
- `XXH_NO_EXTERNC_GUARD`: When `xxhash.h` is compiled in C++ mode, removes the `extern "C" { .. }` block guard.
- `XXH_DEBUGLEVEL` : When set to any value >= 1, enables `assert()` statements.
This (slightly) slows down execution, but may help finding bugs during debugging sessions.

Expand Down
4 changes: 2 additions & 2 deletions xxhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
* xxHash prototypes and implementation
*/

#if defined (__cplusplus)
#if defined(__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD)
extern "C" {
#endif

Expand Down Expand Up @@ -7338,6 +7338,6 @@ XXH3_generateSecret_fromSeed(XXH_NOESCAPE void* secretBuffer, XXH64_hash_t seed)
#endif /* XXH_IMPLEMENTATION */


#if defined (__cplusplus)
#if defined (__cplusplus) && !defined(XXH_NO_EXTERNC_GUARD)
} /* extern "C" */
#endif

0 comments on commit 9998b5d

Please sign in to comment.