]> wimlib.net Git - wimlib/commitdiff
Remove support for --enable-more-assertions configure option
authorEric Biggers <ebiggers3@gmail.com>
Tue, 16 Dec 2014 00:20:29 +0000 (18:20 -0600)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 16 Dec 2014 01:42:10 +0000 (19:42 -0600)
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.

configure.ac
include/wimlib/assert.h
include/wimlib/decompress_common.h
include/wimlib/error.h
src/compress_common.c
src/decompress_common.c

index 2a5abb088c2ebb23b6ea1c28606b58184dcd608c..4a6f5a592ee7bdd1dd6f94dd40752430a76566fc 100644 (file)
@@ -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
index d0ed314ca8aa979bf30c6367f651a62f7ec42d60..5da01bf7972e2b88fc51954f1a31caafca12c8a8 100644 (file)
@@ -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 */
index 6762043c8b0ab30081c51b83454fd76820d27ecb..296d0b1db6455d304e1d053c62131c81e49bc35e 100644 (file)
@@ -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;
index a6b1a472b34b928edee0391aee2ce9bb9acb6aa4..45e8f14ff8bf5c7164a44324270ae7c3f1a17592 100644 (file)
@@ -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,
index 130bfc1167f9eaa30bf9e55fee05cf41c76226a4..7ca7f5bba312831b9d342af875acaf2c19f144a0 100644 (file)
@@ -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
index b08a3b4b130ed4d829297695bacde916a1686bd5..f89fc4f35538370bf1651939cd163f60373d9b30 100644 (file)
@@ -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.  */