This fixes a warning seen with -Wsystem-headers:
include/c++/14.3.0/bits/regex_compiler.h:191:11: warning: case value '0' not in
enumerated type 'std::regex_constants::syntax_option_type' [-Wswitch]
191 | case _FlagT(0):
| ^~~~
There's no diagnostic on trunk since the flag_enum attribute was added
to the enum type in r15-3500-g1914ca8791ce4e.
libstdc++-v3/ChangeLog:
* include/bits/regex_compiler.h (_Compiler::_S_validate): Add
diagnostic pragma to disable -Wswitch warning.
---
Tested x86_64-llinux. Pushed to gcc-14.
As noted in the commit msg, the patch isn't needed for gcc-15 and trunk.
I might backport it for gcc-13 though.
libstdc++-v3/include/bits/regex_compiler.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libstdc++-v3/include/bits/regex_compiler.h
b/libstdc++-v3/include/bits/regex_compiler.h
index 5501d709e854..c6aaf4408531 100644
--- a/libstdc++-v3/include/bits/regex_compiler.h
+++ b/libstdc++-v3/include/bits/regex_compiler.h
@@ -188,8 +188,11 @@ namespace __detail
case grep:
case egrep:
return __f;
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wswitch" // do not warn about non-enumerator
case _FlagT(0):
return __f | ECMAScript;
+#pragma GCC diagnostic pop
default:
std::__throw_regex_error(_S_grammar, "conflicting grammar options");
}
--
2.51.0