Skip to content

Commit

Permalink
Merge pull request #653 from Cyan4973/noxxh3
Browse files Browse the repository at this point in the history
removed XXH3 declarations when XXH_NO_XXH3 is defined
  • Loading branch information
Cyan4973 authored Dec 8, 2021
2 parents 3fa7300 + 12a8d1a commit a17161e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down
6 changes: 6 additions & 0 deletions xxhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

/*!
* @}
* ************************************************************************
Expand Down Expand Up @@ -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 */

/*!
Expand Down Expand Up @@ -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 <stdalign.h>
# define XXH_ALIGN(n) alignas(n)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a17161e

Please sign in to comment.