public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] libstdc++: Define basic_regex::multiline for non-strict modes
@ 2021-10-01 14:06 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2021-10-01 14:06 UTC (permalink / raw)
  To: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

The regex_constants::multiline constant is defined for non-strict C++11
and C++14 modes, on the basis that the feature is a DR (even though it
was really a new feature addition to C++17 and probably shouldn't have
gone through the issues list).

This makes the basic_regex::multiline constant defined consistently with
the regex_constants::multiline one.

For strict C++11 and C++14 mode we don't define them, because multiline
is not a reserved name in those standards.

libstdc++-v3/ChangeLog:

	* include/bits/regex.h (basic_regex::multiline): Define for
	non-strict C++11 and C++14 modes.
	* include/bits/regex_constants.h (regex_constants::multiline):
	Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment.

Tested x86_64-linux. Committed to trunk.


[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 2267 bytes --]

commit 17374dab3eefd282977ad90743c9aff97f2e41ce
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Fri Oct 1 14:06:42 2021

    libstdc++: Define basic_regex::multiline for non-strict modes
    
    The regex_constants::multiline constant is defined for non-strict C++11
    and C++14 modes, on the basis that the feature is a DR (even though it
    was really a new feature addition to C++17 and probably shouldn't have
    gone through the issues list).
    
    This makes the basic_regex::multiline constant defined consistently with
    the regex_constants::multiline one.
    
    For strict C++11 and C++14 mode we don't define them, because multiline
    is not a reserved name in those standards.
    
    libstdc++-v3/ChangeLog:
    
            * include/bits/regex.h (basic_regex::multiline): Define for
            non-strict C++11 and C++14 modes.
            * include/bits/regex_constants.h (regex_constants::multiline):
            Add _GLIBCXX_RESOLVE_LIB_DEFECTS comment.

diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h
index 664944b0ef2..ff908da3e94 100644
--- a/libstdc++-v3/include/bits/regex.h
+++ b/libstdc++-v3/include/bits/regex.h
@@ -424,7 +424,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
       static constexpr flag_type awk = regex_constants::awk;
       static constexpr flag_type grep = regex_constants::grep;
       static constexpr flag_type egrep = regex_constants::egrep;
-#if __cplusplus >= 201703L
+#if __cplusplus >= 201703L || !defined __STRICT_ANSI__
       static constexpr flag_type multiline = regex_constants::multiline;
 #endif
       ///@}
diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h
index af689ff93af..0fd2879c817 100644
--- a/libstdc++-v3/include/bits/regex_constants.h
+++ b/libstdc++-v3/include/bits/regex_constants.h
@@ -171,6 +171,8 @@ namespace regex_constants
     static_cast<syntax_option_type>(1 << _S_egrep);
 
 #if __cplusplus >= 201703L || !defined __STRICT_ANSI__
+  // _GLIBCXX_RESOLVE_LIB_DEFECTS
+  // 2503. multiline option should be added to syntax_option_type
   /**
    * Specifies that the `^` anchor matches at the beginning of a line,
    * and the `$` anchor matches at the end of a line, not only at the

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-01 14:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-01 14:06 [committed] libstdc++: Define basic_regex::multiline for non-strict modes Jonathan Wakely

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 read-only IMAP folder(s) and NNTP newsgroup(s).