From 6d68a22954e6101f817dfbe9bc17d2e2a7782744 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 28 Apr 2022 06:56:56 +1000 Subject: [PATCH 1/2] Define local instances of FALLTHROUGH and UNREACHABLE FALLTHOUGH is a copy of how it is defined in UNREACHABLE follows the model used in MacOS /usr/include/c++/v1/cstdlib to determine if __builtin_ureachable is available --- contrib/dlz/modules/include/dlz_minimal.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/contrib/dlz/modules/include/dlz_minimal.h b/contrib/dlz/modules/include/dlz_minimal.h index 24ef250059..4f77dbba45 100644 --- a/contrib/dlz/modules/include/dlz_minimal.h +++ b/contrib/dlz/modules/include/dlz_minimal.h @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -85,6 +86,24 @@ typedef uint32_t dns_ttl_t; var = _u.v; \ } while (0) +#if !defined(__has_attribute) +#define __has_attribute(x) 0 +#endif /* if !defined(__has_attribute) */ + +#if __GNUC__ >= 7 || __has_attribute(fallthrough) +#define FALLTHROUGH __attribute__((fallthrough)) +#else +/* clang-format off */ +#define FALLTHROUGH do {} while (0) /* FALLTHROUGH */ +/* clang-format on */ +#endif + +#ifdef __GNUC__ +#define UNREACHABLE() __builtin_unreachable() +#else +#define UNREACHABLE() abort() +#endif + /* opaque structures */ typedef void *dns_sdlzlookup_t; typedef void *dns_sdlzallnodes_t; From c57363fb7d6b1a5ce9845849915e3e56d2be5ec0 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Thu, 28 Apr 2022 07:42:51 +1000 Subject: [PATCH 2/2] Add CHANGES note for [GL #3306] --- CHANGES | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES b/CHANGES index ef9cc4bbcf..16c041563a 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,5 @@ +5879. [contrib] dlz: Add FALLTHROUGH and UNREACHABLE macros. [GL #3306] + 5878. [func] Check the algorithm name or OID embedded at the start of the signature field for PRIVATEDNS and PRIVATEOID SIG and RRSIG records are well formed. [GL #3296]