diff options
Diffstat (limited to 'libmisc')
-rw-r--r-- | libmisc/include/libmisc/macro.h | 6 | ||||
-rw-r--r-- | libmisc/include/libmisc/obj.h | 2 | ||||
-rw-r--r-- | libmisc/tests/test_endian.c | 2 | ||||
-rw-r--r-- | libmisc/tests/test_obj_nest.c | 4 | ||||
-rw-r--r-- | libmisc/tests/test_rand.c | 2 |
5 files changed, 11 insertions, 5 deletions
diff --git a/libmisc/include/libmisc/macro.h b/libmisc/include/libmisc/macro.h index ae204ae..9ac29b9 100644 --- a/libmisc/include/libmisc/macro.h +++ b/libmisc/include/libmisc/macro.h @@ -11,6 +11,12 @@ #define LM_FORCE_SEMICOLON static_assert(1, "force semicolon") +#define LM_PARTIAL_SWITCH(VAL) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wswitch-enum\"") \ + switch (VAL) \ + _Pragma("GCC diagnostic pop") \ + /* for function definitions */ #define LM_UNUSED(argname) diff --git a/libmisc/include/libmisc/obj.h b/libmisc/include/libmisc/obj.h index 76dde91..d30a6f2 100644 --- a/libmisc/include/libmisc/obj.h +++ b/libmisc/include/libmisc/obj.h @@ -83,7 +83,7 @@ /** * `LO_NULL(iface_name)` is the null/nil/zero value for `lo_interface {iface_name}`. */ -#define LO_NULL(_ARG_iface_name) ((lo_interface _ARG_iface_name){0}) +#define LO_NULL(_ARG_iface_name) ((lo_interface _ARG_iface_name){}) /** * `LO_IS_NULL(iface_val)` returns whether `iface_val` is LO_NULL. diff --git a/libmisc/tests/test_endian.c b/libmisc/tests/test_endian.c index dcb3cc2..8c48727 100644 --- a/libmisc/tests/test_endian.c +++ b/libmisc/tests/test_endian.c @@ -11,7 +11,7 @@ #include "test.h" int main() { - uint8_t act[(2+4+8)*2] = {0}; + uint8_t act[(2+4+8)*2] = {}; size_t pos = 0; pos += uint16be_encode(&act[pos], UINT16_C(0x1234)); pos += uint32be_encode(&act[pos], UINT32_C(0x56789ABC)); diff --git a/libmisc/tests/test_obj_nest.c b/libmisc/tests/test_obj_nest.c index bb9d6de..d5e563e 100644 --- a/libmisc/tests/test_obj_nest.c +++ b/libmisc/tests/test_obj_nest.c @@ -63,10 +63,10 @@ static ssize_t myclass_write(struct myclass *self, void *buf, size_t count) { /* main test body *************************************************************/ int main() { - struct myclass _obj = {0}; + struct myclass _obj = {}; lo_interface read_writer obj = lo_box_myclass_as_read_writer(&_obj); test_assert(LO_CALL(obj, write, "Hello", 6) == 6); - char buf[6] = {0}; + char buf[6] = {}; test_assert(LO_CALL(obj, read, buf, 3) == 3); test_assert(memcmp(buf, "Hel\0\0\0", 6) == 0); return 0; diff --git a/libmisc/tests/test_rand.c b/libmisc/tests/test_rand.c index 3596d94..ecb1c49 100644 --- a/libmisc/tests/test_rand.c +++ b/libmisc/tests/test_rand.c @@ -50,7 +50,7 @@ static void test_n(uint64_t cnt) { #endif } else { double sum = 0; - bool seen[MAX_SEE_ALL] = {0}; + bool seen[MAX_SEE_ALL] = {}; for (int i = 0; i < ROUNDS; i++) { uint64_t val = rand_uint63n(cnt); sum += val; |