diff --git a/src/bignum.h b/src/bignum.h index 7087d1d51244d2ed3e32b5238dc9b6445c8b0ea0..48cac829ffab9bffee6a76182e800f4a93f4c147 100644 --- a/src/bignum.h +++ b/src/bignum.h @@ -28,76 +28,76 @@ * The family of DO_*_OVERFLOW functions sets the result only if no overflow occured. */ #define GENERIC_OVERFLOW_CHECKS(type) \ -static INLINE int DO_## type ## _NEG_OVERFLOW(type a, type * res) { \ +static INLINE int __attribute__((unused)) DO_## type ## _NEG_OVERFLOW(type a, type * res) { \ if (a == MIN_ ## type) return 1; \ *res = -a; \ return 0; \ } \ -static INLINE int type ## _NEG_OVERFLOW(type a) { \ +static INLINE int __attribute__((unused)) type ## _NEG_OVERFLOW(type a) { \ return a == MIN_ ## type; \ } \ -static INLINE int type ## _DIV_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _DIV_OVERFLOW(type a, type b) { \ return a == MIN_ ## type && b == -1; \ } \ -static INLINE int DO_ ## type ## _DIV_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _DIV_OVERFLOW(type a, type b, type * res) { \ if (a == MIN_ ## type && b == -1) return 1; \ *res = a/b; \ return 0; \ } \ -static INLINE int U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b) { \ +static INLINE int __attribute__((unused)) U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b) { \ unsigned type res; \ return DO_U ## type ## _MUL_OVERFLOW(a, b, &res); \ } \ -static INLINE int U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b) { \ +static INLINE int __attribute__((unused)) U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b) { \ unsigned type res; \ return DO_U ## type ## _ADD_OVERFLOW(a, b, &res); \ } \ -static INLINE int U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b) { \ +static INLINE int __attribute__((unused)) U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b) { \ unsigned type res; \ return DO_U ## type ## _SUB_OVERFLOW(a, b, &res); \ } \ -static INLINE int type ## _MUL_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _MUL_OVERFLOW(type a, type b) { \ type res; \ return DO_ ## type ## _MUL_OVERFLOW(a, b, &res); \ } \ -static INLINE int type ## _ADD_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _ADD_OVERFLOW(type a, type b) { \ type res; \ return DO_ ## type ## _ADD_OVERFLOW(a, b, &res); \ } \ -static INLINE int type ## _SUB_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _SUB_OVERFLOW(type a, type b) { \ type res; \ return DO_ ## type ## _SUB_OVERFLOW(a, b, &res); \ } \ -static INLINE int type ## _MOD_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _MOD_OVERFLOW(type a, type b) { \ return type ## _DIV_OVERFLOW(a, b); \ } \ -static INLINE int DO_ ## type ## _MOD_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _MOD_OVERFLOW(type a, type b, type * res) { \ if (type ## _MOD_OVERFLOW(a, b)) { \ return 1; \ } \ *res = a % b; \ return 0; \ } \ -static INLINE int type ## _LSH_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _LSH_OVERFLOW(type a, type b) { \ type size = (type)sizeof(type)*CHAR_BIT; \ return (b < 0 || b >= size - 1 || a < 0 || (b && (a >> (size - 1 - b)))); \ } \ -static INLINE int type ## _RSH_OVERFLOW(type a, type b) { \ +static INLINE int __attribute__((unused)) type ## _RSH_OVERFLOW(type a, type b) { \ return (b < 0 || a < 0 || b >= (type)sizeof(type)*CHAR_BIT); \ } \ -static INLINE int DO_ ## type ## _LSH_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _LSH_OVERFLOW(type a, type b, type * res) { \ if (type ## _LSH_OVERFLOW(a, b)) return 1; \ *res = a << b; \ return 0; \ } \ -static INLINE int DO_ ## type ## _RSH_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _RSH_OVERFLOW(type a, type b, type * res) { \ if (type ## _RSH_OVERFLOW(a, b)) return 1; \ *res = a >> b; \ return 0; \ } #define _GEN_OF2(type, type2, utype2, size) \ -static INLINE int DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) { \ type2 tmp; \ tmp = (type2)a + (type2)b; \ if (tmp < MIN_ ## type || tmp > MAX_ ## type) \ @@ -105,7 +105,7 @@ static INLINE int DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) { *res = (type)tmp; \ return 0; \ } \ -static INLINE int DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) { \ type2 tmp; \ tmp = (type2)a - (type2)b; \ if (tmp < MIN_ ## type || tmp > MAX_ ## type) \ @@ -113,7 +113,7 @@ static INLINE int DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) { *res = (type)tmp; \ return 0; \ } \ -static INLINE int DO_ ## type ## _MUL_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _MUL_OVERFLOW(type a, type b, type * res) { \ type2 tmp; \ tmp = (type2)a * (type2)b; \ if (tmp < MIN_ ## type || tmp > MAX_ ## type) \ @@ -121,7 +121,7 @@ static INLINE int DO_ ## type ## _MUL_OVERFLOW(type a, type b, type * res) { *res = (type)tmp; \ return 0; \ } \ -static INLINE int DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b, \ +static INLINE int __attribute__((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b, \ unsigned type * res) { \ utype2 tmp; \ tmp = (utype2)a + (utype2)b; \ @@ -129,7 +129,7 @@ static INLINE int DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b *res = (unsigned type)tmp; \ return 0; \ } \ -static INLINE int DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b, \ +static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b, \ unsigned type * res) { \ utype2 tmp; \ tmp = (utype2)a * (utype2)b; \ @@ -139,21 +139,21 @@ static INLINE int DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b } #define _GEN_OF1(type, size) \ -static INLINE int DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _ADD_OVERFLOW(type a, type b, type * res) { \ if ((b > 0 && a > MAX_ ## type - b) || \ (b < 0 && a < MIN_ ## type - b)) \ return 1; \ *res = a + b; \ return 0; \ } \ -static INLINE int DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_ ## type ## _SUB_OVERFLOW(type a, type b, type * res) { \ if ((b > 0 && a < MIN_ ## type + b) || \ (b < 0 && a > MAX_ ## type + b)) \ return 1; \ *res = a - b; \ return 0; \ } \ -static INLINE int DO_## type ## _MUL_OVERFLOW(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) DO_## type ## _MUL_OVERFLOW(type a, type b, type * res) { \ if (a > 0) { \ if (b > 0) { \ if (a > (MAX_ ## type / b)) { \ @@ -178,14 +178,14 @@ static INLINE int DO_## type ## _MUL_OVERFLOW(type a, type b, type * res) { *res = a * b; \ return 0; \ } \ -static INLINE int DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b, \ +static INLINE int __attribute__((unused)) DO_U ## type ## _ADD_OVERFLOW(unsigned type a, unsigned type b, \ unsigned type * res) { \ if (a > MAX_U ## type - b) \ return 1; \ *res = a + b; \ return 0; \ } \ -static INLINE int DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b, \ +static INLINE int __attribute__((unused)) DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b, \ unsigned type * res) { \ unsigned type tmp = 0; \ unsigned type bits = size/2; \ @@ -206,7 +206,7 @@ static INLINE int DO_U ## type ## _MUL_OVERFLOW(unsigned type a, unsigned type b } \ #define GEN_USUB_OF(type) \ -static INLINE int DO_U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b, \ +static INLINE int __attribute__((unused)) DO_U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b, \ unsigned type * res) { \ if (b > a) \ return 1; \ @@ -225,7 +225,7 @@ static INLINE int DO_U ## type ## _SUB_OVERFLOW(unsigned type a, unsigned type b #if PIKE_CLANG_BUILTIN(__builtin_uadd_overflow) #define DO_CLANG_OF(name, type, builtin) \ -static INLINE int name(type a, type b, type * res) { \ +static INLINE int __attribute__((unused)) name(type a, type b, type * res) { \ type tmp; \ if (builtin(a, b, &tmp)) return 1; \ *res = tmp; \ @@ -285,11 +285,11 @@ GEN_OF2(8, 32, unsigned INT32) * of the correct type as temporaries, and then copying the result. */ #define _GEN_UNOP(OP, type1, TYPE1, type2, name) \ - static INLINE int name ## _ ## OP ## _OVERFLOW(type2 a) { \ + static INLINE int __attribute__((unused)) name ## _ ## OP ## _OVERFLOW(type2 a) { \ type1 tmp; \ return (DO_## TYPE1 ## _ ## OP ## _OVERFLOW(a, &tmp)); \ } \ - static INLINE int DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a, \ + static INLINE int __attribute__((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a, \ type2 *res) { \ type1 tmp; \ if (DO_ ## TYPE1 ## _ ## OP ## _OVERFLOW(a, &tmp)) return 1; \ @@ -297,11 +297,11 @@ GEN_OF2(8, 32, unsigned INT32) return 0; \ } #define _GEN_BINOP(OP, type1, TYPE1, type2, name) \ - static INLINE int name ## _ ## OP ## _OVERFLOW(type2 a, type2 b) { \ + static INLINE int __attribute__((unused)) name ## _ ## OP ## _OVERFLOW(type2 a, type2 b) { \ type1 tmp; \ return (DO_ ## TYPE1 ## _ ## OP ## _OVERFLOW(a, b, &tmp)); \ } \ - static INLINE int DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a, \ + static INLINE int __attribute__((unused)) DO_ ## name ## _ ## OP ## _OVERFLOW(type2 a, \ type2 b, \ type2 *res) { \ type1 tmp; \ diff --git a/src/bitvector.h b/src/bitvector.h index cbb6b4d7638898aaeb01a9306390d41c4a03c4d3..a469379b61819941b2688c8b8f7d2c69997f81e8 100644 --- a/src/bitvector.h +++ b/src/bitvector.h @@ -20,7 +20,7 @@ static const char logTable[256] = { }; #undef LT -static INLINE unsigned INT32 clz32(unsigned INT32 i) { +static INLINE unsigned INT32 __attribute__((unused)) clz32(unsigned INT32 i) { #ifdef HAS___BUILTIN_CLZ return i ? __builtin_clz(i) : 32; #elif defined(HAS__BIT_SCAN_REVERSE) @@ -51,7 +51,7 @@ static INLINE unsigned INT32 clz32(unsigned INT32 i) { #define clz16(i) (clz32(i) - 16) #define clz8(i) (clz32(i) - 24) -static INLINE unsigned INT32 ctz32(unsigned INT32 i) { +static INLINE unsigned INT32 __attribute__((unused)) ctz32(unsigned INT32 i) { #ifdef HAS___BUILTIN_CTZ return i ? __builtin_ctz(i) : 32; #elif defined(HAS__BIT_SCAN_FORWARD) @@ -77,7 +77,7 @@ static INLINE unsigned INT32 ctz32(unsigned INT32 i) { #define ctz8(i) (i ? ctz32(i) : 8) -static INLINE unsigned INT32 bswap32(unsigned INT32 x) { +static INLINE unsigned INT32 __attribute__((unused)) bswap32(unsigned INT32 x) { #ifdef HAS___BUILTIN_BSWAP32 return __builtin_bswap32(x); #elif defined(HAS__BSWAP) @@ -92,7 +92,7 @@ static INLINE unsigned INT32 bswap32(unsigned INT32 x) { #ifdef INT64 -static INLINE unsigned INT32 clz64(unsigned INT64 i) { +static INLINE unsigned INT32 __attribute__((unused)) clz64(unsigned INT64 i) { # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CLZL) return i ? __builtin_clzl(i) : 64; # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CLZLL) @@ -127,7 +127,7 @@ static INLINE unsigned INT32 clz64(unsigned INT64 i) { # endif } -static INLINE unsigned INT32 ctz64(unsigned INT64 i) { +static INLINE unsigned INT32 __attribute__((unused)) ctz64(unsigned INT64 i) { # if SIZEOF_LONG == 8 && defined(HAS___BUILTIN_CTZL) return i ? __builtin_ctzl(i) : 64; # elif SIZEOF_LONG_LONG == 8 && defined(HAS___BUILTIN_CTZLL) @@ -151,7 +151,7 @@ static INLINE unsigned INT32 ctz64(unsigned INT64 i) { # endif } -static INLINE unsigned INT64 bswap64(unsigned INT64 x) { +static INLINE unsigned INT64 __attribute__((unused)) bswap64(unsigned INT64 x) { #ifdef HAS___BUILTIN_BSWAP64 return __builtin_bswap64(x); #elif defined(HAS__BSWAP64) @@ -163,7 +163,7 @@ static INLINE unsigned INT64 bswap64(unsigned INT64 x) { #endif } -static INLINE unsigned INT64 round_up64(unsigned INT64 v) { +static INLINE unsigned INT64 __attribute__((unused)) round_up64(unsigned INT64 v) { unsigned INT64 i; if (!v) return 0; @@ -171,21 +171,21 @@ static INLINE unsigned INT64 round_up64(unsigned INT64 v) { return (unsigned INT64)1 << (64 - clz64(v)); } -static INLINE unsigned INT32 ffs64(unsigned INT64 v) { +static INLINE unsigned INT32 __attribute__((unused)) ffs64(unsigned INT64 v) { return ctz64(v) + 1; } -static INLINE unsigned INT32 fls64(unsigned INT64 v) { +static INLINE unsigned INT32 __attribute__((unused)) fls64(unsigned INT64 v) { return 64 - clz64(v); } /* returns -1 for 0 */ -static INLINE unsigned INT32 log2_u64(unsigned INT64 v) { +static INLINE unsigned INT32 __attribute__((unused)) log2_u64(unsigned INT64 v) { return fls64(v) - 1; } #endif /* INT64 */ -static INLINE unsigned INT32 round_up32(unsigned INT32 v) { +static INLINE unsigned INT32 __attribute__((unused)) round_up32(unsigned INT32 v) { unsigned INT32 i; if (!v) return 0; @@ -193,16 +193,16 @@ static INLINE unsigned INT32 round_up32(unsigned INT32 v) { return 1U << (32 - clz32(v)); } -static INLINE unsigned INT32 ffs32(unsigned INT32 v) { +static INLINE unsigned INT32 __attribute__((unused)) ffs32(unsigned INT32 v) { return ctz32(v) + 1; } -static INLINE unsigned INT32 fls32(unsigned INT32 v) { +static INLINE unsigned INT32 __attribute__((unused)) fls32(unsigned INT32 v) { return 32 - clz32(v); } /* returns -1 for 0 */ -static INLINE unsigned INT32 log2_u32(unsigned INT32 v) { +static INLINE unsigned INT32 __attribute__((unused)) log2_u32(unsigned INT32 v) { return fls32(v) - 1; } diff --git a/src/block_allocator.h b/src/block_allocator.h index 4ffbc1cc4ba8a2d053f9100da9eed17321e39608..566830df41978bde2e185e2393a5aa14fe141228 100644 --- a/src/block_allocator.h +++ b/src/block_allocator.h @@ -52,13 +52,13 @@ typedef void (*ba_walk_callback)(struct ba_iterator *,void*); PMOD_EXPORT void ba_walk(struct block_allocator * a, ba_walk_callback cb, void * data); -static INLINE int ba_it_step(struct ba_iterator * it) { +static INLINE int __attribute__((unused)) ba_it_step(struct ba_iterator * it) { it->cur = (char*)it->cur + it->l.block_size; return (char*)it->cur < (char*)it->end; } -static INLINE void * ba_it_val(struct ba_iterator * it) { +static INLINE void __attribute__((unused)) * ba_it_val(struct ba_iterator * it) { return it->cur; } @@ -83,7 +83,7 @@ PMOD_EXPORT void ba_free_all(struct block_allocator * a); PMOD_EXPORT size_t ba_count(const struct block_allocator * a); PMOD_EXPORT void ba_count_all(const struct block_allocator * a, size_t * num, size_t * size); -static INLINE void ba_init(struct block_allocator * a, unsigned INT32 block_size, unsigned INT32 blocks) { +static INLINE void __attribute__((unused)) ba_init(struct block_allocator * a, unsigned INT32 block_size, unsigned INT32 blocks) { ba_init_aligned(a, block_size, blocks, 0); } #endif diff --git a/src/gc.h b/src/gc.h index bba6963195f624263bb0a6460b7ce1e98729b41e..41fcc991df8c66e255d98b75a68b16162a364b0e 100644 --- a/src/gc.h +++ b/src/gc.h @@ -426,7 +426,7 @@ PMOD_EXPORT extern const char *gc_found_place; gc_found_in_type = orig_gc_found_in_type; \ } while (0) -static INLINE int debug_gc_check (void *a, const char *place) +static INLINE int __attribute__((unused)) debug_gc_check (void *a, const char *place) { int res; const char *orig_gc_found_place = gc_found_place; @@ -436,7 +436,7 @@ static INLINE int debug_gc_check (void *a, const char *place) return res; } -static INLINE int debug_gc_check_weak (void *a, const char *place) +static INLINE int __attribute__((unused)) debug_gc_check_weak (void *a, const char *place) { int res; const char *orig_gc_found_place = gc_found_place; @@ -679,7 +679,7 @@ PMOD_EXPORT TYPE_T type_from_visit_fn (visit_thing_fn *fn); PMOD_EXPORT TYPE_FIELD real_visit_svalues (struct svalue *s, size_t num, int ref_type); -static INLINE int real_visit_short_svalue (union anything *u, TYPE_T t, +static INLINE int __attribute__((unused)) real_visit_short_svalue (union anything *u, TYPE_T t, int ref_type) { check_short_svalue (u, t); @@ -691,14 +691,14 @@ static INLINE int real_visit_short_svalue (union anything *u, TYPE_T t, (real_visit_short_svalue (debug_malloc_pass ((U)->ptr), (T), (REF_TYPE))) #ifdef DEBUG_MALLOC -static INLINE TYPE_FIELD dmalloc_visit_svalues (struct svalue *s, size_t num, +static INLINE TYPE_FIELD __attribute__((unused)) dmalloc_visit_svalues (struct svalue *s, size_t num, int ref_type, char *l) { return real_visit_svalues (dmalloc_check_svalues (s, num, l), num, ref_type); } #define visit_svalues(S, NUM, REF_TYPE) \ dmalloc_visit_svalues ((S), (NUM), (REF_TYPE), DMALLOC_LOCATION()) -static INLINE void dmalloc_visit_svalue (struct svalue *s, +static INLINE void __attribute__((unused)) dmalloc_visit_svalue (struct svalue *s, int ref_type, char *l) { int t = TYPEOF(*s); @@ -713,7 +713,7 @@ static INLINE void dmalloc_visit_svalue (struct svalue *s, dmalloc_visit_svalue ((S), (REF_TYPE), DMALLOC_LOCATION()) #else #define visit_svalues real_visit_svalues -static INLINE void visit_svalue (struct svalue *s, int ref_type) +static INLINE void __attribute__((unused)) visit_svalue (struct svalue *s, int ref_type) { int t = TYPEOF(*s); check_svalue (s); diff --git a/src/multiset.h b/src/multiset.h index 10a73018e1ced66f892d3a491fc1429dcf2bc62a..06c84270d0c0db14e84b7f3ccc7a5d0f2f107f67 100644 --- a/src/multiset.h +++ b/src/multiset.h @@ -149,7 +149,7 @@ PMOD_EXPORT void multiset_clear_node_refs (struct multiset *l); #ifdef PIKE_DEBUG /* To get good type checking. */ -static INLINE union msnode *msnode_check (union msnode *x) +static INLINE union msnode __attribute__((unused)) *msnode_check (union msnode *x) {return x;} PMOD_EXPORT extern const char msg_no_multiset_flag_marker[]; #else diff --git a/src/pike_float.h b/src/pike_float.h index 15dd120d22bccb2cce1851c90433643ef423f96b..2e16812928bf756e7747e86a11a91f8415472249 100644 --- a/src/pike_float.h +++ b/src/pike_float.h @@ -33,7 +33,7 @@ #define PIKE_ISNAN(X) _isnan(X) #else /* !HAVE__ISNAN */ /* Fallback function */ -static INLINE int pike_isnan(double x) +static INLINE int __attribute__((unused)) pike_isnan(double x) { return ((x == 0.0) == (x < 0.0)) && ((x == 0.0) == (x > 0.0)); diff --git a/src/pike_memory.h b/src/pike_memory.h index 96c17966345bb65c73cc9880264c866fa79b71d1..49f81d599328cb2fc50fefd579dd076ee880672b 100644 --- a/src/pike_memory.h +++ b/src/pike_memory.h @@ -152,39 +152,39 @@ struct mem_searcher * The purpose of this function is to avoid dead store elimination in cases when * sensitive data has to be cleared from memory. */ -static INLINE void * guaranteed_memset(void * p, int c, size_t n) { +static INLINE void __attribute__((unused)) * guaranteed_memset(void * p, int c, size_t n) { volatile char * _p = (char *)p; while (n--) *_p++ = c; return (void *)p; } -static INLINE unsigned INT64 get_unaligned64(const void * ptr) { +static INLINE unsigned INT64 __attribute__((unused)) get_unaligned64(const void * ptr) { unsigned INT64 v; memcpy(&v, ptr, 8); return v; } -static INLINE void set_unaligned64(void * ptr, unsigned INT64 v) { +static INLINE void __attribute__((unused)) set_unaligned64(void * ptr, unsigned INT64 v) { memcpy(ptr, &v, 8); } -static INLINE unsigned INT64 get_unaligned32(const void * ptr) { +static INLINE unsigned INT64 __attribute__((unused)) get_unaligned32(const void * ptr) { unsigned INT32 v; memcpy(&v, ptr, 4); return v; } -static INLINE void set_unaligned32(void * ptr, unsigned INT32 v) { +static INLINE void __attribute__((unused)) set_unaligned32(void * ptr, unsigned INT32 v) { memcpy(ptr, &v, 4); } -static INLINE unsigned INT16 get_unaligned16(const void * ptr) { +static INLINE unsigned INT16 __attribute__((unused)) get_unaligned16(const void * ptr) { unsigned INT16 v; memcpy(&v, ptr, 2); return v; } -static INLINE void set_unaligned16(void * ptr, unsigned INT16 v) { +static INLINE void __attribute__((unused)) set_unaligned16(void * ptr, unsigned INT16 v) { memcpy(ptr, &v, 2); } diff --git a/src/program.h b/src/program.h index b58173e9344a629809f167bd4c94bd76cca39d59..9947d5c229c7da8e5470da8a08a6a8780d8da033 100644 --- a/src/program.h +++ b/src/program.h @@ -644,7 +644,7 @@ struct program PMOD_EXPORT void dump_program_tables (const struct program *p, int indent); #ifdef PIKE_DEBUG -static INLINE int CHECK_IDREF_RANGE (int x, const struct program *p) +static INLINE int __attribute__((unused)) CHECK_IDREF_RANGE (int x, const struct program *p) { if (x < 0 || x >= p->num_identifier_references) { dump_program_tables(p, 4); @@ -1070,7 +1070,7 @@ void make_area_executable (char *start, size_t len); void make_program_executable(struct program *p); /* Prototypes end here */ -static INLINE int FIND_LFUN(struct program * p, int lfun) { +static INLINE int __attribute__((unused)) FIND_LFUN(struct program * p, int lfun) { #ifdef PIKE_DEBUG dmalloc_touch(struct program*, p); if (lfun < 0) return find_lfun_fatal(p, lfun); diff --git a/src/rbtree.h b/src/rbtree.h index 096421b638824b3924eadd0946b1a724144f655c..eac23b82316e8313bc89b95d02130919cec9e1fe 100644 --- a/src/rbtree.h +++ b/src/rbtree.h @@ -91,7 +91,7 @@ PMOD_EXPORT struct rb_node_hdr *rb_link_next (struct rb_node_hdr *node); #ifdef PIKE_DEBUG /* To get good type checking. */ -static INLINE struct rb_node_hdr *rb_node_check (struct rb_node_hdr *node) +static INLINE struct rb_node_hdr __attribute__((unused)) *rb_node_check (struct rb_node_hdr *node) {return node;} #else #define rb_node_check(node) ((struct rb_node_hdr *) (node)) diff --git a/src/stack_allocator.h b/src/stack_allocator.h index a60f11e8d1355a8d5bbfaf6f8a8a721742efd7ce..7f6dd4185d5c099e1ee56e661150014e0a8d8d94 100644 --- a/src/stack_allocator.h +++ b/src/stack_allocator.h @@ -16,16 +16,16 @@ void stack_alloc_enlarge(struct stack_allocator * a, size_t size); void stack_alloc_destroy(struct stack_allocator * a); size_t stack_alloc_count(struct stack_allocator * a); -static INLINE void stack_alloc_init(struct stack_allocator * a, size_t initial) { +static INLINE void __attribute__((unused)) stack_alloc_init(struct stack_allocator * a, size_t initial) { a->cur = NULL; a->initial = initial; } -static INLINE size_t left(struct chunk * c) { +static INLINE size_t __attribute__((unused)) left(struct chunk * c) { return (size_t)(((char*)c->data + c->size) - (char*)c->top); } -static INLINE void sa_alloc_enlarge(struct stack_allocator * a, size_t size) { +static INLINE void __attribute__((unused)) sa_alloc_enlarge(struct stack_allocator * a, size_t size) { struct chunk * c = a->cur; if (!c || left(c) < size) @@ -33,7 +33,7 @@ static INLINE void sa_alloc_enlarge(struct stack_allocator * a, size_t size) { } MALLOC_FUNCTION -static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) { +static INLINE void __attribute__((unused)) * sa_alloc_fast(struct stack_allocator * a, size_t size) { struct chunk * c = a->cur; void * ret = c->top; c->top = (char*)c->top + size; @@ -41,7 +41,7 @@ static INLINE void * sa_alloc_fast(struct stack_allocator * a, size_t size) { } MALLOC_FUNCTION -static INLINE void * sa_alloc(struct stack_allocator * a, size_t size) { +static INLINE void __attribute__((unused)) * sa_alloc(struct stack_allocator * a, size_t size) { sa_alloc_enlarge(a, size); return sa_alloc_fast(a, size); } diff --git a/src/stralloc.h b/src/stralloc.h index 72f2369fa00b016516371d1bf2d9275704efc1d0..56681599beebb634b258f33a0f1c26774815de13 100644 --- a/src/stralloc.h +++ b/src/stralloc.h @@ -124,7 +124,7 @@ struct pike_string *debug_findstring(const struct pike_string *foo); #ifndef PIKE_DEBUG static p_wchar2 generic_extract (const void *str, int size, ptrdiff_t pos) ATTRIBUTE((pure)); -static INLINE p_wchar2 generic_extract (const void *str, int size, ptrdiff_t pos) +static INLINE p_wchar2 __attribute__((unused)) generic_extract (const void *str, int size, ptrdiff_t pos) { /* this gives better code than a lot of other versions I have tested. @@ -137,7 +137,7 @@ expanded code for the oldINDEX_CHARP. return ((p_wchar2 *)str)[pos]; } -static INLINE p_wchar2 index_shared_string(const struct pike_string *s, ptrdiff_t pos) +static INLINE p_wchar2 __attribute__((unused)) index_shared_string(const struct pike_string *s, ptrdiff_t pos) { return generic_extract(s->str,s->size_shift,pos); } @@ -181,7 +181,7 @@ PMOD_EXPORT p_wchar2 index_shared_string(const struct pike_string *s, ptrdiff_t #define COMPARE_PCHARP(X,CMP,Y) LOW_COMPARE_PCHARP((X),CMP,(Y)) #endif -static INLINE PCHARP MKPCHARP(const void *ptr, int shift) +static INLINE PCHARP __attribute__((unused)) MKPCHARP(const void *ptr, int shift) { PCHARP tmp; tmp.ptr=(p_wchar0 *)ptr; @@ -473,14 +473,14 @@ PMOD_EXPORT p_wchar2 *require_wstring2(struct pike_string *s, /* Compat alias. */ #define do_really_free_pike_string do_free_unlinked_pike_string -static INLINE void string_builder_binary_strcat(struct string_builder *s, +static INLINE void __attribute__((unused)) string_builder_binary_strcat(struct string_builder *s, const char *str, ptrdiff_t len) { string_builder_binary_strcat0 (s, (const p_wchar0 *) str, len); } /* Note: Does not work 100% correctly with shift==2 strings. */ -static INLINE int string_has_null( struct pike_string *x ) +static INLINE int __attribute__((unused)) string_has_null( struct pike_string *x ) { INT32 min; if( !x->len ) return 0; diff --git a/src/svalue.h b/src/svalue.h index ba129c341bf7289103edb6ae9627f2c54ad00224..7359dbb2641194853a15716779c4edd71c214e57 100644 --- a/src/svalue.h +++ b/src/svalue.h @@ -485,20 +485,20 @@ if(REFCOUNTED_TYPE(T) && (S)->refs && (S)->refs[0] <= 0) {\ debug_check_type_hint ((SVALS), (NUM), (TYPE_HINT)) #ifdef DEBUG_MALLOC -static INLINE struct svalue *dmalloc_check_svalue(struct svalue *s, char *l) +static INLINE struct svalue __attribute__((unused)) *dmalloc_check_svalue(struct svalue *s, char *l) { if(s && REFCOUNTED_TYPE(TYPEOF(*s))) debug_malloc_update_location(s->u.refs,l); return s; } -static INLINE struct svalue *dmalloc_check_svalues(struct svalue *s, size_t num, char *l) +static INLINE struct svalue __attribute__((unused)) *dmalloc_check_svalues(struct svalue *s, size_t num, char *l) { while (num--) dmalloc_check_svalue (s + num, l); return s; } -static INLINE union anything *dmalloc_check_union(union anything *u,int type, char * l) +static INLINE union anything __attribute__((unused)) *dmalloc_check_union(union anything *u,int type, char * l) { if(u && REFCOUNTED_TYPE(type)) debug_malloc_update_location(u->refs,l); @@ -517,14 +517,14 @@ static INLINE union anything *dmalloc_check_union(union anything *u,int type, ch #endif /* !DEBUG_MALLOC */ /* To be used for type checking in macros. */ -static INLINE struct array *pass_array (struct array *a) {return a;} -static INLINE struct mapping *pass_mapping (struct mapping *m) {return m;} -static INLINE struct multiset *pass_multiset (struct multiset *l) {return l;} -static INLINE struct object *pass_object (struct object *o) {return o;} -static INLINE struct program *pass_program (struct program *p) {return p;} -static INLINE struct pike_string *pass_string (struct pike_string *s) {return s;} -static INLINE struct pike_type *pass_type (struct pike_type *t) {return t;} -static INLINE struct callable *pass_callable (struct callable *c) {return c;} +static INLINE struct array __attribute__((unused)) *pass_array (struct array *a) {return a;} +static INLINE struct mapping __attribute__((unused)) *pass_mapping (struct mapping *m) {return m;} +static INLINE struct multiset __attribute__((unused)) *pass_multiset (struct multiset *l) {return l;} +static INLINE struct object __attribute__((unused)) *pass_object (struct object *o) {return o;} +static INLINE struct program __attribute__((unused)) *pass_program (struct program *p) {return p;} +static INLINE struct pike_string __attribute__((unused)) *pass_string (struct pike_string *s) {return s;} +static INLINE struct pike_type __attribute__((unused)) *pass_type (struct pike_type *t) {return t;} +static INLINE struct callable __attribute__((unused)) *pass_callable (struct callable *c) {return c;} #else /* !PIKE_DEBUG */ @@ -794,7 +794,7 @@ int svalues_are_constant(const struct svalue *s, TYPE_FIELD hint, struct processing *p); -static INLINE TYPE_FIELD BITOF(struct svalue sv) { +static INLINE TYPE_FIELD __attribute__((unused)) BITOF(struct svalue sv) { if (TYPEOF(sv) >= sizeof(TYPE_FIELD) * 8) { return BIT_MIXED | BIT_UNFINISHED; } @@ -817,10 +817,10 @@ static INLINE TYPE_FIELD BITOF(struct svalue sv) { } while (0) #ifdef DEBUG_MALLOC -static INLINE TYPE_FIELD dmalloc_gc_mark_svalues (struct svalue *s, size_t num, char *l) +static INLINE TYPE_FIELD __attribute__((unused)) dmalloc_gc_mark_svalues (struct svalue *s, size_t num, char *l) {return real_gc_mark_svalues (dmalloc_check_svalues (s, num, l), num);} #define gc_mark_svalues(S, NUM) dmalloc_gc_mark_svalues ((S), (NUM), DMALLOC_LOCATION()) -static INLINE TYPE_FIELD dmalloc_gc_cycle_check_svalues (struct svalue *s, size_t num, char *l) +static INLINE TYPE_FIELD __attribute__((unused)) dmalloc_gc_cycle_check_svalues (struct svalue *s, size_t num, char *l) {return real_gc_cycle_check_svalues (dmalloc_check_svalues (s, num, l), num);} #define gc_cycle_check_svalues(S, NUM) dmalloc_gc_cycle_check_svalues ((S), (NUM), DMALLOC_LOCATION()) #else