]> gcc.gnu.org Git - gcc.git/commit
libstdc++: Simplify definition of std::regex_constants variables
authorJonathan Wakely <jwakely@redhat.com>
Tue, 14 Dec 2021 13:31:11 +0000 (13:31 +0000)
committerJonathan Wakely <jwakely@redhat.com>
Tue, 14 Dec 2021 21:45:45 +0000 (21:45 +0000)
commit63bb98e1c1eabaa9a68e8a6270663f2dfff047d8
tree008801da58d2fbf27e15866f335f813f5d2363bd
parent926d64906af2efc8714d37e6db2171784cfa60cd
libstdc++: Simplify definition of std::regex_constants variables

This removes the __syntax_option and __match_flag enumeration types,
which are only used to define enumerators with successive values that
are then used to initialize the std::regex_constants global variables.

By defining enumerators in the syntax_option_type and match_flag_type
enumeration types with the correct values for the globals we get rid of
two useless enumeration types that just count from 0 to N, and we
improve the debugging experience. Because the enumeration types now have
enumerators defined, GDB will print values in terms of those enumerators
e.g.

$6 = (std::regex_constants::_S_ECMAScript | std::regex_constants::_S_multiline)

Previously this would have been shown as simply 0x810 because there were
no enumerators of that type.

This changes the type and value of enumerators such as _S_grep, but
users should never be referring to them directly anyway.

libstdc++-v3/ChangeLog:

* include/bits/regex_constants.h (__syntax_option, __match_flag):
Remove.
(syntax_option_type, match_flag_type): Define enumerators.
Use to initialize globals. Add constexpr to compound assignment
operators.
* include/bits/regex_error.h (error_type): Add comment.
* testsuite/28_regex/constants/constexpr.cc: Remove comment.
* testsuite/28_regex/constants/error_type.cc: Improve comment.
* testsuite/28_regex/constants/match_flag_type.cc: Check bitmask
requirements.
* testsuite/28_regex/constants/syntax_option_type.cc: Likewise.
libstdc++-v3/include/bits/regex_constants.h
libstdc++-v3/include/bits/regex_error.h
libstdc++-v3/testsuite/28_regex/constants/constexpr.cc
libstdc++-v3/testsuite/28_regex/constants/error_type.cc
libstdc++-v3/testsuite/28_regex/constants/match_flag_type.cc
libstdc++-v3/testsuite/28_regex/constants/syntax_option_type.cc
This page took 0.063413 seconds and 5 git commands to generate.