diff --git a/Makefile b/Makefile index 2b548372..65dcf65d 100644 --- a/Makefile +++ b/Makefile @@ -332,14 +332,15 @@ c90test: xxhash.c $(RM) xxhash.o endif +.PHONY: noxxh3test noxxh3test: CPPFLAGS += -DXXH_NO_XXH3 noxxh3test: CFLAGS += -Werror -pedantic -Wno-long-long # XXH64 requires long long support +noxxh3test: OFILE = xxh_noxxh3.o noxxh3test: xxhash.c @echo ---- test compilation without XXH3 ---- - $(RM) xxhash.o - $(CC) $(FLAGS) $^ -c - $(NM) xxhash.o | $(GREP) XXH3_ ; test $$? -eq 1 - $(RM) xxhash.o + $(CC) $(FLAGS) -c $^ -o $(OFILE) + $(NM) $(OFILE) | $(GREP) XXH3_ ; test $$? -eq 1 + $(RM) $(OFILE) .PHONY: usan usan: CC=clang @@ -387,7 +388,7 @@ preview-man: man .PHONY: test test: DEBUGFLAGS += -DXXH_DEBUGLEVEL=1 -test: all namespaceTest check test-xxhsum-c c90test test-tools +test: all namespaceTest check test-xxhsum-c c90test test-tools noxxh3test .PHONY: test-inline test-inline: diff --git a/xxhash.h b/xxhash.h index e28231d7..9a7900e2 100644 --- a/xxhash.h +++ b/xxhash.h @@ -728,6 +728,8 @@ typedef struct { unsigned char digest[sizeof(XXH64_hash_t)]; } XXH64_canonical_t XXH_PUBLIC_API void XXH64_canonicalFromHash(XXH64_canonical_t* dst, XXH64_hash_t hash); XXH_PUBLIC_API XXH64_hash_t XXH64_hashFromCanonical(const XXH64_canonical_t* src); +#ifndef XXH_NO_XXH3 + /*! * @} * ************************************************************************ @@ -935,6 +937,7 @@ XXH_PUBLIC_API void XXH128_canonicalFromHash(XXH128_canonical_t* dst, XXH128_has XXH_PUBLIC_API XXH128_hash_t XXH128_hashFromCanonical(const XXH128_canonical_t* src); +#endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ /*! @@ -1005,6 +1008,8 @@ struct XXH64_state_s { XXH64_hash_t reserved64; /*!< Reserved field. Do not read or write to it. */ }; /* typedef'd to XXH64_state_t */ +#ifndef XXH_NO_XXH3 + #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* >= C11 */ # include # define XXH_ALIGN(n) alignas(n) @@ -1216,6 +1221,7 @@ XXH3_128bits_reset_withSecretandSeed(XXH3_state_t* statePtr, XXH64_hash_t seed64); +#endif /* !XXH_NO_XXH3 */ #endif /* XXH_NO_LONG_LONG */ #if defined(XXH_INLINE_ALL) || defined(XXH_PRIVATE_API) # define XXH_IMPLEMENTATION