From: Eric Biggers Date: Sat, 6 Feb 2016 15:47:11 +0000 (-0600) Subject: Mark functions containing only static assertions intentionally unused X-Git-Tag: v1.9.1~50 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=d07109b91683a701a76a5941b675b67b46227f91 Mark functions containing only static assertions intentionally unused --- diff --git a/include/wimlib/compiler.h b/include/wimlib/compiler.h index 53393039..102deb73 100644 --- a/include/wimlib/compiler.h +++ b/include/wimlib/compiler.h @@ -87,6 +87,10 @@ /* TODO: _format_attribute is currently ignored. */ #define _format_attribute(type, format_str, format_start) +/* Hint that the annotated function is intentionally not used. This might be + * the case if the function contains only static assertions. */ +#define _unused_attribute __attribute__((unused)) + /* Endianness definitions. Either CPU_IS_BIG_ENDIAN or CPU_IS_LITTLE_ENDIAN is * set to 1. The other is set to 0. Note that newer gcc supports * __BYTE_ORDER__ for easily determining the endianness; older gcc doesn't. In diff --git a/include/wimlib/reparse.h b/include/wimlib/reparse.h index 7627ad41..4c531692 100644 --- a/include/wimlib/reparse.h +++ b/include/wimlib/reparse.h @@ -49,7 +49,7 @@ struct reparse_buffer_disk { #define REPARSE_DATA_MAX_SIZE (REPARSE_POINT_MAX_SIZE - REPARSE_DATA_OFFSET) -static inline void +static _unused_attribute void check_reparse_buffer_disk(void) { STATIC_ASSERT(offsetof(struct reparse_buffer_disk, rpdata) == 8); diff --git a/include/wimlib/wof.h b/include/wimlib/wof.h index f87cb454..ac07be51 100644 --- a/include/wimlib/wof.h +++ b/include/wimlib/wof.h @@ -291,7 +291,7 @@ struct WimOverlay_dat_entry_2 { } _packed_attribute; } _packed_attribute; -static inline void +static _unused_attribute void wof_check_structs(void) { STATIC_ASSERT(sizeof(struct WimOverlay_dat_header) == 24); diff --git a/src/lzms_compress.c b/src/lzms_compress.c index 9a84ebd7..8ee9e818 100644 --- a/src/lzms_compress.c +++ b/src/lzms_compress.c @@ -170,7 +170,7 @@ struct lzms_item { #define DELTA_SOURCE_POWER_SHIFT 28 #define DELTA_SOURCE_RAW_OFFSET_MASK (((u32)1 << DELTA_SOURCE_POWER_SHIFT) - 1) -static inline void +static _unused_attribute void check_that_powers_fit_in_bitfield(void) { STATIC_ASSERT(LZMS_NUM_DELTA_POWER_SYMS <= (1 << (31 - DELTA_SOURCE_POWER_SHIFT))); @@ -976,7 +976,7 @@ static const u32 lzms_bit_costs[LZMS_PROBABILITY_DENOMINATOR + 1] = { 1 }; -static inline void +static _unused_attribute void check_cost_shift(void) { /* lzms_bit_costs is hard-coded to the current COST_SHIFT. */