From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH v2 2/2] clang-tidy: Suppress macro to enum conversion warnings
Date: Tue, 14 May 2024 00:57:58 +1000 [thread overview]
Message-ID: <20240513145758.713647-3-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20240513145758.713647-1-david@gibson.dropbear.id.au>
clang-tidy 18.1.1 in Fedora 40 complains about every #define of an integral
value, suggesting it be converted to an enum. Although that's certainly
possible, it's of dubious value and results in some awkward arrangements on
out codebase. Suppress it globally.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
Makefile | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index c1e1f06..8ea1757 100644
--- a/Makefile
+++ b/Makefile
@@ -257,6 +257,12 @@ docs: README.md
# we use. That sounds nice, but means it will often want a OS
# specific header instead of a mostly standard one, such as
# <linux/limits.h> instead of <limits.h>.
+#
+# - cppcoreguidelines-macro-to-enum
+# Want to replace all #defines of integers with enums. Kind of
+# makes sense when those defines form an enum-like set, but
+# weird for cases like standalone constants, and causes other
+# awkwardness for a bunch of cases we use
clang-tidy: $(SRCS) $(HEADERS)
clang-tidy -checks=*,-modernize-*,\
@@ -283,7 +289,8 @@ clang-tidy: $(SRCS) $(HEADERS)
-altera-struct-pack-align,\
-concurrency-mt-unsafe,\
-readability-identifier-length,\
- -misc-include-cleaner \
+ -misc-include-cleaner,\
+ -cppcoreguidelines-macro-to-enum \
-config='{CheckOptions: [{key: bugprone-suspicious-string-compare.WarnOnImplicitComparison, value: "false"}]}' \
--warnings-as-errors=* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -DCLANG_TIDY_58992
--
@@ -257,6 +257,12 @@ docs: README.md
# we use. That sounds nice, but means it will often want a OS
# specific header instead of a mostly standard one, such as
# <linux/limits.h> instead of <limits.h>.
+#
+# - cppcoreguidelines-macro-to-enum
+# Want to replace all #defines of integers with enums. Kind of
+# makes sense when those defines form an enum-like set, but
+# weird for cases like standalone constants, and causes other
+# awkwardness for a bunch of cases we use
clang-tidy: $(SRCS) $(HEADERS)
clang-tidy -checks=*,-modernize-*,\
@@ -283,7 +289,8 @@ clang-tidy: $(SRCS) $(HEADERS)
-altera-struct-pack-align,\
-concurrency-mt-unsafe,\
-readability-identifier-length,\
- -misc-include-cleaner \
+ -misc-include-cleaner,\
+ -cppcoreguidelines-macro-to-enum \
-config='{CheckOptions: [{key: bugprone-suspicious-string-compare.WarnOnImplicitComparison, value: "false"}]}' \
--warnings-as-errors=* $(SRCS) -- $(filter-out -pie,$(FLAGS) $(CFLAGS) $(CPPFLAGS)) -DCLANG_TIDY_58992
--
2.45.0
next prev parent reply other threads:[~2024-05-13 14:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-13 14:57 [PATCH v2 0/2] LLVM 18.1.1 / Fedora 40 clang-tidy fixes David Gibson
2024-05-13 14:57 ` [PATCH v2 1/2] conf: Fix clang-tidy warning about using an undefined enum value David Gibson
2024-05-13 14:57 ` David Gibson [this message]
2024-05-13 21:36 ` [PATCH v2 2/2] clang-tidy: Suppress macro to enum conversion warnings Stefano Brivio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240513145758.713647-3-david@gibson.dropbear.id.au \
--to=david@gibson.dropbear.id.au \
--cc=passt-dev@passt.top \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).