From e49548d667f1da6462f1d3ea018a4f6ff75d4ae7 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 30 Jul 2022 19:03:42 -0700 Subject: [PATCH] Remove some unnecessary configure options Remove support for the following options which aren't really useful and probably aren't being used by anyone: * --disable-assertions * --disable-error-messages * --disable-multithreaded-compression --- configure.ac | 32 ------------------------------- include/wimlib.h | 12 ++---------- include/wimlib/assert.h | 6 +----- include/wimlib/chunk_compressor.h | 2 -- include/wimlib/error.h | 9 --------- src/compress_parallel.c | 4 ---- src/error.c | 15 --------------- src/resource.c | 2 -- src/wim.c | 2 -- src/write.c | 2 -- 10 files changed, 3 insertions(+), 83 deletions(-) diff --git a/configure.ac b/configure.ac index 2b0650f8..81e756d6 100644 --- a/configure.ac +++ b/configure.ac @@ -224,38 +224,6 @@ AM_CONDITIONAL([ENABLE_SSSE3_SHA1], [test "$ENABLE_SSSE3_SHA1" = "yes"]) # ----------------------------- Other options --------------------------------- -AC_MSG_CHECKING([whether to include error messages]) -AC_ARG_ENABLE([error_messages], - AS_HELP_STRING([--disable-error-messages], [do not compile in error messages]), - [ENABLE_ERROR_MESSAGES=$enableval], - [ENABLE_ERROR_MESSAGES=yes]) -AC_MSG_RESULT([$ENABLE_ERROR_MESSAGES]) -if test "$ENABLE_ERROR_MESSAGES" = "yes"; then - AC_DEFINE([ENABLE_ERROR_MESSAGES], [1], [Define to 1 if including error messages]) -fi - -AC_MSG_CHECKING([whether to include assertions]) -AC_ARG_ENABLE([assertions], - AS_HELP_STRING([--disable-assertions], [do not include assertions]), - [ENABLE_ASSERTIONS=$enableval], - [ENABLE_ASSERTIONS=yes]) -AC_MSG_RESULT([$ENABLE_ASSERTIONS]) -if test "$ENABLE_ASSERTIONS" = "yes"; then - AC_DEFINE([ENABLE_ASSERTIONS], [1], [Define to 1 if including assertions]) -fi - -AC_MSG_CHECKING([whether to include support for multi-threaded compression]) -AC_ARG_ENABLE([multithreaded-compression], - AS_HELP_STRING([--disable-multithreaded-compression], - [disable support for multithreaded compression]), - [ENABLE_MULTITHREADED_COMPRESSION=$enableval], - [ENABLE_MULTITHREADED_COMPRESSION=yes]) -AC_MSG_RESULT([$ENABLE_MULTITHREADED_COMPRESSION]) -if test "$ENABLE_MULTITHREADED_COMPRESSION" = "yes"; then - AC_DEFINE([ENABLE_MULTITHREADED_COMPRESSION], [1], - [Define to 1 to support multithreaded compression]) -fi - AC_ARG_WITH(pkgconfigdir, [ --with-pkgconfigdir=DIR pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@], [pkgconfigdir=$withval], diff --git a/include/wimlib.h b/include/wimlib.h index f5c9e0e8..43e971b1 100644 --- a/include/wimlib.h +++ b/include/wimlib.h @@ -4028,10 +4028,7 @@ wimlib_resolve_image(WIMStruct *wim, * This also enables error messages, as if by a call to * wimlib_set_print_errors(true). * - * @return 0 on success; a ::wimlib_error_code value on failure. - * - * @retval ::WIMLIB_ERR_UNSUPPORTED - * wimlib was compiled using the --without-error-messages option. + * @return 0 */ extern int wimlib_set_error_file(FILE *fp); @@ -4049,8 +4046,6 @@ wimlib_set_error_file(FILE *fp); * * @retval ::WIMLIB_ERR_OPEN * The file named by @p path could not be opened for appending. - * @retval ::WIMLIB_ERR_UNSUPPORTED - * wimlib was compiled using the --without-error-messages option. */ extern int wimlib_set_error_file_by_name(const wimlib_tchar *path); @@ -4248,10 +4243,7 @@ wimlib_set_output_pack_compression_type(WIMStruct *wim, * @c true if messages are to be printed; @c false if messages are not to * be printed. * - * @return 0 on success; a ::wimlib_error_code value on failure. - * - * @retval ::WIMLIB_ERR_UNSUPPORTED - * wimlib was compiled using the --without-error-messages option. + * @return 0 */ extern int wimlib_set_print_errors(bool show_messages); diff --git a/include/wimlib/assert.h b/include/wimlib/assert.h index 5da01bf7..5c8fe650 100644 --- a/include/wimlib/assert.h +++ b/include/wimlib/assert.h @@ -1,11 +1,7 @@ #ifndef _WIMLIB_ASSERT_H #define _WIMLIB_ASSERT_H -#ifdef ENABLE_ASSERTIONS #include -# define wimlib_assert(expr) assert(expr) -#else -# define wimlib_assert(expr) -#endif +#define wimlib_assert(expr) assert(expr) #endif /* _WIMLIB_ASSERT_H */ diff --git a/include/wimlib/chunk_compressor.h b/include/wimlib/chunk_compressor.h index 265e1362..237ece50 100644 --- a/include/wimlib/chunk_compressor.h +++ b/include/wimlib/chunk_compressor.h @@ -63,12 +63,10 @@ struct chunk_compressor { /* Functions that return implementations of the chunk_compressor interface. */ -#ifdef ENABLE_MULTITHREADED_COMPRESSION int new_parallel_chunk_compressor(int out_ctype, u32 out_chunk_size, unsigned num_threads, u64 max_memory, struct chunk_compressor **compressor_ret); -#endif int new_serial_chunk_compressor(int out_ctype, u32 out_chunk_size, diff --git a/include/wimlib/error.h b/include/wimlib/error.h index 06222a06..75b48c1b 100644 --- a/include/wimlib/error.h +++ b/include/wimlib/error.h @@ -13,7 +13,6 @@ dummy_tprintf(const tchar *format, ...) return 0; } -#ifdef ENABLE_ERROR_MESSAGES extern void wimlib_error(const tchar *format, ...) _format_attribute(printf, 1, 2) _cold_attribute; @@ -35,14 +34,6 @@ wimlib_warning_with_errno(const tchar *format, ...) # define WARNING_WITH_ERRNO(format, ...) wimlib_warning_with_errno(T(format), ## __VA_ARGS__) extern bool wimlib_print_errors; extern FILE *wimlib_error_file; -#else /* ENABLE_ERROR_MESSAGES */ -# define wimlib_print_errors 0 -# define wimlib_error_file NULL -# define ERROR(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) -# define ERROR_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) -# define WARNING(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) -# define WARNING_WITH_ERRNO(format, ...) dummy_tprintf(T(format), ## __VA_ARGS__) -#endif /* !ENABLE_ERROR_MESSAGES */ extern void print_byte_field(const u8 *field, size_t len, FILE *out); diff --git a/src/compress_parallel.c b/src/compress_parallel.c index 6aa635bf..4c295906 100644 --- a/src/compress_parallel.c +++ b/src/compress_parallel.c @@ -25,8 +25,6 @@ # include "config.h" #endif -#ifdef ENABLE_MULTITHREADED_COMPRESSION - #include #include #include @@ -515,5 +513,3 @@ err: parallel_chunk_compressor_destroy(&ctx->base); return ret; } - -#endif /* ENABLE_MULTITHREADED_COMPRESSION */ diff --git a/src/error.c b/src/error.c index cccb815f..22352f53 100644 --- a/src/error.c +++ b/src/error.c @@ -46,7 +46,6 @@ #include "wimlib/util.h" #include "wimlib/win32.h" -#ifdef ENABLE_ERROR_MESSAGES bool wimlib_print_errors = false; FILE *wimlib_error_file = NULL; /* Set in wimlib_global_init() */ static bool wimlib_owns_error_file = false; @@ -119,7 +118,6 @@ wimlib_warning_with_errno(const tchar *format, ...) wimlib_vmsg(T("\r[WARNING] "), format, va, true); va_end(va); } -#endif /* ENABLE_ERROR_MESSAGES */ void print_byte_field(const u8 *field, size_t len, FILE *out) @@ -131,34 +129,24 @@ print_byte_field(const u8 *field, size_t len, FILE *out) WIMLIBAPI int wimlib_set_print_errors(bool show_error_messages) { -#ifdef ENABLE_ERROR_MESSAGES wimlib_print_errors = show_error_messages; -#else - if (show_error_messages) - return WIMLIB_ERR_UNSUPPORTED; -#endif return 0; } WIMLIBAPI int wimlib_set_error_file(FILE *fp) { -#ifdef ENABLE_ERROR_MESSAGES if (wimlib_owns_error_file) fclose(wimlib_error_file); wimlib_error_file = fp; wimlib_print_errors = (fp != NULL); wimlib_owns_error_file = false; return 0; -#else - return WIMLIB_ERR_UNSUPPORTED; -#endif } WIMLIBAPI int wimlib_set_error_file_by_name(const tchar *path) { -#ifdef ENABLE_ERROR_MESSAGES FILE *fp; #ifdef __WIN32__ @@ -171,9 +159,6 @@ wimlib_set_error_file_by_name(const tchar *path) wimlib_set_error_file(fp); wimlib_owns_error_file = true; return 0; -#else - return WIMLIB_ERR_UNSUPPORTED; -#endif } static const tchar * const error_strings[] = { diff --git a/src/resource.c b/src/resource.c index 8b6139ad..dd0d2edd 100644 --- a/src/resource.c +++ b/src/resource.c @@ -1034,7 +1034,6 @@ report_sha1_mismatch(struct blob_descriptor *blob, blob_file_path(blob), expected_hashstr, actual_hashstr); return WIMLIB_ERR_CONCURRENT_MODIFICATION_DETECTED; } else if (blob->blob_location == BLOB_IN_WIM) { - #ifdef ENABLE_ERROR_MESSAGES const struct wim_resource_descriptor *rdesc = blob->rdesc; (recover_data ? wimlib_warning : wimlib_error)( @@ -1060,7 +1059,6 @@ report_sha1_mismatch(struct blob_descriptor *blob, rdesc->compression_type), rdesc->chunk_size, expected_hashstr, actual_hashstr); - #endif /* ENABLE_ERROR_MESSAGES */ if (recover_data) return 0; return WIMLIB_ERR_INVALID_RESOURCE_HASH; diff --git a/src/wim.c b/src/wim.c index ca40e53a..08b0c1c0 100644 --- a/src/wim.c +++ b/src/wim.c @@ -958,10 +958,8 @@ wimlib_global_init(int init_flags) if (lib_initialized) goto out_unlock; -#ifdef ENABLE_ERROR_MESSAGES if (!wimlib_error_file) wimlib_error_file = stderr; -#endif ret = WIMLIB_ERR_INVALID_PARAM; if (init_flags & ~(WIMLIB_INIT_FLAG_ASSUME_UTF8 | diff --git a/src/write.c b/src/write.c index e28069eb..c2cbba5f 100644 --- a/src/write.c +++ b/src/write.c @@ -1551,7 +1551,6 @@ write_blob_list(struct list_head *blob_list, * specified number of threads, unless the upper bound on the number * bytes needing to be compressed is less than a heuristic value. */ if (num_nonraw_bytes != 0 && out_ctype != WIMLIB_COMPRESSION_TYPE_NONE) { - #ifdef ENABLE_MULTITHREADED_COMPRESSION if (num_nonraw_bytes > max(2000000, out_chunk_size)) { ret = new_parallel_chunk_compressor(out_ctype, out_chunk_size, @@ -1563,7 +1562,6 @@ write_blob_list(struct list_head *blob_list, wimlib_get_error_string(ret)); } } - #endif if (ctx.compressor == NULL) { ret = new_serial_chunk_compressor(out_ctype, out_chunk_size, -- 2.43.0