From 294329da3a78f7a5c66ca41b7c0dfdf5ed615be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayd=C4=B1n=20Mercan?= Date: Mon, 18 Dec 2023 09:50:27 +0300 Subject: [PATCH 1/2] Use instead of directly in --- lib/isc/include/isc/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/isc/include/isc/types.h b/lib/isc/include/isc/types.h index 2c4a73be01..8a74a161aa 100644 --- a/lib/isc/include/isc/types.h +++ b/lib/isc/include/isc/types.h @@ -13,6 +13,7 @@ #pragma once +#include #include /*! \file isc/types.h @@ -20,7 +21,6 @@ * OS-specific types, from the OS-specific include directories. */ #include -#include #include #include #include From ca9a05f9ce767789106ab7296955640516555e61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayd=C4=B1n=20Mercan?= Date: Mon, 18 Dec 2023 11:38:59 +0300 Subject: [PATCH 2/2] Check for atomic operations consistency in checklibs.sh isc/atomic.h and its defined macros should be preferred over stdatomic.h and explicit atomic operations. Fix the redundant stdatomic.h header in histo.c found by the introduced check. --- lib/isc/histo.c | 1 - util/checklibs.sh | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/isc/histo.c b/lib/isc/histo.c index fa4ca5b06d..7aac5c36ca 100644 --- a/lib/isc/histo.c +++ b/lib/isc/histo.c @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/util/checklibs.sh b/util/checklibs.sh index fdb9bee494..e0f8c79d64 100755 --- a/util/checklibs.sh +++ b/util/checklibs.sh @@ -42,4 +42,26 @@ list=$(git grep -l uintptr_t lib bin \ echo "$list" } +# +# Check for the direct usage of stdatomic.h +# +list=$(git grep -l stdatomic.h lib bin ':(exclude)lib/isc/include/isc/atomic\.h' \ + | grep -e '\.c$' -e '\.h$') +[ -n "$list" ] && { + status=1 + echo 'Use #include instead of #include :' + echo "$list" +} + +# +# Check for the usage of explicit memory ordering +# +list=$(git grep -l memory_order_.* lib bin ':(exclude)lib/isc/include/isc/atomic\.h' \ + | grep -e '\.c$' -e '\.h$') +[ -n "$list" ] && { + status=1 + echo 'Prefer the helpers in over specifying an explicit memory order:' + echo "$list" +} + exit $status