From 5a958c5c1105baa42fea44b9169a9f6a486deab1 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 18 May 2021 23:08:01 +0800 Subject: [PATCH] libubox: backport upstream commit Backport: b8abed749423 utils.h: add fallthrough macro Fixes: #381 --- package/libs/libubox/Makefile | 2 +- .../patches/001-add-fallthrough-macro.patch | 37 +++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 package/libs/libubox/patches/001-add-fallthrough-macro.patch diff --git a/package/libs/libubox/Makefile b/package/libs/libubox/Makefile index 025f6489e7..71f5738ced 100644 --- a/package/libs/libubox/Makefile +++ b/package/libs/libubox/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=libubox -PKG_RELEASE=1 +PKG_RELEASE=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_URL=$(PROJECT_GIT)/project/libubox.git diff --git a/package/libs/libubox/patches/001-add-fallthrough-macro.patch b/package/libs/libubox/patches/001-add-fallthrough-macro.patch new file mode 100644 index 0000000000..37624f00da --- /dev/null +++ b/package/libs/libubox/patches/001-add-fallthrough-macro.patch @@ -0,0 +1,37 @@ +From b8abed7494238c22522b29814c4cc754e3c19d5a Mon Sep 17 00:00:00 2001 +From: Felix Fietkau +Date: Sun, 16 May 2021 17:31:57 +0200 +Subject: [PATCH] utils.h: add fallthrough macro + +This can be used to silence clang warnings about unannotated fall-through + +Signed-off-by: Felix Fietkau +--- + utils.h | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/utils.h b/utils.h +index 5c53cc0..dacac6e 100644 +--- a/utils.h ++++ b/utils.h +@@ -226,6 +226,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); + +-- +2.20.1