[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 2ce32a04 2/3: Enable '-Wdisabled-macro-expans
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 2ce32a04 2/3: Enable '-Wdisabled-macro-expansion' for clang |
Date: |
Sun, 10 Jul 2022 04:46:56 -0400 (EDT) |
branch: master
commit 2ce32a04777f75570c27e277ba98554be9ef0edf
Author: Gregory W. Chicares <gchicares@sbcglobal.net>
Commit: Gregory W. Chicares <gchicares@sbcglobal.net>
Enable '-Wdisabled-macro-expansion' for clang
---
compiler_clang_warnings.make | 2 --
pcre_regex.hpp | 13 +++++++++++++
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/compiler_clang_warnings.make b/compiler_clang_warnings.make
index 5ecde9e4..95d94de5 100644
--- a/compiler_clang_warnings.make
+++ b/compiler_clang_warnings.make
@@ -55,7 +55,6 @@ clang_c_warnings := \
# -Wcovered-switch-default: better to leave "default:" in place
# -Wdate-time: only for "bit-wise-identical reproducible compilations"
### -Wdeprecated-copy-with-dtor
-### -Wdisabled-macro-expansion
# -Wdocumentation: warns about comments
# -Wdocumentation-html: warns about comments
# -Wdocumentation-unknown-command: warns about comments
@@ -86,7 +85,6 @@ clang_cxx_warnings := \
-Wno-covered-switch-default \
-Wno-date-time \
-Wno-deprecated-copy-with-dtor \
- -Wno-disabled-macro-expansion \
-Wno-documentation \
-Wno-documentation-html \
-Wno-documentation-unknown-command \
diff --git a/pcre_regex.hpp b/pcre_regex.hpp
index 4034c924..036b11f0 100644
--- a/pcre_regex.hpp
+++ b/pcre_regex.hpp
@@ -28,6 +28,15 @@
// system, but not necessarily otherwise.
#if defined LMI_POSIX
+// Avoid spurious warnings about "recursive" expansion of PCRE2_SPTR (which
+// isn't really recursive at all). See:
+// https://lists.nongnu.org/archive/html/lmi/2022-07/msg00019.html
+// https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#268
+#if defined LMI_CLANG
+# pragma clang diagnostic push
+# pragma clang diagnostic ignored "-Wdisabled-macro-expansion"
+#endif // defined LMI_CLANG
+
// UTF-8 everywhere; UTF-[^8] nowhere.
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
@@ -575,6 +584,10 @@ search_all(std::string_view const& s, regex const& rx)
} // namespace pcre
+#if defined LMI_CLANG
+# pragma clang diagnostic pop
+#endif // defined LMI_CLANG
+
#endif // defined LMI_POSIX
#endif // pcre_regex_hpp