From: Eric Biggers Date: Tue, 16 Dec 2014 00:20:29 +0000 (-0600) Subject: Remove support for --enable-more-assertions configure option X-Git-Tag: v1.7.4~24 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=e6a50e92c221b5c4ce2d86caa1ba2093b20f3ac3 Remove support for --enable-more-assertions configure option The only uses of wimlib_assert2() were in compression code (where problems are relatively easy to detect), and this option was disabled by default anyway. Simplify by just having one kind of assertion. --- diff --git a/configure.ac b/configure.ac index 2a5abb08..4a6f5a59 100644 --- a/configure.ac +++ b/configure.ac @@ -128,18 +128,6 @@ if test "x$ENABLE_ASSERTIONS" = "xyes"; then AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions.]) fi -AC_MSG_CHECKING([whether to include more assertions]) -AC_ARG_ENABLE([more-assertions], - AS_HELP_STRING([--enable-more-assertions], [include even more assertions]), - [ENABLE_MORE_ASSERTIONS=$enableval], - [ENABLE_MORE_ASSERTIONS=no] - ) -AC_MSG_RESULT([$ENABLE_MORE_ASSERTIONS]) -if test "x$ENABLE_MORE_ASSERTIONS" = "xyes"; then - AC_DEFINE([ENABLE_MORE_ASSERTIONS], [1], [Define to 1 if including more assertions.]) -fi - - AC_MSG_CHECKING([whether to include automatic compression verification]) AC_ARG_ENABLE([verify_compression], AS_HELP_STRING([--enable-verify-compression], [always diff --git a/include/wimlib/assert.h b/include/wimlib/assert.h index d0ed314c..5da01bf7 100644 --- a/include/wimlib/assert.h +++ b/include/wimlib/assert.h @@ -8,10 +8,4 @@ # define wimlib_assert(expr) #endif -#ifdef ENABLE_MORE_ASSERTIONS -# define wimlib_assert2(expr) wimlib_assert(expr) -#else -# define wimlib_assert2(expr) -#endif - #endif /* _WIMLIB_ASSERT_H */ diff --git a/include/wimlib/decompress_common.h b/include/wimlib/decompress_common.h index 6762043c..296d0b1d 100644 --- a/include/wimlib/decompress_common.h +++ b/include/wimlib/decompress_common.h @@ -60,7 +60,6 @@ static inline void bitstream_ensure_bits(struct input_bitstream *is, const unsigned num_bits) { /* This currently works for at most 17 bits. */ - wimlib_assert2(num_bits <= 17); if (is->bitsleft >= num_bits) return; diff --git a/include/wimlib/error.h b/include/wimlib/error.h index a6b1a472..45e8f14f 100644 --- a/include/wimlib/error.h +++ b/include/wimlib/error.h @@ -44,11 +44,6 @@ extern FILE *wimlib_error_file; # define WARNING_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) #endif /* !ENABLE_ERROR_MESSAGES */ -#if defined(ENABLE_MORE_ASSERTIONS) && !defined(ENABLE_ASSERTIONS) -# define ENABLE_ASSERTIONS 1 -#endif - - #ifdef ENABLE_DEBUG extern void wimlib_debug(const tchar *file, int line, const char *func, diff --git a/src/compress_common.c b/src/compress_common.c index 130bfc11..7ca7f5bb 100644 --- a/src/compress_common.c +++ b/src/compress_common.c @@ -581,12 +581,6 @@ make_canonical_huffman_code(unsigned num_syms, unsigned max_codeword_len, u32 *A = codewords; unsigned num_used_syms; - /* Assumptions */ - wimlib_assert2(num_syms >= 2); - wimlib_assert2(num_syms <= (1 << NUM_SYMBOL_BITS)); - wimlib_assert2((1ULL << max_codeword_len) >= num_syms); - wimlib_assert2(max_codeword_len <= 32); - /* We begin by sorting the symbols primarily by frequency and * secondarily by symbol value. As an optimization, the array * used for this purpose ('A') shares storage with the space in diff --git a/src/decompress_common.c b/src/decompress_common.c index b08a3b4b..f89fc4f3 100644 --- a/src/decompress_common.c +++ b/src/decompress_common.c @@ -151,14 +151,6 @@ make_huffman_decode_table(u16 decode_table[const restrict], const unsigned entries_per_xmm = sizeof(__m128i) / sizeof(decode_table[0]); #endif - /* Check parameters if assertions are enabled. */ - wimlib_assert2((uintptr_t)decode_table % DECODE_TABLE_ALIGNMENT == 0); - wimlib_assert2(num_syms <= DECODE_TABLE_MAX_SYMBOLS); - wimlib_assert2(table_bits <= DECODE_TABLE_MAX_TABLE_BITS); - wimlib_assert2(max_codeword_len <= DECODE_TABLE_MAX_CODEWORD_LEN); - for (unsigned sym = 0; sym < num_syms; sym++) - wimlib_assert2(lens[sym] <= max_codeword_len); - /* Count how many symbols have each possible codeword length. * Note that a length of 0 indicates the corresponding symbol is not * used in the code and therefore does not have a codeword. */