mirror of git://gcc.gnu.org/git/gcc.git
PR libstdc++/85098 add missing definitions for static constants
In C++11 and C++14 any odr-use of these constants requires a definition at namespace-scope. In C++17 they are implicitly inline and so the namespace-scope redeclarations are redundant (and allowing them is deprecated). PR libstdc++/85098 * include/bits/regex.h [__cplusplus < 201703L] (basic_regex::icase) (basic_regex::nosubs, basic_regex::optimize, basic_regex::collate) (basic_regex::ECMAScript, basic_regex::basic, basic_regex::extended) (basic_regex::awk, basic_regex::grep, basic_regex::egrep): Add definitions. * include/bits/regex_automaton.h (_NFA::_M_insert_state): Adjust whitespace. * include/bits/regex_compiler.tcc (__INSERT_REGEX_MATCHER): Add braces around body of do-while. * testsuite/28_regex/basic_regex/85098.cc: New From-SVN: r260371
This commit is contained in:
parent
950ad0bafe
commit
2d76fab440
|
|
@ -1,3 +1,17 @@
|
||||||
|
2018-05-18 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
|
PR libstdc++/85098
|
||||||
|
* include/bits/regex.h [__cplusplus < 201703L] (basic_regex::icase)
|
||||||
|
(basic_regex::nosubs, basic_regex::optimize, basic_regex::collate)
|
||||||
|
(basic_regex::ECMAScript, basic_regex::basic, basic_regex::extended)
|
||||||
|
(basic_regex::awk, basic_regex::grep, basic_regex::egrep): Add
|
||||||
|
definitions.
|
||||||
|
* include/bits/regex_automaton.h (_NFA::_M_insert_state): Adjust
|
||||||
|
whitespace.
|
||||||
|
* include/bits/regex_compiler.tcc (__INSERT_REGEX_MATCHER): Add
|
||||||
|
braces around body of do-while.
|
||||||
|
* testsuite/28_regex/basic_regex/85098.cc: New
|
||||||
|
|
||||||
2018-05-17 Jonathan Wakely <jwakely@redhat.com>
|
2018-05-17 Jonathan Wakely <jwakely@redhat.com>
|
||||||
|
|
||||||
PR libstdc++/85818
|
PR libstdc++/85818
|
||||||
|
|
|
||||||
|
|
@ -776,6 +776,48 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11
|
||||||
_AutomatonPtr _M_automaton;
|
_AutomatonPtr _M_automaton;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#if __cplusplus < 201703L
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::icase;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::nosubs;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::optimize;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::collate;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::ECMAScript;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::basic;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::extended;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::awk;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::grep;
|
||||||
|
|
||||||
|
template<typename _Ch, typename _Tr>
|
||||||
|
constexpr regex_constants::syntax_option_type
|
||||||
|
basic_regex<_Ch, _Tr>::egrep;
|
||||||
|
#endif // ! C++17
|
||||||
|
|
||||||
#if __cpp_deduction_guides >= 201606
|
#if __cpp_deduction_guides >= 201606
|
||||||
template<typename _ForwardIterator>
|
template<typename _ForwardIterator>
|
||||||
basic_regex(_ForwardIterator, _ForwardIterator,
|
basic_regex(_ForwardIterator, _ForwardIterator,
|
||||||
|
|
|
||||||
|
|
@ -333,7 +333,7 @@ namespace __detail
|
||||||
"Number of NFA states exceeds limit. Please use shorter regex "
|
"Number of NFA states exceeds limit. Please use shorter regex "
|
||||||
"string, or use smaller brace expression, or make "
|
"string, or use smaller brace expression, or make "
|
||||||
"_GLIBCXX_REGEX_STATE_LIMIT larger.");
|
"_GLIBCXX_REGEX_STATE_LIMIT larger.");
|
||||||
return this->size()-1;
|
return this->size() - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Eliminate dummy node in this NFA to make it compact.
|
// Eliminate dummy node in this NFA to make it compact.
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ namespace __detail
|
||||||
}
|
}
|
||||||
|
|
||||||
#define __INSERT_REGEX_MATCHER(__func, ...)\
|
#define __INSERT_REGEX_MATCHER(__func, ...)\
|
||||||
do\
|
do {\
|
||||||
if (!(_M_flags & regex_constants::icase))\
|
if (!(_M_flags & regex_constants::icase))\
|
||||||
if (!(_M_flags & regex_constants::collate))\
|
if (!(_M_flags & regex_constants::collate))\
|
||||||
__func<false, false>(__VA_ARGS__);\
|
__func<false, false>(__VA_ARGS__);\
|
||||||
|
|
@ -306,7 +306,7 @@ namespace __detail
|
||||||
__func<true, false>(__VA_ARGS__);\
|
__func<true, false>(__VA_ARGS__);\
|
||||||
else\
|
else\
|
||||||
__func<true, true>(__VA_ARGS__);\
|
__func<true, true>(__VA_ARGS__);\
|
||||||
while (false)
|
} while (false)
|
||||||
|
|
||||||
template<typename _TraitsT>
|
template<typename _TraitsT>
|
||||||
bool
|
bool
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,45 @@
|
||||||
|
// Copyright (C) 2018 Free Software Foundation, Inc.
|
||||||
|
//
|
||||||
|
// This file is part of the GNU ISO C++ Library. This library is free
|
||||||
|
// software; you can redistribute it and/or modify it under the
|
||||||
|
// terms of the GNU General Public License as published by the
|
||||||
|
// Free Software Foundation; either version 3, or (at your option)
|
||||||
|
// any later version.
|
||||||
|
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
|
||||||
|
// You should have received a copy of the GNU General Public License along
|
||||||
|
// with this library; see the file COPYING3. If not see
|
||||||
|
// <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
// { dg-options "-O0" }
|
||||||
|
// { dg-do link { target c++11 } }
|
||||||
|
|
||||||
|
#include <regex>
|
||||||
|
|
||||||
|
void f(const std::regex_constants::syntax_option_type&) { }
|
||||||
|
|
||||||
|
void
|
||||||
|
test01()
|
||||||
|
{
|
||||||
|
f(std::regex::icase);
|
||||||
|
f(std::regex::nosubs);
|
||||||
|
f(std::regex::optimize);
|
||||||
|
f(std::regex::collate);
|
||||||
|
f(std::regex::ECMAScript);
|
||||||
|
f(std::regex::basic);
|
||||||
|
f(std::regex::extended);
|
||||||
|
f(std::regex::awk);
|
||||||
|
f(std::regex::grep);
|
||||||
|
f(std::regex::egrep);
|
||||||
|
// f(std::regex::multiline);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
test01();
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue