lib: consistently use include guards

A lot of the internal library headers don't have include guards because
they aren't needed.  It might look like a bug, though, and it doesn't
hurt to add them.  So do this.

Update https://github.com/ebiggers/libdeflate/issues/117
This commit is contained in:
Eric Biggers 2021-03-11 23:00:29 -08:00
parent 4d3c0f00d5
commit 83a1bbf1d3
10 changed files with 49 additions and 0 deletions

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_ARM_ADLER32_IMPL_H
#define LIB_ARM_ADLER32_IMPL_H
#include "cpu_features.h" #include "cpu_features.h"
/* NEON implementation */ /* NEON implementation */
@ -118,3 +121,5 @@ arch_select_adler32_func(void)
return NULL; return NULL;
} }
#endif /* DISPATCH */ #endif /* DISPATCH */
#endif /* LIB_ARM_ADLER32_IMPL_H */

View File

@ -26,6 +26,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_ARM_CRC32_IMPL_H
#define LIB_ARM_CRC32_IMPL_H
#include "cpu_features.h" #include "cpu_features.h"
/* Implementation using ARM CRC32 instructions */ /* Implementation using ARM CRC32 instructions */
@ -240,3 +243,5 @@ arch_select_crc32_func(void)
return NULL; return NULL;
} }
#endif /* DISPATCH */ #endif /* DISPATCH */
#endif /* LIB_ARM_CRC32_IMPL_H */

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_ARM_MATCHFINDER_IMPL_H
#define LIB_ARM_MATCHFINDER_IMPL_H
#ifdef __ARM_NEON #ifdef __ARM_NEON
# include <arm_neon.h> # include <arm_neon.h>
static forceinline void static forceinline void
@ -79,3 +82,5 @@ matchfinder_rebase_neon(mf_pos_t *data, size_t size)
#define matchfinder_rebase matchfinder_rebase_neon #define matchfinder_rebase matchfinder_rebase_neon
#endif /* __ARM_NEON */ #endif /* __ARM_NEON */
#endif /* LIB_ARM_MATCHFINDER_IMPL_H */

View File

@ -64,6 +64,8 @@
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
#ifndef LIB_BT_MATCHFINDER_H
#define LIB_BT_MATCHFINDER_H
#include "matchfinder_common.h" #include "matchfinder_common.h"
@ -357,3 +359,5 @@ bt_matchfinder_skip_position(struct bt_matchfinder *mf,
NULL, NULL,
false); false);
} }
#endif /* LIB_BT_MATCHFINDER_H */

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_CPU_FEATURES_COMMON_H
#define LIB_CPU_FEATURES_COMMON_H
#if defined(TEST_SUPPORT__DO_NOT_USE) && !defined(FREESTANDING) #if defined(TEST_SUPPORT__DO_NOT_USE) && !defined(FREESTANDING)
# define _GNU_SOURCE 1 /* for strdup() and strtok_r() */ # define _GNU_SOURCE 1 /* for strdup() and strtok_r() */
# include <stdio.h> # include <stdio.h>
@ -81,3 +84,5 @@ disable_cpu_features_for_testing(u32 *features,
{ {
} }
#endif /* !TEST_SUPPORT__DO_NOT_USE */ #endif /* !TEST_SUPPORT__DO_NOT_USE */
#endif /* LIB_CPU_FEATURES_COMMON_H */

View File

@ -106,6 +106,9 @@
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
*/ */
#ifndef LIB_HC_MATCHFINDER_H
#define LIB_HC_MATCHFINDER_H
#include "matchfinder_common.h" #include "matchfinder_common.h"
#define HC_MATCHFINDER_HASH3_ORDER 15 #define HC_MATCHFINDER_HASH3_ORDER 15
@ -405,3 +408,5 @@ hc_matchfinder_skip_positions(struct hc_matchfinder * const restrict mf,
return in_next; return in_next;
} }
#endif /* LIB_HC_MATCHFINDER_H */

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_X86_ADLER32_IMPL_H
#define LIB_X86_ADLER32_IMPL_H
#include "cpu_features.h" #include "cpu_features.h"
/* /*
@ -330,3 +333,5 @@ arch_select_adler32_func(void)
return NULL; return NULL;
} }
#endif /* DISPATCH */ #endif /* DISPATCH */
#endif /* LIB_X86_ADLER32_IMPL_H */

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_X86_CRC32_IMPL_H
#define LIB_X86_CRC32_IMPL_H
#include "cpu_features.h" #include "cpu_features.h"
/* /*
@ -85,3 +88,5 @@ arch_select_crc32_func(void)
return NULL; return NULL;
} }
#endif /* DISPATCH */ #endif /* DISPATCH */
#endif /* LIB_X86_CRC32_IMPL_H */

View File

@ -1,3 +1,6 @@
#ifndef LIB_X86_DECOMPRESS_IMPL_H
#define LIB_X86_DECOMPRESS_IMPL_H
#include "cpu_features.h" #include "cpu_features.h"
/* Include the BMI2-optimized version? */ /* Include the BMI2-optimized version? */
@ -24,3 +27,5 @@ arch_select_decompress_func(void)
return NULL; return NULL;
} }
#endif /* DISPATCH */ #endif /* DISPATCH */
#endif /* LIB_X86_DECOMPRESS_IMPL_H */

View File

@ -25,6 +25,9 @@
* OTHER DEALINGS IN THE SOFTWARE. * OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef LIB_X86_MATCHFINDER_IMPL_H
#define LIB_X86_MATCHFINDER_IMPL_H
#ifdef __AVX2__ #ifdef __AVX2__
# include <immintrin.h> # include <immintrin.h>
static forceinline void static forceinline void
@ -115,3 +118,5 @@ matchfinder_rebase_sse2(mf_pos_t *data, size_t size)
} }
#define matchfinder_rebase matchfinder_rebase_sse2 #define matchfinder_rebase matchfinder_rebase_sse2
#endif /* __SSE2__ */ #endif /* __SSE2__ */
#endif /* LIB_X86_MATCHFINDER_IMPL_H */