Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2021-05-16 18:31:57 +0300
committerFelix Fietkau <nbd@nbd.name>2021-05-16 18:32:00 +0300
commitb8abed7494238c22522b29814c4cc754e3c19d5a (patch)
tree581b1ebb03666568426200edca5fa07cf5d9b7a1
parentb36a3a90098db64a46029355e308897c97fbe13d (diff)
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>
-rw-r--r--utils.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index 5c53cc0..dacac6e 100644
--- a/utils.h
+++ b/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);