#pragma once
-#ifdef HAVE_STDNORETURN_H
+/***
+ *** Clang Compatibility Macros
+ ***/
+
+#if !defined(__has_c_attribute)
+#define __has_c_attribute(x) 0
+#endif /* if !defined(__has_c_attribute) */
+
+#if __has_c_attribute(noreturn)
+#define noreturn [[noreturn]]
+#elif defined(HAVE_STDNORETURN_H)
#include <stdnoreturn.h>
#elif HAVE_FUNC_ATTRIBUTE_NORETURN
#define noreturn __attribute__((noreturn))
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator)
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx)
#endif /* HAVE_FUNC_ATTRIBUTE_MALLOC */
+
+#if __has_c_attribute(fallthrough)
+#define FALLTHROUGH [[fallthrough]]
+#elif __GNUC__ >= 7 && !defined(__clang__)
+#define FALLTHROUGH __attribute__((fallthrough))
+#else
+/* clang-format off */
+#define FALLTHROUGH do {} while (0) /* FALLTHROUGH */
+/* clang-format on */
+#endif
+
+#if __has_c_attribute(maybe_unused)
+#define ISC_ATTR_UNUSED [[maybe_unused]]
+#else
+#define ISC_ATTR_UNUSED __attribute__((__unused__))
+#endif
* ISC_ or isc_ to the name.
*/
+#include <isc/attributes.h>
+
/***
*** Clang Compatibility Macros
***/
-#if !defined(__has_attribute)
-#define __has_attribute(x) 0
-#endif /* if !defined(__has_attribute) */
-
-#if !defined(__has_c_attribute)
-#define __has_c_attribute(x) 0
-#endif /* if !defined(__has_c_attribute) */
-
#if !defined(__has_feature)
#define __has_feature(x) 0
#endif /* if !defined(__has_feature) */