diff options
author | Jan Moskyto Matejka <mq@ucw.cz> | 2016-10-14 15:37:04 +0200 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2016-11-01 14:52:54 +0100 |
commit | 3e236955c9369475872b9b86a58502fa777b50b9 (patch) | |
tree | d43b519c2289a353e56c32b42c402f9fa12d0e13 /lib | |
parent | 17fe57d8dcc89aea520788914b252cf49cf060ff (diff) |
Build: switch on -Wextra, get rid of most of the warnings
There are several unresolved -Wmissing-field-initializers on older
versions of GCC than 5.1, all of them false positive.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/birdlib.h | 7 | ||||
-rw-r--r-- | lib/hash.h | 8 | ||||
-rw-r--r-- | lib/socket.h | 2 |
3 files changed, 12 insertions, 5 deletions
diff --git a/lib/birdlib.h b/lib/birdlib.h index 904544cb..37337078 100644 --- a/lib/birdlib.h +++ b/lib/birdlib.h @@ -62,6 +62,13 @@ #define UNUSED __attribute__((unused)) #define PACKED __attribute__((packed)) +#ifdef IPV6 +#define UNUSED4 +#define UNUSED6 UNUSED +#else +#define UNUSED4 UNUSED +#define UNUSED6 +#endif /* Microsecond time */ @@ -2,7 +2,7 @@ #define HASH(type) struct { type **data; uint count, order; } #define HASH_TYPE(v) typeof(** (v).data) -#define HASH_SIZE(v) (1 << (v).order) +#define HASH_SIZE(v) (1U << (v).order) #define HASH_EQ(v,id,k1,k2...) (id##_EQ(k1, k2)) #define HASH_FN(v,id,key...) ((u32) (id##_FN(key)) >> (32 - (v).order)) @@ -116,12 +116,12 @@ #define HASH_MAY_RESIZE_DOWN_(v,pool,rehash_fn,args) \ ({ \ - int _o = (v).order; \ - while (((v).count < ((1 << _o) REHASH_LO_MARK(args))) && \ + uint _o = (v).order; \ + while (((v).count < ((1U << _o) REHASH_LO_MARK(args))) && \ (_o > (REHASH_LO_BOUND(args)))) \ _o -= (REHASH_LO_STEP(args)); \ if (_o < (v).order) \ - rehash_fn(&(v), pool, _o - (int) (v).order); \ + rehash_fn(&(v), pool, _o - (v).order); \ }) diff --git a/lib/socket.h b/lib/socket.h index 6babfa7b..2da52127 100644 --- a/lib/socket.h +++ b/lib/socket.h @@ -30,7 +30,7 @@ typedef struct birdsock { byte *rbuf, *rpos; /* NULL=allocate automatically */ uint fast_rx; /* RX has higher priority in event loop */ uint rbsize; - int (*rx_hook)(struct birdsock *, int size); /* NULL=receiving turned off, returns 1 to clear rx buffer */ + int (*rx_hook)(struct birdsock *, uint size); /* NULL=receiving turned off, returns 1 to clear rx buffer */ byte *tbuf, *tpos; /* NULL=allocate automatically */ byte *ttx; /* Internal */ |