utils.h: add fallthrough macro
This can be used to silence clang warnings about unannotated fall-through Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
parent
b36a3a9009
commit
b8abed7494
1 changed files with 12 additions and 0 deletions
12
utils.h
12
utils.h
|
@ -227,6 +227,18 @@ int clock_gettime(int type, struct timespec *tv);
|
|||
#define __hidden __attribute__((visibility("hidden")))
|
||||
#endif
|
||||
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#ifndef fallthrough
|
||||
# if __has_attribute(__fallthrough__)
|
||||
# define fallthrough __attribute__((__fallthrough__))
|
||||
# else
|
||||
# define fallthrough do {} while (0) /* fallthrough */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int b64_encode(const void *src, size_t src_len,
|
||||
void *dest, size_t dest_len);
|
||||
|
||||
|
|
Loading…
Reference in a new issue