commit de66c340db896ed23a353e4b81f20b5f9b1aea51 Author: Richard Biener Date: Thu Apr 8 14:08:53 2021 +0200 Increment BASE-VER after release This increments BASE-VER to 10.3.1 after the 10.3.0 release. 2021-04-08 Richard Biener * BASE-VER: Set to 10.3.1. diff --git a/gcc/BASE-VER b/gcc/BASE-VER index 0719d810258..a9368325816 100644 --- a/gcc/BASE-VER +++ b/gcc/BASE-VER @@ -1 +1 @@ -10.3.0 +10.3.1 commit 890922a9053294dcc0f785e328d5aae30eac226e Author: Jonathan Wakely Date: Thu Apr 8 14:47:47 2021 +0100 libstdc++: Fix Doxygen warning about ambiguous file name libstdc++-v3/ChangeLog: * include/std/string_view: Adjust Doxygen @file comment. (cherry picked from commit 2c1557ac7b7652c63418abac1a1c4b7a9860a9f9) diff --git a/libstdc++-v3/include/std/string_view b/libstdc++-v3/include/std/string_view index f05ff32d9e5..da23f9bc855 100644 --- a/libstdc++-v3/include/std/string_view +++ b/libstdc++-v3/include/std/string_view @@ -22,7 +22,7 @@ // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see // . -/** @file string_view +/** @file include/string_view * This is a Standard C++ Library header. */ commit 7f7b5af79bba9cddfd5434e5788f7cc3bfe69d7c Author: Jonathan Wakely Date: Thu Apr 8 14:48:23 2021 +0100 maintainer-scripts: Disable multilib when generating libstdc++ docs This allows the docs to be generated on hosts without the necessary files present for multilib support. maintainer-scripts/ChangeLog: * generate_libstdcxx_web_docs: Add --disable-multilib to configure command. (cherry picked from commit acbbb82ea3e2ae145e59ffca6f1ec0699b5f7383) diff --git a/maintainer-scripts/generate_libstdcxx_web_docs b/maintainer-scripts/generate_libstdcxx_web_docs index 74886356bc7..29572172761 100755 --- a/maintainer-scripts/generate_libstdcxx_web_docs +++ b/maintainer-scripts/generate_libstdcxx_web_docs @@ -43,7 +43,7 @@ do [ $dir == 'libstdc++-v3' ] || disabled_libs="$disabled_libs --disable-$dir" done set -x -${SRCDIR}/configure --enable-languages=c,c++ --disable-gcc $disabled_libs --docdir=/docs +${SRCDIR}/configure --enable-languages=c,c++ --disable-gcc --disable-multilib $disabled_libs --docdir=/docs eval `grep '^target=' config.log` make configure-target # If the following step fails with an error like commit e6368402182f18694d152bf6d7695b9f3dcc988c Author: Jonathan Wakely Date: Tue Apr 6 15:52:19 2021 +0100 libstdc++: Fix doxygen markup for group close commands A change in Doxygen 1.8.16 means that "// @}" is no longer recognized by Doxygen, so doesn't close a @{ group. A "///" comment needs to be used. libstdc++-v3/ChangeLog: * include/bits/atomic_base.h: Fix doxygen group close. * include/bits/basic_ios.h: Likewise. * include/bits/forward_list.h: Likewise. * include/bits/fs_dir.h: Likewise. * include/bits/fs_ops.h: Likewise. * include/bits/fs_path.h: Likewise. * include/bits/functional_hash.h: Likewise. * include/bits/gslice.h: Likewise. * include/bits/gslice_array.h: Likewise. * include/bits/hashtable_policy.h: Likewise. * include/bits/indirect_array.h: Likewise. * include/bits/locale_classes.h: Likewise. * include/bits/locale_facets.h: Likewise. * include/bits/locale_facets_nonio.h: Likewise. * include/bits/mask_array.h: Likewise. * include/bits/refwrap.h: Likewise. * include/bits/regex.h: Likewise. * include/bits/regex_automaton.h: Likewise. * include/bits/regex_compiler.h: Likewise. * include/bits/regex_constants.h: Likewise. * include/bits/regex_error.h: Likewise. * include/bits/regex_executor.h: Likewise. * include/bits/regex_scanner.h: Likewise. * include/bits/shared_ptr.h: Likewise. * include/bits/shared_ptr_atomic.h: Likewise. * include/bits/shared_ptr_base.h: Likewise. * include/bits/slice_array.h: Likewise. * include/bits/specfun.h: Likewise. * include/bits/std_function.h: Likewise. * include/bits/std_mutex.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_iterator.h: Likewise. * include/bits/stl_iterator_base_types.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_numeric.h: Likewise. * include/bits/stl_pair.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_uninitialized.h: Likewise. * include/bits/stream_iterator.h: Likewise. * include/bits/streambuf_iterator.h: Likewise. * include/bits/unique_ptr.h: Likewise. * include/bits/unordered_map.h: Likewise. * include/bits/unordered_set.h: Likewise. * include/decimal/decimal: Likewise. * include/experimental/any: Likewise. * include/experimental/array: Likewise. * include/experimental/bits/fs_dir.h: Likewise. * include/experimental/bits/fs_fwd.h: Likewise. * include/experimental/bits/fs_ops.h: Likewise. * include/experimental/bits/fs_path.h: Likewise. * include/experimental/buffer: Likewise. * include/experimental/internet: Likewise. * include/experimental/optional: Likewise. * include/experimental/propagate_const: Likewise. * include/experimental/socket: Likewise. * include/ext/pb_ds/assoc_container.hpp: Likewise. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Likewise. * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise. * include/ext/pb_ds/detail/types_traits.hpp: Likewise. * include/ext/pb_ds/exception.hpp: Likewise. * include/ext/pb_ds/priority_queue.hpp: Likewise. * include/ext/pb_ds/tag_and_trait.hpp: Likewise. * include/ext/random: Likewise. * include/std/any: Likewise. * include/std/atomic: Likewise. * include/std/bitset: Likewise. * include/std/chrono: Likewise. * include/std/complex: Likewise. * include/std/condition_variable: Likewise. * include/std/fstream: Likewise. * include/std/future: Likewise. * include/std/istream: Likewise. * include/std/iostream: Likewise. * include/std/mutex: Likewise. * include/std/numeric: Likewise. * include/std/ostream: Likewise. * include/std/ratio: Likewise. * include/std/shared_mutex: Likewise. * include/std/stdexcept: Likewise. * include/std/streambuf: Likewise. * include/std/system_error: Likewise. * include/std/valarray: Likewise. * include/std/variant: Likewise. * include/tr1/cmath: Likewise. * include/tr1/regex: Likewise. * include/tr2/dynamic_bitset: Likewise. * libsupc++/atomic_lockfree_defines.h: Likewise. * libsupc++/exception: Likewise. * libsupc++/exception.h: Likewise. * libsupc++/exception_ptr.h: Likewise. * libsupc++/nested_exception.h: Likewise. (cherry picked from commit f0b883464c58cb2f3f521776e65008b1fa75f79e) diff --git a/libstdc++-v3/include/bits/atomic_base.h b/libstdc++-v3/include/bits/atomic_base.h index 41d5928e482..fe2a2453265 100644 --- a/libstdc++-v3/include/bits/atomic_base.h +++ b/libstdc++-v3/include/bits/atomic_base.h @@ -1695,7 +1695,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++2a - // @} group atomics + /// @} group atomics _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/basic_ios.h b/libstdc++-v3/include/bits/basic_ios.h index 2771756bbc9..5b23240573f 100644 --- a/libstdc++-v3/include/bits/basic_ios.h +++ b/libstdc++-v3/include/bits/basic_ios.h @@ -67,7 +67,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class basic_ios : public ios_base { public: - //@{ + ///@{ /** * These are standard types. They permit a standardized way of * referring to names of (or names dependent on) the template @@ -78,9 +78,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename _Traits::pos_type pos_type; typedef typename _Traits::off_type off_type; typedef _Traits traits_type; - //@} + ///@} - //@{ + ///@{ /** * These are non-standard types. */ @@ -89,7 +89,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __num_put_type; typedef num_get<_CharT, istreambuf_iterator<_CharT, _Traits> > __num_get_type; - //@} + ///@} // Data members: protected: @@ -106,7 +106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const __num_get_type* _M_num_get; public: - //@{ + ///@{ /** * @brief The quick-and-easy status check. * @@ -124,7 +124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool operator!() const { return this->fail(); } - //@} + ///@} /** * @brief Returns the error state of the stream buffer. diff --git a/libstdc++-v3/include/bits/forward_list.h b/libstdc++-v3/include/bits/forward_list.h index 49b2a973718..fd08bb83f51 100644 --- a/libstdc++-v3/include/bits/forward_list.h +++ b/libstdc++-v3/include/bits/forward_list.h @@ -1152,7 +1152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER splice_after(const_iterator __pos, forward_list&, const_iterator __before, const_iterator __last) noexcept { _M_splice_after(__pos, __before, __last); } - // @} + /// @} private: #if __cplusplus > 201703L diff --git a/libstdc++-v3/include/bits/fs_dir.h b/libstdc++-v3/include/bits/fs_dir.h index 686dfce6e5f..36a50c109c1 100644 --- a/libstdc++-v3/include/bits/fs_dir.h +++ b/libstdc++-v3/include/bits/fs_dir.h @@ -455,7 +455,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline directory_iterator end(directory_iterator) noexcept { return directory_iterator(); } - // @} + /// @} /// Iterator type for recursively traversing a directory hierarchy. class recursive_directory_iterator @@ -553,11 +553,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 inline recursive_directory_iterator end(recursive_directory_iterator) noexcept { return recursive_directory_iterator(); } - // @} + /// @} _GLIBCXX_END_NAMESPACE_CXX11 - // @} group filesystem + /// @} group filesystem } // namespace filesystem // Use explicit instantiations of these types. Any inconsistency in the diff --git a/libstdc++-v3/include/bits/fs_ops.h b/libstdc++-v3/include/bits/fs_ops.h index 11efdcbb5ba..26a29b25de5 100644 --- a/libstdc++-v3/include/bits/fs_ops.h +++ b/libstdc++-v3/include/bits/fs_ops.h @@ -302,7 +302,7 @@ namespace filesystem path weakly_canonical(const path& __p); path weakly_canonical(const path& __p, error_code& __ec); - // @} group filesystem + /// @} group filesystem } // namespace filesystem _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h index 0b9911e638a..3d341916db5 100644 --- a/libstdc++-v3/include/bits/fs_path.h +++ b/libstdc++-v3/include/bits/fs_path.h @@ -1340,7 +1340,7 @@ namespace __detail return _M_at_end == __rhs._M_at_end; } - // @} group filesystem + /// @} group filesystem _GLIBCXX_END_NAMESPACE_CXX11 } // namespace filesystem diff --git a/libstdc++-v3/include/bits/functional_hash.h b/libstdc++-v3/include/bits/functional_hash.h index 6ca79154fe0..61dd9cc0c84 100644 --- a/libstdc++-v3/include/bits/functional_hash.h +++ b/libstdc++-v3/include/bits/functional_hash.h @@ -269,7 +269,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #endif - // @} group hashes + /// @} group hashes // Hint about performance of hash functor. If not fast the hash-based // containers will cache the hash code. diff --git a/libstdc++-v3/include/bits/gslice.h b/libstdc++-v3/include/bits/gslice.h index b252c3c1f0f..a793ea774df 100644 --- a/libstdc++-v3/include/bits/gslice.h +++ b/libstdc++-v3/include/bits/gslice.h @@ -177,7 +177,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return *this; } - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/gslice_array.h b/libstdc++-v3/include/bits/gslice_array.h index 89fdda537a4..da60e3bf3c7 100644 --- a/libstdc++-v3/include/bits/gslice_array.h +++ b/libstdc++-v3/include/bits/gslice_array.h @@ -215,7 +215,7 @@ _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/hashtable_policy.h b/libstdc++-v3/include/bits/hashtable_policy.h index ef120134914..d34fc39a973 100644 --- a/libstdc++-v3/include/bits/hashtable_policy.h +++ b/libstdc++-v3/include/bits/hashtable_policy.h @@ -2099,7 +2099,7 @@ namespace __detail __bucket_alloc_traits::deallocate(__alloc, __ptr, __bkt_count); } - //@} hashtable-detail + ///@} hashtable-detail } // namespace __detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/indirect_array.h b/libstdc++-v3/include/bits/indirect_array.h index 11fac329036..9d75219a741 100644 --- a/libstdc++-v3/include/bits/indirect_array.h +++ b/libstdc++-v3/include/bits/indirect_array.h @@ -204,7 +204,7 @@ _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/locale_classes.h b/libstdc++-v3/include/bits/locale_classes.h index ab90682cde2..dc446d71907 100644 --- a/libstdc++-v3/include/bits/locale_classes.h +++ b/libstdc++-v3/include/bits/locale_classes.h @@ -85,7 +85,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template friend struct __use_cache; - //@{ + ///@{ /** * @brief Category values. * @@ -104,7 +104,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static const category messages = 1L << 5; static const category all = (ctype | numeric | collate | time | monetary | messages); - //@} + ///@} // Construct/copy/destroy: @@ -645,11 +645,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; - //@} + ///@} protected: // Underlying "C" library locale information saved from @@ -818,11 +818,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class _GLIBCXX_NAMESPACE_CXX11 collate_byname : public collate<_CharT> { public: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; - //@} + ///@} explicit collate_byname(const char* __s, size_t __refs = 0) diff --git a/libstdc++-v3/include/bits/locale_facets.h b/libstdc++-v3/include/bits/locale_facets.h index 3e0ae8776c9..7b9a1208798 100644 --- a/libstdc++-v3/include/bits/locale_facets.h +++ b/libstdc++-v3/include/bits/locale_facets.h @@ -1671,11 +1671,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; - //@} + ///@} typedef __numpunct_cache<_CharT> __cache_type; protected: @@ -1953,11 +1953,11 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -2000,7 +2000,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL ios_base::iostate& __err, bool& __v) const { return this->do_get(__in, __end, __io, __err, __v); } - //@{ + ///@{ /** * @brief Numeric parsing. * @@ -2063,9 +2063,9 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL ios_base::iostate& __err, unsigned long long& __v) const { return this->do_get(__in, __end, __io, __err, __v); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Numeric parsing. * @@ -2106,7 +2106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL get(iter_type __in, iter_type __end, ios_base& __io, ios_base::iostate& __err, long double& __v) const { return this->do_get(__in, __end, __io, __err, __v); } - //@} + ///@} /** * @brief Numeric parsing. @@ -2193,7 +2193,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL return __ret; } - //@{ + ///@{ /** * @brief Numeric parsing. * @@ -2270,7 +2270,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL do_get(iter_type, iter_type, ios_base&, ios_base::iostate&, long double&) const; #endif - //@} + ///@} }; template @@ -2294,11 +2294,11 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -2332,7 +2332,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL put(iter_type __s, ios_base& __io, char_type __fill, bool __v) const { return this->do_put(__s, __io, __fill, __v); } - //@{ + ///@{ /** * @brief Numeric formatting. * @@ -2389,9 +2389,9 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL unsigned long long __v) const { return this->do_put(__s, __io, __fill, __v); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Numeric formatting. * @@ -2441,7 +2441,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL put(iter_type __s, ios_base& __io, char_type __fill, long double __v) const { return this->do_put(__s, __io, __fill, __v); } - //@} + ///@} /** * @brief Numeric formatting. @@ -2492,7 +2492,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL virtual ~num_put() { } - //@{ + ///@{ /** * @brief Numeric formatting. * @@ -2550,7 +2550,7 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL virtual iter_type do_put(iter_type, ios_base&, char_type, long double) const; #endif - //@} + ///@} }; template diff --git a/libstdc++-v3/include/bits/locale_facets_nonio.h b/libstdc++-v3/include/bits/locale_facets_nonio.h index b76eac435bd..a8dbce2eb9c 100644 --- a/libstdc++-v3/include/bits/locale_facets_nonio.h +++ b/libstdc++-v3/include/bits/locale_facets_nonio.h @@ -369,11 +369,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -798,11 +798,11 @@ _GLIBCXX_END_NAMESPACE_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -1025,11 +1025,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; - //@} + ///@} typedef __moneypunct_cache<_CharT, _Intl> __cache_type; private: @@ -1201,7 +1201,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 frac_digits() const { return this->do_frac_digits(); } - //@{ + ///@{ /** * @brief Return pattern for money values. * @@ -1240,7 +1240,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 pattern neg_format() const { return this->do_neg_format(); } - //@} + ///@} protected: /// Destructor. @@ -1469,12 +1469,12 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _InIter iter_type; typedef basic_string<_CharT> string_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -1621,12 +1621,12 @@ _GLIBCXX_BEGIN_NAMESPACE_LDBL_OR_CXX11 class money_put : public locale::facet { public: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef _OutIter iter_type; typedef basic_string<_CharT> string_type; - //@} + ///@} /// Numpunct facet id. static locale::id id; @@ -1800,11 +1800,11 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 { public: // Types: - //@{ + ///@{ /// Public typedefs typedef _CharT char_type; typedef basic_string<_CharT> string_type; - //@} + ///@} protected: // Underlying "C" library locale information saved from diff --git a/libstdc++-v3/include/bits/mask_array.h b/libstdc++-v3/include/bits/mask_array.h index 579cd59e59a..845a1d6570a 100644 --- a/libstdc++-v3/include/bits/mask_array.h +++ b/libstdc++-v3/include/bits/mask_array.h @@ -205,7 +205,7 @@ _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/refwrap.h b/libstdc++-v3/include/bits/refwrap.h index 717aa01629c..4b84ac7f039 100644 --- a/libstdc++-v3/include/bits/refwrap.h +++ b/libstdc++-v3/include/bits/refwrap.h @@ -391,7 +391,7 @@ _GLIBCXX_MEM_FN_TRAITS(&& noexcept, false_type, true_type) cref(reference_wrapper<_Tp> __t) noexcept { return { __t.get() }; } - // @} + /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 4032fd7559b..43d0ddb61bf 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -402,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * @name Constants * std [28.8.1](1) */ - //@{ + ///@{ static constexpr flag_type icase = regex_constants::icase; static constexpr flag_type nosubs = regex_constants::nosubs; static constexpr flag_type optimize = regex_constants::optimize; @@ -413,7 +413,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; - //@} + ///@} // [7.8.2] construct/copy/destroy /** @@ -940,7 +940,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 int compare(const value_type* __s) const { return this->_M_str().compare(__s); } - // @} + /// @} /// @cond undocumented // Non-standard, used by comparison operators @@ -1648,7 +1648,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 const sub_match<_Bi_iter>& __m) { return __os << __m.str(); } - // @} relates sub_match + /// @} relates sub_match // [7.10] Class template match_results @@ -1702,7 +1702,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** * @name 28.10 Public Types */ - //@{ + ///@{ typedef sub_match<_Bi_iter> value_type; typedef const value_type& const_reference; typedef value_type& reference; @@ -1713,13 +1713,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef _Alloc allocator_type; typedef typename __iter_traits::value_type char_type; typedef std::basic_string string_type; - //@} + ///@} public: /** * @name 28.10.1 Construction, Copying, and Destruction */ - //@{ + ///@{ /** * @brief Constructs a default %match_results container. @@ -1763,7 +1763,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 */ ~match_results() = default; - //@} + ///@} // 28.10.2, state: /** @@ -1776,7 +1776,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** * @name 28.10.2 Size */ - //@{ + ///@{ /** * @brief Gets the number of matches and submatches. @@ -1804,12 +1804,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 empty() const noexcept { return size() == 0; } - //@} + ///@} /** * @name 28.10.4 Element Access */ - //@{ + ///@{ /** * @brief Gets the length of the indicated submatch. @@ -1929,7 +1929,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 cend() const noexcept { return this->end(); } - //@} + ///@} /** * @name 28.10.5 Formatting @@ -1939,7 +1939,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * escape sequences accepted by these functions are determined by * their @p flags parameter as documented above. */ - //@{ + ///@{ /** * @pre ready() == true @@ -1990,12 +1990,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 return __result; } - //@} + ///@} /** * @name 28.10.6 Allocator */ - //@{ + ///@{ /** * @brief Gets a copy of the allocator. @@ -2004,12 +2004,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 get_allocator() const noexcept { return _Base_type::get_allocator(); } - //@} + ///@} /** * @name 28.10.7 Swap */ - //@{ + ///@{ /** * @brief Swaps the contents of two match_results. @@ -2021,7 +2021,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _Base_type::swap(__that); swap(_M_begin, __that._M_begin); } - //@} + ///@} private: template @@ -2148,7 +2148,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 /** * @name Matching, Searching, and Replacing */ - //@{ + ///@{ /** * @brief Determines if there is a match between the regular expression @p e @@ -2610,7 +2610,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 return __result; } - //@} + ///@} _GLIBCXX_BEGIN_NAMESPACE_CXX11 @@ -2973,7 +2973,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 typedef regex_token_iterator wsregex_token_iterator; #endif - //@} // group regex + ///@} // group regex _GLIBCXX_END_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/regex_automaton.h b/libstdc++-v3/include/bits/regex_automaton.h index d1ef05d1477..b7165f19cec 100644 --- a/libstdc++-v3/include/bits/regex_automaton.h +++ b/libstdc++-v3/include/bits/regex_automaton.h @@ -392,7 +392,7 @@ namespace __detail _StateIdT _M_end; }; - //@} regex-detail + ///@} regex-detail } // namespace __detail _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/bits/regex_compiler.h b/libstdc++-v3/include/bits/regex_compiler.h index e68c4184c5a..809ae419f5e 100644 --- a/libstdc++-v3/include/bits/regex_compiler.h +++ b/libstdc++-v3/include/bits/regex_compiler.h @@ -552,7 +552,7 @@ namespace __detail #endif }; - //@} regex-detail + ///@} regex-detail } // namespace __detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h index 5f096ac6226..8322dac0eca 100644 --- a/libstdc++-v3/include/bits/regex_constants.h +++ b/libstdc++-v3/include/bits/regex_constants.h @@ -50,7 +50,7 @@ namespace regex_constants /** * @name 5.1 Regular Expression Syntax Options */ - //@{ + ///@{ enum __syntax_option { _S_icase, @@ -216,7 +216,7 @@ namespace regex_constants operator^=(syntax_option_type& __a, syntax_option_type __b) { return __a = __a ^ __b; } - //@} + ///@} /** * @name 5.2 Matching Rules @@ -227,7 +227,7 @@ namespace regex_constants * below for any bitmask elements set. * */ - //@{ + ///@{ enum __match_flag { @@ -407,7 +407,7 @@ namespace regex_constants operator^=(match_flag_type& __a, match_flag_type __b) { return __a = __a ^ __b; } - //@} + ///@} } // namespace regex_constants /* @} */ // group regex diff --git a/libstdc++-v3/include/bits/regex_error.h b/libstdc++-v3/include/bits/regex_error.h index 09e9288788c..b150002ceff 100644 --- a/libstdc++-v3/include/bits/regex_error.h +++ b/libstdc++-v3/include/bits/regex_error.h @@ -44,7 +44,7 @@ namespace regex_constants /** * @name 5.3 Error Types */ - //@{ + ///@{ enum error_type { @@ -119,7 +119,7 @@ namespace regex_constants */ constexpr error_type error_stack(_S_error_stack); - //@} + ///@} } // namespace regex_constants // [7.8] Class regex_error @@ -161,7 +161,7 @@ namespace regex_constants friend void __throw_regex_error(regex_constants::error_type, const char*); }; - //@} // group regex + ///@} // group regex void __throw_regex_error(regex_constants::error_type __ecode); diff --git a/libstdc++-v3/include/bits/regex_executor.h b/libstdc++-v3/include/bits/regex_executor.h index b66c1280454..599928d79a7 100644 --- a/libstdc++-v3/include/bits/regex_executor.h +++ b/libstdc++-v3/include/bits/regex_executor.h @@ -250,7 +250,7 @@ namespace __detail bool _M_has_sol; }; - //@} regex-detail + ///@} regex-detail } // namespace __detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/regex_scanner.h b/libstdc++-v3/include/bits/regex_scanner.h index 0fc3ed41078..93ef4c66f38 100644 --- a/libstdc++-v3/include/bits/regex_scanner.h +++ b/libstdc++-v3/include/bits/regex_scanner.h @@ -264,7 +264,7 @@ namespace __detail void (_Scanner::* _M_eat_escape)(); }; - //@} regex-detail + ///@} regex-detail } // namespace __detail _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/shared_ptr.h b/libstdc++-v3/include/bits/shared_ptr.h index 0c393e23132..0baec4e0882 100644 --- a/libstdc++-v3/include/bits/shared_ptr.h +++ b/libstdc++-v3/include/bits/shared_ptr.h @@ -661,7 +661,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++20 #endif // C++17 - // @} + /// @} /** * @brief A non-owning observer for a pointer owned by a shared_ptr @@ -888,8 +888,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } }; - // @} relates shared_ptr - // @} group pointer_abstractions + /// @} relates shared_ptr + /// @} group pointer_abstractions #if __cplusplus >= 201703L namespace __detail::__variant diff --git a/libstdc++-v3/include/bits/shared_ptr_atomic.h b/libstdc++-v3/include/bits/shared_ptr_atomic.h index 13eb7f44a82..ce2e260702d 100644 --- a/libstdc++-v3/include/bits/shared_ptr_atomic.h +++ b/libstdc++-v3/include/bits/shared_ptr_atomic.h @@ -87,7 +87,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION atomic_is_lock_free(const shared_ptr<_Tp>* __p) { return std::atomic_is_lock_free<_Tp, __default_lock_policy>(__p); } - // @} + /// @} /** * @brief Atomic load for shared_ptr objects. @@ -123,7 +123,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline __shared_ptr<_Tp, _Lp> atomic_load(const __shared_ptr<_Tp, _Lp>* __p) { return std::atomic_load_explicit(__p, memory_order_seq_cst); } - // @} + /// @} /** * @brief Atomic store for shared_ptr objects. @@ -162,7 +162,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline void atomic_store(__shared_ptr<_Tp, _Lp>* __p, __shared_ptr<_Tp, _Lp> __r) { std::atomic_store_explicit(__p, std::move(__r), memory_order_seq_cst); } - // @} + /// @} /** * @brief Atomic exchange for shared_ptr objects. @@ -207,7 +207,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::atomic_exchange_explicit(__p, std::move(__r), memory_order_seq_cst); } - // @} + /// @} /** * @brief Atomic compare-and-swap for shared_ptr objects. @@ -325,10 +325,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::atomic_compare_exchange_weak_explicit(__p, __v, std::move(__w), memory_order_seq_cst, memory_order_seq_cst); } - // @} + /// @} - // @} relates shared_ptr - // @} group pointer_abstractions + /// @} relates shared_ptr + /// @} group pointer_abstractions _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/shared_ptr_base.h b/libstdc++-v3/include/bits/shared_ptr_base.h index ff578e66117..f0232c36be9 100644 --- a/libstdc++-v3/include/bits/shared_ptr_base.h +++ b/libstdc++-v3/include/bits/shared_ptr_base.h @@ -1362,7 +1362,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool owner_before(__weak_ptr<_Tp1, _Lp> const& __rhs) const noexcept { return _M_refcount._M_less(__rhs._M_refcount); } - // @} + /// @} protected: // This constructor is non-standard, it is used by allocate_shared. diff --git a/libstdc++-v3/include/bits/slice_array.h b/libstdc++-v3/include/bits/slice_array.h index de33342e252..d875fc225b3 100644 --- a/libstdc++-v3/include/bits/slice_array.h +++ b/libstdc++-v3/include/bits/slice_array.h @@ -276,7 +276,7 @@ _DEFINE_VALARRAY_OPERATOR(>>, __shift_right) #undef _DEFINE_VALARRAY_OPERATOR - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/specfun.h b/libstdc++-v3/include/bits/specfun.h index f85d15d4d46..60cba06d011 100644 --- a/libstdc++-v3/include/bits/specfun.h +++ b/libstdc++-v3/include/bits/specfun.h @@ -1196,7 +1196,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __detail::__sph_neumann<__type>(__n, __x); } - // @} group mathsf + /// @} group mathsf _GLIBCXX_END_NAMESPACE_VERSION } // namespace std @@ -1380,7 +1380,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return std::__detail::__hyperg<__type>(__a, __b, __c, __x); } - // @} + /// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace __gnu_cxx #endif // __STRICT_ANSI__ diff --git a/libstdc++-v3/include/bits/std_function.h b/libstdc++-v3/include/bits/std_function.h index e2bf9b91850..8c5aba56787 100644 --- a/libstdc++-v3/include/bits/std_function.h +++ b/libstdc++-v3/include/bits/std_function.h @@ -537,7 +537,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template _Functor* target() noexcept; template const _Functor* target() const noexcept; - // @} + /// @} #endif private: diff --git a/libstdc++-v3/include/bits/std_mutex.h b/libstdc++-v3/include/bits/std_mutex.h index 56c853a3fdc..2e92a1a40d3 100644 --- a/libstdc++-v3/include/bits/std_mutex.h +++ b/libstdc++-v3/include/bits/std_mutex.h @@ -171,7 +171,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION mutex_type& _M_device; }; - // @} group mutexes + /// @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace #endif // C++11 diff --git a/libstdc++-v3/include/bits/stl_deque.h b/libstdc++-v3/include/bits/stl_deque.h index 3959dd7899d..2d7f7e11b3f 100644 --- a/libstdc++-v3/include/bits/stl_deque.h +++ b/libstdc++-v3/include/bits/stl_deque.h @@ -1836,7 +1836,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } // called by the second initialize_dispatch above - //@{ + ///@{ /** * @brief Fills the deque with whatever is in [first,last). * @param __first An input iterator. @@ -1857,7 +1857,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER void _M_range_initialize(_ForwardIterator __first, _ForwardIterator __last, std::forward_iterator_tag); - //@} + ///@} /** * @brief Fills the %deque with copies of value. @@ -1941,7 +1941,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } } - //@{ + ///@{ /// Helper functions for push_* and pop_*. #if __cplusplus < 201103L void _M_push_back_aux(const value_type&); @@ -1958,7 +1958,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER void _M_pop_back_aux(); void _M_pop_front_aux(); - //@} + ///@} // Internal insert functions follow. The *_aux functions do the actual // insertion work when all shortcuts fail. @@ -2081,7 +2081,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_shrink_to_fit(); #endif - //@{ + ///@{ /// Memory-handling helpers for the previous internal insert functions. iterator _M_reserve_elements_at_front(size_type __n) @@ -2108,10 +2108,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER void _M_new_elements_at_back(size_type __new_elements); - //@} + ///@} - //@{ + ///@{ /** * @brief Memory-handling helpers for the major %map. * @@ -2137,7 +2137,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER void _M_reallocate_map(size_type __nodes_to_add, bool __add_at_front); - //@} + ///@} #if __cplusplus >= 201103L // Constant-time, nothrow move assignment when source object's memory diff --git a/libstdc++-v3/include/bits/stl_iterator.h b/libstdc++-v3/include/bits/stl_iterator.h index d950e896928..49c9a5c17d2 100644 --- a/libstdc++-v3/include/bits/stl_iterator.h +++ b/libstdc++-v3/include/bits/stl_iterator.h @@ -369,7 +369,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return __t.operator->(); } }; - //@{ + ///@{ /** * @param __x A %reverse_iterator. * @param __y A %reverse_iterator. @@ -503,7 +503,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const reverse_iterator<_IteratorR>& __y) { return __y.base() <=> __x.base(); } #endif // C++20 - //@} + ///@} #if __cplusplus < 201103L template @@ -932,7 +932,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return insert_iterator<_Container>(__x, __i); } #endif - // @} group iterators + /// @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -2183,7 +2183,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; #endif // C++20 - // @} group iterators + /// @} group iterators template auto diff --git a/libstdc++-v3/include/bits/stl_iterator_base_types.h b/libstdc++-v3/include/bits/stl_iterator_base_types.h index aa02af59dc6..09279976bd6 100644 --- a/libstdc++-v3/include/bits/stl_iterator_base_types.h +++ b/libstdc++-v3/include/bits/stl_iterator_base_types.h @@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * @defgroup iterators Iterators * Abstractions for uniform iterating through various underlying types. */ - //@{ + ///@{ /** * @defgroup iterator_tags Iterator Tags @@ -88,7 +88,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * are. Different underlying algorithms can then be used based on the * different operations supported by different iterator types. */ - //@{ + ///@{ /// Marking input iterators. struct input_iterator_tag { }; @@ -110,7 +110,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// Contiguous iterators point to objects stored contiguously in memory. struct contiguous_iterator_tag : public random_access_iterator_tag { }; #endif - //@} + ///@} /** * @brief Common %iterator class. @@ -238,7 +238,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __iterator_category(const _Iter&) { return typename iterator_traits<_Iter>::iterator_category(); } - //@} + ///@} #if __cplusplus >= 201103L template diff --git a/libstdc++-v3/include/bits/stl_map.h b/libstdc++-v3/include/bits/stl_map.h index 2772d11462e..0bf9333fe62 100644 --- a/libstdc++-v3/include/bits/stl_map.h +++ b/libstdc++-v3/include/bits/stl_map.h @@ -816,7 +816,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(_Pair&& __x) { return _M_t._M_emplace_unique(std::forward<_Pair>(__x)); } #endif - // @} + /// @} #if __cplusplus >= 201103L /** @@ -878,7 +878,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::forward<_Pair>(__x)); } #endif - // @} + /// @} /** * @brief Template function that attempts to insert a range of elements. @@ -1036,7 +1036,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_t.erase(__position); } - // @} + /// @} #else /** * @brief Erases an element from a %map. @@ -1152,7 +1152,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // [23.3.1.3] map operations - //@{ + ///@{ /** * @brief Tries to locate an element in a %map. * @param __x Key of (key, value) %pair to be located. @@ -1175,9 +1175,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) { return _M_t._M_find_tr(__x); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Tries to locate an element in a %map. * @param __x Key of (key, value) %pair to be located. @@ -1200,9 +1200,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) { return _M_t._M_find_tr(__x); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the number of elements with given key. * @param __x Key of (key, value) pairs to be located. @@ -1221,10 +1221,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) { return _M_t._M_count_tr(__x); } #endif - //@} + ///@} #if __cplusplus > 201703L - //@{ + ///@{ /** * @brief Finds whether an element with the given key exists. * @param __x Key of (key, value) pairs to be located. @@ -1239,10 +1239,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER contains(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x), void(), true) { return _M_t._M_find_tr(__x) != _M_t.end(); } - //@} + ///@} #endif - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -1265,9 +1265,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) { return iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -1290,9 +1290,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) { return const_iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -1310,9 +1310,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) { return iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -1330,9 +1330,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x))) { return const_iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. @@ -1359,9 +1359,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(pair(_M_t._M_equal_range_tr(__x))) { return pair(_M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. @@ -1392,7 +1392,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} template friend bool diff --git a/libstdc++-v3/include/bits/stl_multimap.h b/libstdc++-v3/include/bits/stl_multimap.h index 65f4d0117a4..38164810523 100644 --- a/libstdc++-v3/include/bits/stl_multimap.h +++ b/libstdc++-v3/include/bits/stl_multimap.h @@ -551,7 +551,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER insert(_Pair&& __x) { return _M_t._M_emplace_equal(std::forward<_Pair>(__x)); } #endif - // @} + /// @} /** * @brief Inserts a std::pair into the %multimap. @@ -597,7 +597,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::forward<_Pair>(__x)); } #endif - // @} + /// @} /** * @brief A template function that attempts to insert a range @@ -707,7 +707,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_t.erase(__position); } - // @} + /// @} #else /** * @brief Erases an element from a %multimap. @@ -827,7 +827,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // multimap operations - //@{ + ///@{ /** * @brief Tries to locate an element in a %multimap. * @param __x Key of (key, value) pair to be located. @@ -849,9 +849,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER find(const _Kt& __x) -> decltype(_M_t._M_find_tr(__x)) { return _M_t._M_find_tr(__x); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Tries to locate an element in a %multimap. * @param __x Key of (key, value) pair to be located. @@ -873,9 +873,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER find(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x)) { return _M_t._M_find_tr(__x); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the number of elements with given key. * @param __x Key of (key, value) pairs to be located. @@ -891,10 +891,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) { return _M_t._M_count_tr(__x); } #endif - //@} + ///@} #if __cplusplus > 201703L - //@{ + ///@{ /** * @brief Finds whether an element with the given key exists. * @param __x Key of (key, value) pairs to be located. @@ -909,10 +909,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER contains(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x), void(), true) { return _M_t._M_find_tr(__x) != _M_t.end(); } - //@} + ///@} #endif - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -935,9 +935,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) { return iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -960,9 +960,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) { return const_iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -980,9 +980,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) { return iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key of (key, value) pair to be located. @@ -1000,9 +1000,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator(_M_t._M_upper_bound_tr(__x))) { return const_iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. @@ -1027,9 +1027,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(pair(_M_t._M_equal_range_tr(__x))) { return pair(_M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key of (key, value) pairs to be located. @@ -1058,7 +1058,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} template friend bool diff --git a/libstdc++-v3/include/bits/stl_multiset.h b/libstdc++-v3/include/bits/stl_multiset.h index bf6ae7de095..a0e635e00dc 100644 --- a/libstdc++-v3/include/bits/stl_multiset.h +++ b/libstdc++-v3/include/bits/stl_multiset.h @@ -720,7 +720,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // multiset operations: - //@{ + ///@{ /** * @brief Finds the number of elements with given key. * @param __x Key of elements to be located. @@ -736,10 +736,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER count(const _Kt& __x) const -> decltype(_M_t._M_count_tr(__x)) { return _M_t._M_count_tr(__x); } #endif - //@} + ///@} #if __cplusplus > 201703L - //@{ + ///@{ /** * @brief Finds whether an element with the given key exists. * @param __x Key of elements to be located. @@ -754,12 +754,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER contains(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x), void(), true) { return _M_t._M_find_tr(__x) != _M_t.end(); } - //@} + ///@} #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload - //@{ + ///@{ /** * @brief Tries to locate an element in a %set. * @param __x Element to be located. @@ -792,9 +792,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator{_M_t._M_find_tr(__x)}) { return const_iterator{_M_t._M_find_tr(__x)}; } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key to be located. @@ -827,9 +827,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) { return iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key to be located. @@ -857,9 +857,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) { return iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -896,7 +896,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(pair(_M_t._M_equal_range_tr(__x))) { return pair(_M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} template friend bool diff --git a/libstdc++-v3/include/bits/stl_numeric.h b/libstdc++-v3/include/bits/stl_numeric.h index f95c86a0d48..06cb1ce5259 100644 --- a/libstdc++-v3/include/bits/stl_numeric.h +++ b/libstdc++-v3/include/bits/stl_numeric.h @@ -403,7 +403,7 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO return ++__result; } - // @} group numeric_ops + /// @} group numeric_ops #undef _GLIBCXX_MOVE_IF_20 diff --git a/libstdc++-v3/include/bits/stl_pair.h b/libstdc++-v3/include/bits/stl_pair.h index 491c599076e..053c4236ace 100644 --- a/libstdc++-v3/include/bits/stl_pair.h +++ b/libstdc++-v3/include/bits/stl_pair.h @@ -542,7 +542,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif // __cplusplus >= 201103L - // @} relates pair + /// @} relates pair /** * @brief A convenience wrapper for creating a pair from two objects. diff --git a/libstdc++-v3/include/bits/stl_set.h b/libstdc++-v3/include/bits/stl_set.h index da426650815..246c47a110a 100644 --- a/libstdc++-v3/include/bits/stl_set.h +++ b/libstdc++-v3/include/bits/stl_set.h @@ -115,14 +115,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER public: // typedefs: - //@{ + ///@{ /// Public typedefs. typedef _Key key_type; typedef _Key value_type; typedef _Compare key_compare; typedef _Compare value_compare; typedef _Alloc allocator_type; - //@} + ///@} private: typedef typename __gnu_cxx::__alloc_traits<_Alloc>::template @@ -135,7 +135,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef __gnu_cxx::__alloc_traits<_Key_alloc_type> _Alloc_traits; public: - //@{ + ///@{ /// Iterator-related typedefs. typedef typename _Alloc_traits::pointer pointer; typedef typename _Alloc_traits::const_pointer const_pointer; @@ -150,7 +150,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Rep_type::const_reverse_iterator const_reverse_iterator; typedef typename _Rep_type::size_type size_type; typedef typename _Rep_type::difference_type difference_type; - //@} + ///@} #if __cplusplus > 201402L using node_type = typename _Rep_type::node_type; @@ -735,7 +735,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // set operations: - //@{ + ///@{ /** * @brief Finds the number of elements. * @param __x Element to located. @@ -755,10 +755,10 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(_M_t._M_count_tr(__x)) { return _M_t._M_count_tr(__x); } #endif - //@} + ///@} #if __cplusplus > 201703L - //@{ + ///@{ /** * @brief Finds whether an element with the given key exists. * @param __x Key of elements to be located. @@ -773,12 +773,12 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER contains(const _Kt& __x) const -> decltype(_M_t._M_find_tr(__x), void(), true) { return _M_t._M_find_tr(__x) != _M_t.end(); } - //@} + ///@} #endif // _GLIBCXX_RESOLVE_LIB_DEFECTS // 214. set::find() missing const overload - //@{ + ///@{ /** * @brief Tries to locate an element in a %set. * @param __x Element to be located. @@ -811,9 +811,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator{_M_t._M_find_tr(__x)}) { return const_iterator{_M_t._M_find_tr(__x)}; } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the beginning of a subsequence matching given key. * @param __x Key to be located. @@ -846,9 +846,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) { return const_iterator(_M_t._M_lower_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds the end of a subsequence matching given key. * @param __x Key to be located. @@ -876,9 +876,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(iterator(_M_t._M_upper_bound_tr(__x))) { return const_iterator(_M_t._M_upper_bound_tr(__x)); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -915,7 +915,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER -> decltype(pair(_M_t._M_equal_range_tr(__x))) { return pair(_M_t._M_equal_range_tr(__x)); } #endif - //@} + ///@} template friend bool diff --git a/libstdc++-v3/include/bits/stl_uninitialized.h b/libstdc++-v3/include/bits/stl_uninitialized.h index 3109a89462d..5f75f69d3a2 100644 --- a/libstdc++-v3/include/bits/stl_uninitialized.h +++ b/libstdc++-v3/include/bits/stl_uninitialized.h @@ -1033,7 +1033,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION /// @endcond #endif - // @} group memory + /// @} group memory _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/stream_iterator.h b/libstdc++-v3/include/bits/stream_iterator.h index bd5ba2a80c0..f53cadf5c24 100644 --- a/libstdc++-v3/include/bits/stream_iterator.h +++ b/libstdc++-v3/include/bits/stream_iterator.h @@ -177,7 +177,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : public iterator { public: - //@{ + ///@{ /// Public typedef #if __cplusplus > 201703L using difference_type = ptrdiff_t; @@ -185,7 +185,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef _CharT char_type; typedef _Traits traits_type; typedef basic_ostream<_CharT, _Traits> ostream_type; - //@} + ///@} private: ostream_type* _M_stream; @@ -249,7 +249,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return *this; } }; - // @} group iterators + /// @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h index d3f1610fc8d..0681140505f 100644 --- a/libstdc++-v3/include/bits/streambuf_iterator.h +++ b/libstdc++-v3/include/bits/streambuf_iterator.h @@ -53,7 +53,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { public: // Types: - //@{ + ///@{ /// Public typedefs #if __cplusplus < 201103L typedef _CharT& reference; // Changed to _CharT by LWG 445 @@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename _Traits::int_type int_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_istream<_CharT, _Traits> istream_type; - //@} + ///@} template friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, @@ -241,7 +241,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { public: // Types: - //@{ + ///@{ /// Public typedefs #if __cplusplus > 201703L using difference_type = ptrdiff_t; @@ -250,7 +250,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef _Traits traits_type; typedef basic_streambuf<_CharT, _Traits> streambuf_type; typedef basic_ostream<_CharT, _Traits> ostream_type; - //@} + ///@} template friend typename __gnu_cxx::__enable_if<__is_char<_CharT2>::__value, diff --git a/libstdc++-v3/include/bits/unique_ptr.h b/libstdc++-v3/include/bits/unique_ptr.h index d0e4cefadd7..05fe652cf36 100644 --- a/libstdc++-v3/include/bits/unique_ptr.h +++ b/libstdc++-v3/include/bits/unique_ptr.h @@ -906,7 +906,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return compare_three_way()(__x.get(), static_cast(nullptr)); } #endif - // @} relates unique_ptr + /// @} relates unique_ptr /// @cond undocumented template inline typename _MakeUniq<_Tp>::__invalid_type make_unique(_Args&&...) = delete; - // @} relates unique_ptr + /// @} relates unique_ptr #endif // C++14 #if __cplusplus > 201703L && __cpp_concepts @@ -989,7 +989,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif // C++20 - // @} group pointer_abstractions + /// @} group pointer_abstractions #if __cplusplus >= 201703L namespace __detail::__variant diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 0071d62e462..42b5c618b8d 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -106,7 +106,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER public: // typedefs: - //@{ + ///@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; @@ -114,9 +114,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; - //@} + ///@} - //@{ + ///@{ /// Iterator-related typedefs. typedef typename _Hashtable::pointer pointer; typedef typename _Hashtable::const_pointer const_pointer; @@ -128,7 +128,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; - //@} + ///@} #if __cplusplus > 201402L using node_type = typename _Hashtable::node_type; @@ -324,7 +324,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER begin() noexcept { return _M_h.begin(); } - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_map. @@ -336,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator cbegin() const noexcept { return _M_h.begin(); } - //@} + ///@} /** * Returns a read/write iterator that points one past the last element in @@ -346,7 +346,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER end() noexcept { return _M_h.end(); } - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_map. @@ -358,7 +358,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator cend() const noexcept { return _M_h.end(); } - //@} + ///@} // modifiers. @@ -557,7 +557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif // C++17 - //@{ + ///@{ /** * @brief Attempts to insert a std::pair into the %unordered_map. @@ -590,9 +590,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER pair> insert(_Pair&& __x) { return _M_h.emplace(std::forward<_Pair>(__x)); } - //@} + ///@} - //@{ + ///@{ /** * @brief Attempts to insert a std::pair into the %unordered_map. * @param __hint An iterator that serves as a hint as to where the @@ -628,7 +628,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __enable_if_t::value, iterator> insert(const_iterator __hint, _Pair&& __x) { return _M_h.emplace_hint(__hint, std::forward<_Pair>(__x)); } - //@} + ///@} /** * @brief A template function that attempts to insert a range of @@ -773,7 +773,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } #endif - //@{ + ///@{ /** * @brief Erases an element from an %unordered_map. * @param __position An iterator pointing to the element to be erased. @@ -795,7 +795,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_h.erase(__position); } - //@} + ///@} /** * @brief Erases elements according to the provided key. @@ -903,7 +903,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // lookup. - //@{ + ///@{ /** * @brief Tries to locate an element in an %unordered_map. * @param __x Key to be located. @@ -922,7 +922,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator find(const key_type& __x) const { return _M_h.find(__x); } - //@} + ///@} /** * @brief Finds the number of elements. @@ -948,7 +948,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.find(__x) != _M_h.end(); } #endif - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -964,9 +964,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::pair equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } - //@} + ///@} - //@{ + ///@{ /** * @brief Subscript ( @c [] ) access to %unordered_map data. * @param __k The key for which data should be retrieved. @@ -986,9 +986,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER mapped_type& operator[](key_type&& __k) { return _M_h[std::move(__k)]; } - //@} + ///@} - //@{ + ///@{ /** * @brief Access to %unordered_map data. * @param __k The key for which data should be retrieved. @@ -1003,7 +1003,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const mapped_type& at(const key_type& __k) const { return _M_h.at(__k); } - //@} + ///@} // bucket interface. @@ -1045,7 +1045,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER begin(size_type __n) { return _M_h.begin(__n); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. @@ -1059,7 +1059,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } - //@} + ///@} /** * @brief Returns a read/write iterator pointing to one past the last @@ -1071,7 +1071,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER end(size_type __n) { return _M_h.end(__n); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. @@ -1085,7 +1085,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } - //@} + ///@} // hash policy. @@ -1253,7 +1253,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER public: // typedefs: - //@{ + ///@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; @@ -1261,9 +1261,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; - //@} + ///@} - //@{ + ///@{ /// Iterator-related typedefs. typedef typename _Hashtable::pointer pointer; typedef typename _Hashtable::const_pointer const_pointer; @@ -1275,7 +1275,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; - //@} + ///@} #if __cplusplus > 201402L using node_type = typename _Hashtable::node_type; @@ -1470,7 +1470,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER begin() noexcept { return _M_h.begin(); } - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_multimap. @@ -1482,7 +1482,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator cbegin() const noexcept { return _M_h.begin(); } - //@} + ///@} /** * Returns a read/write iterator that points one past the last element in @@ -1492,7 +1492,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER end() noexcept { return _M_h.end(); } - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_multimap. @@ -1504,7 +1504,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator cend() const noexcept { return _M_h.end(); } - //@} + ///@} // modifiers. @@ -1555,7 +1555,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - //@{ + ///@{ /** * @brief Inserts a std::pair into the %unordered_multimap. * @param __x Pair to be inserted (see std::make_pair for easy @@ -1577,9 +1577,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __enable_if_t::value, iterator> insert(_Pair&& __x) { return _M_h.emplace(std::forward<_Pair>(__x)); } - //@} + ///@} - //@{ + ///@{ /** * @brief Inserts a std::pair into the %unordered_multimap. * @param __hint An iterator that serves as a hint as to where the @@ -1613,7 +1613,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __enable_if_t::value, iterator> insert(const_iterator __hint, _Pair&& __x) { return _M_h.emplace_hint(__hint, std::forward<_Pair>(__x)); } - //@} + ///@} /** * @brief A template function that attempts to insert a range of @@ -1666,7 +1666,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); } #endif // C++17 - //@{ + ///@{ /** * @brief Erases an element from an %unordered_multimap. * @param __position An iterator pointing to the element to be erased. @@ -1688,7 +1688,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_h.erase(__position); } - //@} + ///@} /** * @brief Erases elements according to the provided key. @@ -1798,7 +1798,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // lookup. - //@{ + ///@{ /** * @brief Tries to locate an element in an %unordered_multimap. * @param __x Key to be located. @@ -1817,7 +1817,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator find(const key_type& __x) const { return _M_h.find(__x); } - //@} + ///@} /** * @brief Finds the number of elements. @@ -1839,7 +1839,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.find(__x) != _M_h.end(); } #endif - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -1853,7 +1853,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::pair equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } - //@} + ///@} // bucket interface. @@ -1895,7 +1895,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER begin(size_type __n) { return _M_h.begin(__n); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. @@ -1909,7 +1909,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } - //@} + ///@} /** * @brief Returns a read/write iterator pointing to one past the last @@ -1921,7 +1921,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER end(size_type __n) { return _M_h.end(__n); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. @@ -1935,7 +1935,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } - //@} + ///@} // hash policy. diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index c9c9e9f38b7..7c2b6ece329 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -101,16 +101,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER public: // typedefs: - //@{ + ///@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; - //@} + ///@} - //@{ + ///@{ /// Iterator-related typedefs. typedef typename _Hashtable::pointer pointer; typedef typename _Hashtable::const_pointer const_pointer; @@ -122,7 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; - //@} + ///@} #if __cplusplus > 201402L using node_type = typename _Hashtable::node_type; @@ -310,7 +310,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // iterators. - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_set. @@ -322,9 +322,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator begin() const noexcept { return _M_h.begin(); } - //@} + ///@} - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_set. @@ -336,7 +336,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator end() const noexcept { return _M_h.end(); } - //@} + ///@} /** * Returns a read-only (constant) iterator that points to the first @@ -402,7 +402,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - //@{ + ///@{ /** * @brief Attempts to insert an element into the %unordered_set. * @param __x Element to be inserted. @@ -423,9 +423,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::pair insert(value_type&& __x) { return _M_h.insert(std::move(__x)); } - //@} + ///@} - //@{ + ///@{ /** * @brief Attempts to insert an element into the %unordered_set. * @param __hint An iterator that serves as a hint as to where the @@ -452,7 +452,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator insert(const_iterator __hint, value_type&& __x) { return _M_h.insert(__hint, std::move(__x)); } - //@} + ///@} /** * @brief A template function that attempts to insert a range of @@ -504,7 +504,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h._M_reinsert_node(std::move(__nh)).position; } #endif // C++17 - //@{ + ///@{ /** * @brief Erases an element from an %unordered_set. * @param __position An iterator pointing to the element to be erased. @@ -526,7 +526,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_h.erase(__position); } - //@} + ///@} /** * @brief Erases elements according to the provided key. @@ -633,7 +633,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // lookup. - //@{ + ///@{ /** * @brief Tries to locate an element in an %unordered_set. * @param __x Element to be located. @@ -652,7 +652,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator find(const key_type& __x) const { return _M_h.find(__x); } - //@} + ///@} /** * @brief Finds the number of elements. @@ -678,7 +678,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.find(__x) != _M_h.end(); } #endif - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -694,7 +694,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::pair equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } - //@} + ///@} // bucket interface. @@ -726,7 +726,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER bucket(const key_type& __key) const { return _M_h.bucket(__key); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. @@ -744,9 +744,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } - //@} + ///@} - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. @@ -764,7 +764,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } - //@} + ///@} // hash policy. @@ -916,16 +916,16 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER public: // typedefs: - //@{ + ///@{ /// Public typedefs. typedef typename _Hashtable::key_type key_type; typedef typename _Hashtable::value_type value_type; typedef typename _Hashtable::hasher hasher; typedef typename _Hashtable::key_equal key_equal; typedef typename _Hashtable::allocator_type allocator_type; - //@} + ///@} - //@{ + ///@{ /// Iterator-related typedefs. typedef typename _Hashtable::pointer pointer; typedef typename _Hashtable::const_pointer const_pointer; @@ -937,7 +937,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER typedef typename _Hashtable::const_local_iterator const_local_iterator; typedef typename _Hashtable::size_type size_type; typedef typename _Hashtable::difference_type difference_type; - //@} + ///@} #if __cplusplus > 201402L using node_type = typename _Hashtable::node_type; @@ -1124,7 +1124,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // iterators. - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points to the first * element in the %unordered_multiset. @@ -1136,9 +1136,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator begin() const noexcept { return _M_h.begin(); } - //@} + ///@} - //@{ + ///@{ /** * Returns a read-only (constant) iterator that points one past the last * element in the %unordered_multiset. @@ -1150,7 +1150,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator end() const noexcept { return _M_h.end(); } - //@} + ///@} /** * Returns a read-only (constant) iterator that points to the first @@ -1204,7 +1204,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER emplace_hint(const_iterator __pos, _Args&&... __args) { return _M_h.emplace_hint(__pos, std::forward<_Args>(__args)...); } - //@{ + ///@{ /** * @brief Inserts an element into the %unordered_multiset. * @param __x Element to be inserted. @@ -1219,9 +1219,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator insert(value_type&& __x) { return _M_h.insert(std::move(__x)); } - //@} + ///@} - //@{ + ///@{ /** * @brief Inserts an element into the %unordered_multiset. * @param __hint An iterator that serves as a hint as to where the @@ -1245,7 +1245,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator insert(const_iterator __hint, value_type&& __x) { return _M_h.insert(__hint, std::move(__x)); } - //@} + ///@} /** * @brief A template function that inserts a range of elements. @@ -1296,7 +1296,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h._M_reinsert_node_multi(__hint, std::move(__nh)); } #endif // C++17 - //@{ + ///@{ /** * @brief Erases an element from an %unordered_multiset. * @param __position An iterator pointing to the element to be erased. @@ -1319,7 +1319,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER iterator erase(iterator __position) { return _M_h.erase(__position); } - //@} + ///@} /** @@ -1432,7 +1432,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER // lookup. - //@{ + ///@{ /** * @brief Tries to locate an element in an %unordered_multiset. * @param __x Element to be located. @@ -1451,7 +1451,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_iterator find(const key_type& __x) const { return _M_h.find(__x); } - //@} + ///@} /** * @brief Finds the number of elements. @@ -1473,7 +1473,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER { return _M_h.find(__x) != _M_h.end(); } #endif - //@{ + ///@{ /** * @brief Finds a subsequence matching given key. * @param __x Key to be located. @@ -1487,7 +1487,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER std::pair equal_range(const key_type& __x) const { return _M_h.equal_range(__x); } - //@} + ///@} // bucket interface. @@ -1519,7 +1519,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER bucket(const key_type& __key) const { return _M_h.bucket(__key); } - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to the first * bucket element. @@ -1537,9 +1537,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cbegin(size_type __n) const { return _M_h.cbegin(__n); } - //@} + ///@} - //@{ + ///@{ /** * @brief Returns a read-only (constant) iterator pointing to one past * the last bucket elements. @@ -1557,7 +1557,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER const_local_iterator cend(size_type __n) const { return _M_h.cend(__n); } - //@} + ///@} // hash policy. diff --git a/libstdc++-v3/include/decimal/decimal b/libstdc++-v3/include/decimal/decimal index 8863d7e2a13..0e7e274716a 100644 --- a/libstdc++-v3/include/decimal/decimal +++ b/libstdc++-v3/include/decimal/decimal @@ -484,7 +484,7 @@ namespace decimal #define _GLIBCXX_USE_DECIMAL_ 1 } // namespace decimal - // @} group decimal + /// @} group decimal _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/experimental/any b/libstdc++-v3/include/experimental/any index 43455de479f..9b68f12c471 100644 --- a/libstdc++-v3/include/experimental/any +++ b/libstdc++-v3/include/experimental/any @@ -412,7 +412,7 @@ inline namespace fundamentals_v1 return std::move(*__p); __throw_bad_any_cast(); } - // @} + /// @} /// @cond undocumented template @@ -479,7 +479,7 @@ inline namespace fundamentals_v1 return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); return nullptr; } - // @} + /// @} template void @@ -555,7 +555,7 @@ inline namespace fundamentals_v1 _S_manage(_Op, const any*, _Arg*) { } }; - // @} group any + /// @} group any } // namespace fundamentals_v1 } // namespace experimental diff --git a/libstdc++-v3/include/experimental/array b/libstdc++-v3/include/experimental/array index 427bf8567cf..d3ee87101eb 100644 --- a/libstdc++-v3/include/experimental/array +++ b/libstdc++-v3/include/experimental/array @@ -104,7 +104,7 @@ template return experimental::__to_array(__a, make_index_sequence<_Nm>{}); } - // @} group make_array + /// @} group make_array } // namespace fundamentals_v2 } // namespace experimental diff --git a/libstdc++-v3/include/experimental/bits/fs_dir.h b/libstdc++-v3/include/experimental/bits/fs_dir.h index ae67ae95015..dcffd65bb5e 100644 --- a/libstdc++-v3/include/experimental/bits/fs_dir.h +++ b/libstdc++-v3/include/experimental/bits/fs_dir.h @@ -351,7 +351,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 _GLIBCXX_END_NAMESPACE_CXX11 - // @} group filesystem-ts + /// @} group filesystem-ts } // namespace v1 } // namespace filesystem } // namespace experimental diff --git a/libstdc++-v3/include/experimental/bits/fs_fwd.h b/libstdc++-v3/include/experimental/bits/fs_fwd.h index 535a800584f..4c80401ac14 100644 --- a/libstdc++-v3/include/experimental/bits/fs_fwd.h +++ b/libstdc++-v3/include/experimental/bits/fs_fwd.h @@ -279,7 +279,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 bool is_regular_file(file_status) noexcept; bool is_symlink(file_status) noexcept; - // @} group filesystem-ts + /// @} group filesystem-ts } // namespace v1 } // namespace filesystem } // namespace experimental diff --git a/libstdc++-v3/include/experimental/bits/fs_ops.h b/libstdc++-v3/include/experimental/bits/fs_ops.h index 61611ba53eb..5b0aad4e3ae 100644 --- a/libstdc++-v3/include/experimental/bits/fs_ops.h +++ b/libstdc++-v3/include/experimental/bits/fs_ops.h @@ -288,7 +288,7 @@ inline namespace v1 path temp_directory_path(); path temp_directory_path(error_code& __ec); - // @} group filesystem-ts + /// @} group filesystem-ts } // namespace v1 } // namespace filesystem } // namespace experimental diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h index 69b823a3466..c5fc3beed1f 100644 --- a/libstdc++-v3/include/experimental/bits/fs_path.h +++ b/libstdc++-v3/include/experimental/bits/fs_path.h @@ -1268,7 +1268,7 @@ namespace __detail return _M_at_end == __rhs._M_at_end; } - // @} group filesystem-ts + /// @} group filesystem-ts _GLIBCXX_END_NAMESPACE_CXX11 } // namespace v1 } // namespace filesystem diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer index 0b04b71286c..d319785fb25 100644 --- a/libstdc++-v3/include/experimental/buffer +++ b/libstdc++-v3/include/experimental/buffer @@ -172,7 +172,7 @@ inline namespace v1 buffer_sequence_end(const _Cont& __c) -> decltype(__c.end()) { return __c.end(); } - // @} + /// @} /** @brief buffer type traits @@ -250,7 +250,7 @@ inline namespace v1 template constexpr bool is_dynamic_buffer_v = is_dynamic_buffer<_Tp>::value; - // @} + /// @} /// buffer size template @@ -727,7 +727,7 @@ inline namespace v1 return net::read(__stream, __b, __completion_condition, __ec); } - // @} + /// @} /** @brief asynchronous read operations * @{ @@ -775,7 +775,7 @@ inline namespace v1 std::forward<_CompletionToken>(__token)); } - // @} + /// @} #if 0 /** @brief synchronous write operations: @@ -811,7 +811,7 @@ inline namespace v1 size_t write(_SyncWriteStream& __stream, _DynamicBuffer&& __b, _CompletionCondition __completion_condition, error_code& __ec); - // @} + /// @} /** @brief asynchronous write operations * @{ @@ -839,7 +839,7 @@ inline namespace v1 _CompletionCondition __completion_condition, _CompletionToken&& __token); - // @} + /// @} /** @brief synchronous delimited read operations * @{ @@ -856,7 +856,7 @@ inline namespace v1 size_t read_until(_SyncReadStream& __s, _DynamicBuffer&& __b, string_view __delim, error_code& __ec); - // @} + /// @} /** @brief asynchronous delimited read operations * @{ @@ -871,7 +871,7 @@ inline namespace v1 _DynamicBuffer&& __b, string_view __delim, _CompletionToken&& __token); - // @} + /// @} #endif /// @} diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet index add9b09192d..697e724a9d1 100644 --- a/libstdc++-v3/include/experimental/internet +++ b/libstdc++-v3/include/experimental/internet @@ -126,7 +126,7 @@ namespace ip struct v4_mapped_t {}; constexpr v4_mapped_t v4_mapped; - // @} + /// @} /// An IPv4 address. class address_v4 @@ -541,7 +541,7 @@ namespace ip operator>=(const address_v4& __a, const address_v4& __b) noexcept { return !(__a < __b); } - // @} + /// @} /** ip::address_v6 comparisons * @{ @@ -585,7 +585,7 @@ namespace ip operator>=(const address_v6& __a, const address_v6& __b) noexcept { return !(__a < __b); } - // @} + /// @} /** ip::address comparisons * @{ @@ -623,7 +623,7 @@ namespace ip operator>=(const address& __a, const address& __b) noexcept { return !(__a < __b); } - // @} + /// @} /** ip::address_v4 creation * @{ @@ -695,7 +695,7 @@ namespace ip make_address_v4(string_view __str) { return make_address_v4(__str, __throw_on_error{"make_address_v4"}); } - // @} + /// @} /** ip::address_v6 creation * @{ @@ -867,7 +867,7 @@ namespace ip make_address_v6(string_view __str) { return make_address_v6(__str, __throw_on_error{"make_address_v6"}); } - // @} + /// @} /** ip::address creation * @{ @@ -912,7 +912,7 @@ namespace ip make_address(string_view __str) { return make_address(__str, __throw_on_error{"make_address"}); } - // @} + /// @} /// ip::address I/O template @@ -1093,7 +1093,7 @@ namespace ip typedef basic_address_range address_v4_range; - // @} + /// @} /** An IPv6 address range. * @{ @@ -1134,7 +1134,7 @@ namespace ip typedef basic_address_range address_v6_range; - // @} + /// @} bool operator==(const network_v4& __a, const network_v4& __b) noexcept; @@ -1307,7 +1307,7 @@ namespace ip operator!=(const network_v4& __a, const network_v4& __b) noexcept { return !(__a == __b); } - // @} + /// @} /** ip::network_v6 comparisons * @{ @@ -1324,7 +1324,7 @@ namespace ip operator!=(const network_v6& __a, const network_v6& __b) noexcept { return !(__a == __b); } - // @} + /// @} /** ip::network_v4 creation * @{ @@ -1356,7 +1356,7 @@ namespace ip make_network_v4(string_view __str) { return make_network_v4(__str, __throw_on_error{"make_network_v4"}); } - // @} + /// @} /** ip::network_v6 creation * @{ @@ -1384,7 +1384,7 @@ namespace ip make_network_v6(string_view __str) { return make_network_v6(__str, __throw_on_error{"make_network_v6"}); } - // @} + /// @} /// ip::network_v4 I/O template @@ -1566,7 +1566,7 @@ namespace ip const basic_endpoint<_InternetProtocol>& __b) { return !(__a < __b); } - // @} + /// @} /// basic_endpoint I/O template @@ -1640,7 +1640,7 @@ namespace ip const basic_resolver_entry<_InternetProtocol>& __b) { return !(__a == __b); } - // @} + /// @} /** Base class defining flags for name/address resolution. * @{ @@ -1706,7 +1706,7 @@ namespace ip // TODO define resolver_base::flags static constants for C++14 mode - // @} + /// @} /** Container for results of name/address resolution. * @{ @@ -1788,7 +1788,7 @@ namespace ip const basic_resolver_results<_InternetProtocol>& __b) { return !(__a == __b); } - // @} + /// @} /// Perform name/address resolution. template @@ -2071,7 +2071,7 @@ namespace ip host_name() { return host_name(std::allocator{}, __throw_on_error{"host_name"}); } - // @} + /// @} /// The TCP byte-stream protocol. class tcp @@ -2126,7 +2126,7 @@ namespace ip operator!=(const tcp& __a, const tcp& __b) { return !(__a == __b); } - // @} + /// @} /// The UDP datagram protocol. class udp @@ -2165,7 +2165,7 @@ namespace ip operator!=(const udp& __a, const udp& __b) { return !(__a == __b); } - // @} + /// @} /// Restrict a socket created for an IPv6 protocol to IPv6 only. struct v6_only : __sockopt_crtp @@ -2395,7 +2395,7 @@ namespace ip } // namespace multicast - // @} + /// @} } // namespace ip } // namespace v1 diff --git a/libstdc++-v3/include/experimental/optional b/libstdc++-v3/include/experimental/optional index 370e95ae83e..33c509678c1 100644 --- a/libstdc++-v3/include/experimental/optional +++ b/libstdc++-v3/include/experimental/optional @@ -910,8 +910,8 @@ inline namespace fundamentals_v1 make_optional(_Tp&& __t) { return optional> { std::forward<_Tp>(__t) }; } - // @} relates experimental::optional - // @} group optional + /// @} relates experimental::optional + /// @} group optional } // namespace fundamentals_v1 } // namespace experimental diff --git a/libstdc++-v3/include/experimental/propagate_const b/libstdc++-v3/include/experimental/propagate_const index b1b70cab879..d7034d6f724 100644 --- a/libstdc++-v3/include/experimental/propagate_const +++ b/libstdc++-v3/include/experimental/propagate_const @@ -422,7 +422,7 @@ inline namespace fundamentals_v2 return __pt._M_t; } - // @} group propagate_const + /// @} group propagate_const } // namespace fundamentals_v2 } // namespace experimental diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket index 4c47348373b..725fee4e71a 100644 --- a/libstdc++-v3/include/experimental/socket +++ b/libstdc++-v3/include/experimental/socket @@ -2285,7 +2285,7 @@ inline namespace v1 protocol_type _M_protocol; }; - // @} + /// @} /** @brief Socket streams * @{ @@ -2456,7 +2456,7 @@ inline namespace v1 __streambuf_type _M_sb; }; - // @} + /// @} /** @brief synchronous connect operations * @{ @@ -2577,7 +2577,7 @@ inline namespace v1 __ec); } - // @} + /// @} /** @brief asynchronous connect operations * @{ @@ -2627,11 +2627,11 @@ inline namespace v1 forward<_CompletionToken>(__token)); } - // @} + /// @} #endif // _GLIBCXX_HAVE_UNISTD_H - // @} + /// @} } // namespace v1 } // namespace net diff --git a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp index f497cfec53d..38286b8ac47 100644 --- a/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp +++ b/libstdc++-v3/include/ext/pb_ds/assoc_container.hpp @@ -516,7 +516,7 @@ namespace __gnu_pbds swap(gp_hash_table& other) { base_type::swap(other); } }; - //@} hash-based + ///@} hash-based #undef PB_DS_GP_HASH_BASE @@ -780,7 +780,7 @@ namespace __gnu_pbds swap(trie& other) { base_type::swap(other); } }; - //@} branch-based + ///@} branch-based #undef PB_DS_TRIE_BASE #undef PB_DS_TRIE_NODE_AND_IT_TRAITS @@ -852,10 +852,10 @@ namespace __gnu_pbds swap(list_update& other) { base_type::swap(other); } }; - //@} list-based + ///@} list-based #undef PB_DS_LU_BASE - // @} group containers-pbds + /// @} group containers-pbds } // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp index 1dc3f86c08b..ec94b0d978d 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp @@ -107,7 +107,7 @@ namespace __gnu_pbds /// Dispatched type. typedef thin_heap<_VTp, Cmp_Fn, _Alloc> type; }; - //@} group pbds + ///@} group pbds } // namespace detail } // namespace __gnu_pbds diff --git a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp index f77a6226768..8bed5906e78 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp @@ -96,7 +96,7 @@ namespace __gnu_pbds public: typedef typename tree_metadata_helper<__node_u, null_update>::type type; }; - //@} + ///@} } // namespace detail } // namespace __gnu_pbds diff --git a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp index f446af4effc..e24fc4d1f51 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp @@ -96,7 +96,7 @@ namespace __gnu_pbds public: typedef typename trie_metadata_helper<__node_u, null_update>::type type; }; - //@} + ///@} } // namespace detail } // namespace __gnu_pbds diff --git a/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp b/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp index 4e91ed142e9..c2138ea09da 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/types_traits.hpp @@ -191,7 +191,7 @@ namespace __gnu_pbds store_extra m_store_extra_indicator; no_throw_indicator m_no_throw_copies_indicator; }; - //@} + ///@} } // namespace detail } // namespace __gnu_pbds diff --git a/libstdc++-v3/include/ext/pb_ds/exception.hpp b/libstdc++-v3/include/ext/pb_ds/exception.hpp index b8013928eb3..95c5771bf95 100644 --- a/libstdc++-v3/include/ext/pb_ds/exception.hpp +++ b/libstdc++-v3/include/ext/pb_ds/exception.hpp @@ -87,7 +87,7 @@ namespace __gnu_pbds inline void __throw_resize_error() { _GLIBCXX_THROW_OR_ABORT(resize_error()); } - //@} + ///@} } // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp index d2010fc28cc..987d08bec27 100644 --- a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp +++ b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp @@ -152,5 +152,5 @@ namespace __gnu_pbds { base_type::swap(other); } }; } // namespace __gnu_pbds - //@} heap-based + ///@} heap-based #endif diff --git a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp index 46dc11447ae..8d2b61e19cd 100644 --- a/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp +++ b/libstdc++-v3/include/ext/pb_ds/tag_and_trait.hpp @@ -113,7 +113,7 @@ namespace __gnu_pbds */ struct range_invalidation_guarantee : public point_invalidation_guarantee { }; - //@} + ///@} /** @@ -184,8 +184,8 @@ namespace __gnu_pbds /// Thin heap. struct thin_heap_tag : public priority_queue_tag { }; - //@} - //@} + ///@} + ///@} /** @@ -438,7 +438,7 @@ namespace __gnu_pbds reverse_iteration = base_type::reverse_iteration }; }; - //@} + ///@} namespace detail @@ -448,7 +448,7 @@ namespace __gnu_pbds typename Policy_Tl = null_type> struct container_base_dispatch; } // namespace detail - //@} + ///@} } // namespace __gnu_pbds #endif diff --git a/libstdc++-v3/include/ext/random b/libstdc++-v3/include/ext/random index 25d725015ec..bbd8c61e5d4 100644 --- a/libstdc++-v3/include/ext/random +++ b/libstdc++-v3/include/ext/random @@ -1043,7 +1043,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_ndy(result_type(0), __p.sigma()) { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -1295,7 +1295,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_gd(__p.mu(), __p.omega() / __p.mu()) { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -1540,7 +1540,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_ud() { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -1801,7 +1801,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _M_gd2(__p.nu(), __p.mu() / __p.nu()) { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -2040,7 +2040,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION +1.5707963267948966192313216916397514L) { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -3303,7 +3303,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_param(__p) { } - // @} + /// @} /** * @brief Resets the distribution state. @@ -3709,7 +3709,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _M_param(__p), _M_uosd() { } - // @} + /// @} /** * @brief Resets the distribution state. diff --git a/libstdc++-v3/include/std/any b/libstdc++-v3/include/std/any index e13292296d3..d6397a08531 100644 --- a/libstdc++-v3/include/std/any +++ b/libstdc++-v3/include/std/any @@ -488,7 +488,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return static_cast<_ValueType>(std::move(*__p)); __throw_bad_any_cast(); } - // @} + /// @} /// @cond undocumented template @@ -547,7 +547,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return static_cast<_ValueType*>(__any_caster<_ValueType>(__any)); return nullptr; } - // @} + /// @} template void diff --git a/libstdc++-v3/include/std/atomic b/libstdc++-v3/include/std/atomic index 2161cbed0d2..d511dfe7b60 100644 --- a/libstdc++-v3/include/std/atomic +++ b/libstdc++-v3/include/std/atomic @@ -1549,7 +1549,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // C++2a - // @} group atomics + /// @} group atomics _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/bitset b/libstdc++-v3/include/std/bitset index 5364e59f466..681f2116d67 100644 --- a/libstdc++-v3/include/std/bitset +++ b/libstdc++-v3/include/std/bitset @@ -961,7 +961,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER #endif // 23.3.5.2 bitset operations: - //@{ + ///@{ /** * Operations on bitsets. * @param __rhs A same-sized bitset. @@ -988,9 +988,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->_M_do_xor(__rhs); return *this; } - //@} + ///@} - //@{ + ///@{ /** * Operations on bitsets. * @param __position The number of places to shift. @@ -1022,9 +1022,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER this->_M_do_reset(); return *this; } - //@} + ///@} - //@{ + ///@{ /** * These versions of single-bit set, reset, flip, and test are * extensions from the SGI version. They do no range checking. @@ -1065,7 +1065,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _Unchecked_test(size_t __pos) const _GLIBCXX_NOEXCEPT { return ((this->_M_getword(__pos) & _Base::_S_maskbit(__pos)) != static_cast<_WordT>(0)); } - //@} + ///@} // Set, reset, and flip. /** @@ -1144,7 +1144,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER operator~() const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(*this).flip(); } - //@{ + ///@{ /** * @brief Array-indexing support. * @param __position Index into the %bitset. @@ -1166,7 +1166,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER _GLIBCXX_CONSTEXPR bool operator[](size_t __position) const { return _Unchecked_test(__position); } - //@} + ///@} /** * @brief Returns a numerical interpretation of the %bitset. @@ -1300,7 +1300,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER size() const _GLIBCXX_NOEXCEPT { return _Nb; } - //@{ + ///@{ /// These comparisons for equality/inequality are, well, @e bitwise. bool operator==(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT @@ -1311,7 +1311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER operator!=(const bitset<_Nb>& __rhs) const _GLIBCXX_NOEXCEPT { return !this->_M_is_equal(__rhs); } #endif - //@} + ///@} /** * @brief Tests the value of a bit. @@ -1352,7 +1352,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER none() const _GLIBCXX_NOEXCEPT { return !this->_M_is_any(); } - //@{ + ///@{ /// Self-explanatory. bitset<_Nb> operator<<(size_t __position) const _GLIBCXX_NOEXCEPT @@ -1361,7 +1361,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER bitset<_Nb> operator>>(size_t __position) const _GLIBCXX_NOEXCEPT { return bitset<_Nb>(*this) >>= __position; } - //@} + ///@} /** * @brief Finds the index of the first "on" bit. @@ -1421,7 +1421,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER } // 23.3.5.3 bitset operations: - //@{ + ///@{ /** * @brief Global bitwise operations on bitsets. * @param __x A bitset. @@ -1456,9 +1456,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __result ^= __y; return __result; } - //@} + ///@} - //@{ + ///@{ /** * @brief Global I/O operators for bitsets. * @@ -1548,7 +1548,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER __x._M_copy_to_string(__tmp, __ct.widen('0'), __ct.widen('1')); return __os << __tmp; } - //@} + ///@} _GLIBCXX_END_NAMESPACE_CONTAINER } // namespace std diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index 1eab4b74cb7..0bff594f9b2 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -165,7 +165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION struct common_type> { using type = chrono::time_point<_Clock, _Duration>; }; - // @} group chrono + /// @} group chrono namespace chrono { @@ -1007,7 +1007,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION const time_point<_Clock, _Dur2>& __rhs) { return !(__lhs < __rhs); } - // @} + /// @} // Clocks. diff --git a/libstdc++-v3/include/std/complex b/libstdc++-v3/include/std/complex index f2917b8c368..ebd1e5a0d39 100644 --- a/libstdc++-v3/include/std/complex +++ b/libstdc++-v3/include/std/complex @@ -324,7 +324,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // Operators: - //@{ + ///@{ /// Return new complex value @a x plus @a y. template inline _GLIBCXX20_CONSTEXPR complex<_Tp> @@ -352,9 +352,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __r += __x; return __r; } - //@} + ///@} - //@{ + ///@{ /// Return new complex value @a x minus @a y. template inline _GLIBCXX20_CONSTEXPR complex<_Tp> @@ -382,9 +382,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __r += __x; return __r; } - //@} + ///@} - //@{ + ///@{ /// Return new complex value @a x times @a y. template inline _GLIBCXX20_CONSTEXPR complex<_Tp> @@ -412,9 +412,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __r *= __x; return __r; } - //@} + ///@} - //@{ + ///@{ /// Return new complex value @a x divided by @a y. template inline _GLIBCXX20_CONSTEXPR complex<_Tp> @@ -442,7 +442,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __r /= __y; return __r; } - //@} + ///@} /// Return @a x. template @@ -456,7 +456,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator-(const complex<_Tp>& __x) { return complex<_Tp>(-__x.real(), -__x.imag()); } - //@{ + ///@{ /// Return true if @a x is equal to @a y. template inline _GLIBCXX_CONSTEXPR bool @@ -473,9 +473,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline _GLIBCXX_CONSTEXPR bool operator==(const _Tp& __x, const complex<_Tp>& __y) { return __x == __y.real() && _Tp() == __y.imag(); } - //@} + ///@} - //@{ + ///@{ /// Return false if @a x is equal to @a y. template inline _GLIBCXX_CONSTEXPR bool @@ -492,7 +492,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator!=(const _Tp& __x, const complex<_Tp>& __y) { return __x != __y.real() || _Tp() != __y.imag(); } #endif - //@} + ///@} /// Extraction operator for complex values. template @@ -1548,7 +1548,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif #endif - // @} group complex_numbers + /// @} group complex_numbers _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/condition_variable b/libstdc++-v3/include/std/condition_variable index a08cfc62705..82a3afec563 100644 --- a/libstdc++-v3/include/std/condition_variable +++ b/libstdc++-v3/include/std/condition_variable @@ -453,7 +453,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // end inline namespace - // @} group condition_variables + /// @} group condition_variables _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/fstream b/libstdc++-v3/include/std/fstream index efc99d1e5a5..0f02938cb1d 100644 --- a/libstdc++-v3/include/std/fstream +++ b/libstdc++-v3/include/std/fstream @@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION bool _M_reading; bool _M_writing; - //@{ + ///@{ /** * Necessary bits for putback buffer management. * @@ -165,7 +165,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char_type* _M_pback_cur_save; char_type* _M_pback_end_save; bool _M_pback_init; - //@} + ///@} // Cached codecvt facet. const __codecvt_type* _M_codecvt; diff --git a/libstdc++-v3/include/std/future b/libstdc++-v3/include/std/future index 09f4af6fe7c..ceb1959e3b7 100644 --- a/libstdc++-v3/include/std/future +++ b/libstdc++-v3/include/std/future @@ -1767,7 +1767,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION #endif // _GLIBCXX_ASYNC_ABI_COMPAT #endif // _GLIBCXX_HAS_GTHREADS - // @} group futures + /// @} group futures _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/iostream b/libstdc++-v3/include/std/iostream index f988342b90a..970c0e4fecc 100644 --- a/libstdc++-v3/include/std/iostream +++ b/libstdc++-v3/include/std/iostream @@ -56,7 +56,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * startup and termination. For more information, see the section of the * manual linked to above. */ - //@{ + ///@{ extern istream cin; /// Linked to standard input extern ostream cout; /// Linked to standard output extern ostream cerr; /// Linked to standard error (unbuffered) @@ -68,7 +68,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION extern wostream wcerr; /// Linked to standard error (unbuffered) extern wostream wclog; /// Linked to standard error (buffered) #endif - //@} + ///@} // For construction of filebuffers for cout, cin, cerr, clog et. al. static ios_base::Init __ioinit; diff --git a/libstdc++-v3/include/std/istream b/libstdc++-v3/include/std/istream index 407c1ccda49..5454f87a38e 100644 --- a/libstdc++-v3/include/std/istream +++ b/libstdc++-v3/include/std/istream @@ -107,7 +107,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class sentry; friend class sentry; - //@{ + ///@{ /** * @brief Interface for manipulators. * @@ -133,9 +133,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pf(*this); return *this; } - //@} + ///@} - //@{ + ///@{ /** * @name Extractors * @@ -155,7 +155,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * be rethrown if badbit is set in the exceptions mask. */ - //@{ + ///@{ /** * @brief Integer arithmetic extractors * @param __n A variable of builtin integral type. @@ -199,9 +199,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator>>(unsigned long long& __n) { return _M_extract(__n); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Floating point arithmetic extractors * @param __f A variable of builtin floating point type. @@ -221,7 +221,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __istream_type& operator>>(long double& __f) { return _M_extract(__f); } - //@} + ///@} /** * @brief Basic arithmetic extractors @@ -257,7 +257,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ __istream_type& operator>>(__streambuf_type* __sb); - //@} + ///@} // [27.6.1.3] unformatted input /** @@ -269,7 +269,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION gcount() const { return _M_gcount; } - //@{ + ///@{ /** * @name Unformatted Input Functions * @@ -600,7 +600,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ __istream_type& seekg(off_type, ios_base::seekdir); - //@} + ///@} protected: basic_istream() @@ -735,7 +735,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return _M_ok; } }; - //@{ + ///@{ /** * @brief Character extractors * @param __in An input stream. @@ -760,9 +760,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline basic_istream& operator>>(basic_istream& __in, signed char& __c) { return (__in >> reinterpret_cast(__c)); } - //@} + ///@} - //@{ + ///@{ /** * @brief Character string extractors * @param __in An input stream. @@ -807,7 +807,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION inline basic_istream& operator>>(basic_istream& __in, signed char* __s) { return (__in >> reinterpret_cast(__s)); } - //@} + ///@} /** * @brief Template class basic_iostream diff --git a/libstdc++-v3/include/std/mutex b/libstdc++-v3/include/std/mutex index 3c619f87040..dc846f015aa 100644 --- a/libstdc++-v3/include/std/mutex +++ b/libstdc++-v3/include/std/mutex @@ -738,7 +738,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } #endif // _GLIBCXX_HAS_GTHREADS - // @} group mutexes + /// @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/numeric b/libstdc++-v3/include/std/numeric index bd70a52019b..6ad73d9713b 100644 --- a/libstdc++-v3/include/std/numeric +++ b/libstdc++-v3/include/std/numeric @@ -693,7 +693,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return __result; } - // @} group numeric_ops + /// @} group numeric_ops _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/std/ostream b/libstdc++-v3/include/std/ostream index 9a80adf3a5a..97ff1cee4e6 100644 --- a/libstdc++-v3/include/std/ostream +++ b/libstdc++-v3/include/std/ostream @@ -96,7 +96,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class sentry; friend class sentry; - //@{ + ///@{ /** * @brief Interface for manipulators. * @@ -132,9 +132,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __pf(*this); return *this; } - //@} + ///@} - //@{ + ///@{ /** * @name Inserters * @@ -153,7 +153,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION * be rethrown. */ - //@{ + ///@{ /** * @brief Integer arithmetic inserters * @param __n A variable of builtin integral type. @@ -205,9 +205,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator<<(unsigned long long __n) { return _M_insert(__n); } #endif - //@} + ///@} - //@{ + ///@{ /** * @brief Floating point arithmetic inserters * @param __f A variable of builtin floating point type. @@ -231,7 +231,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __ostream_type& operator<<(long double __f) { return _M_insert(__f); } - //@} + ///@} /** * @brief Pointer arithmetic inserters @@ -274,9 +274,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ __ostream_type& operator<<(__streambuf_type* __sb); - //@} + ///@} - //@{ + ///@{ /** * @name Unformatted Output Functions * @@ -339,7 +339,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ __ostream_type& write(const char_type* __s, streamsize __n); - //@} + ///@} /** * @brief Synchronizing the stream buffer. @@ -485,7 +485,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return _M_ok; } }; - //@{ + ///@{ /** * @brief Character inserters * @param __out An output stream. @@ -568,9 +568,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator<<(basic_ostream&, char32_t) = delete; #endif // _GLIBCXX_USE_WCHAR_T #endif // C++20 - //@} + ///@} - //@{ + ///@{ /** * @brief String inserters * @param __out An output stream. @@ -664,7 +664,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator<<(basic_ostream&, const char32_t*) = delete; #endif // _GLIBCXX_USE_WCHAR_T #endif // C++20 - //@} + ///@} // Standard basic_ostream manipulators diff --git a/libstdc++-v3/include/std/ratio b/libstdc++-v3/include/std/ratio index 83c8c792793..293ed9a8e7c 100644 --- a/libstdc++-v3/include/std/ratio +++ b/libstdc++-v3/include/std/ratio @@ -567,7 +567,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef ratio< 1000000000000000, 1> peta; typedef ratio< 1000000000000000000, 1> exa; - // @} group ratio + /// @} group ratio _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/shared_mutex b/libstdc++-v3/include/std/shared_mutex index 414dce3a1b7..edfd4e4e523 100644 --- a/libstdc++-v3/include/std/shared_mutex +++ b/libstdc++-v3/include/std/shared_mutex @@ -846,7 +846,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION swap(shared_lock<_Mutex>& __x, shared_lock<_Mutex>& __y) noexcept { __x.swap(__y); } - // @} group mutexes + /// @} group mutexes _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/stdexcept b/libstdc++-v3/include/std/stdexcept index 49161d5d0d2..43b84cda398 100644 --- a/libstdc++-v3/include/std/stdexcept +++ b/libstdc++-v3/include/std/stdexcept @@ -299,7 +299,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION virtual ~underflow_error() _GLIBCXX_NOTHROW; }; - // @} group exceptions + /// @} group exceptions _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/streambuf b/libstdc++-v3/include/std/streambuf index 7cb4fabbb89..5c6267e8e7e 100644 --- a/libstdc++-v3/include/std/streambuf +++ b/libstdc++-v3/include/std/streambuf @@ -122,7 +122,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION class basic_streambuf { public: - //@{ + ///@{ /** * These are standard types. They permit a standardized way of * referring to names of (or names dependent on) the template @@ -133,12 +133,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typedef typename traits_type::int_type int_type; typedef typename traits_type::pos_type pos_type; typedef typename traits_type::off_type off_type; - //@} + ///@} - //@{ + ///@{ /// This is a non-standard type. typedef basic_streambuf __streambuf_type; - //@} + ///@} friend class basic_ios; friend class basic_istream; @@ -234,7 +234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return _M_buf_locale; } // [27.5.2.2.2] buffer management and positioning - //@{ + ///@{ /** * @brief Entry points for derived buffer functions. * @@ -276,7 +276,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION */ int pubsync() { return this->sync(); } - //@} + ///@} // [27.5.2.2.3] get area /** @@ -474,7 +474,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { } // [27.5.2.3.1] get area access - //@{ + ///@{ /** * @brief Access to the get area. * @@ -493,7 +493,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char_type* egptr() const { return _M_in_end; } - //@} + ///@} /** * @brief Moving the read position. @@ -521,7 +521,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } // [27.5.2.3.2] put area access - //@{ + ///@{ /** * @brief Access to the put area. * @@ -540,7 +540,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION char_type* epptr() const { return _M_out_end; } - //@} + ///@} /** * @brief Moving the write position. diff --git a/libstdc++-v3/include/std/system_error b/libstdc++-v3/include/std/system_error index f92b4345895..d376610e761 100644 --- a/libstdc++-v3/include/std/system_error +++ b/libstdc++-v3/include/std/system_error @@ -262,7 +262,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator<<(basic_ostream<_CharT, _Traits>& __os, const error_code& __e) { return (__os << __e.category().name() << ':' << __e.value()); } - // @} + /// @} error_condition make_error_condition(errc) noexcept; diff --git a/libstdc++-v3/include/std/valarray b/libstdc++-v3/include/std/valarray index be2e70dc06a..f5d08973765 100644 --- a/libstdc++-v3/include/std/valarray +++ b/libstdc++-v3/include/std/valarray @@ -595,7 +595,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION return _M_data[__i]; } - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace @@ -1245,7 +1245,7 @@ _DEFINE_BINARY_OPERATOR(>=, __greater_equal) { return std::__addressof(__va[0]) + __va.size(); } #endif // C++11 - // @} group numeric_arrays + /// @} group numeric_arrays _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/variant b/libstdc++-v3/include/std/variant index fa0284d9738..0a754fb4196 100644 --- a/libstdc++-v3/include/std/variant +++ b/libstdc++-v3/include/std/variant @@ -23,7 +23,7 @@ // . /** @file variant - * This is the C++ Library header. + * This is the `` C++ Library header. */ #ifndef _GLIBCXX_VARIANT diff --git a/libstdc++-v3/include/tr1/cmath b/libstdc++-v3/include/tr1/cmath index 0ad4121e895..c4a3ad4bb35 100644 --- a/libstdc++-v3/include/tr1/cmath +++ b/libstdc++-v3/include/tr1/cmath @@ -1057,7 +1057,7 @@ namespace tr1 #endif // __cplusplus < 201103L - // @} + /// @} #endif /* _GLIBCXX_USE_C99_MATH_TR1 */ @@ -1618,7 +1618,7 @@ namespace tr1 return __detail::__sph_neumann<__type>(__n, __x); } - // @} tr1_math_spec_func + /// @} tr1_math_spec_func } // namespace tr1 @@ -1698,7 +1698,7 @@ namespace tr1 return __detail::__hyperg<__type>(__a, __b, __c, __x); } - // @} tr1_math_spec_func + /// @} tr1_math_spec_func } // namespace tr1 diff --git a/libstdc++-v3/include/tr1/regex b/libstdc++-v3/include/tr1/regex index 1efbcf86789..7d7ed6131a9 100644 --- a/libstdc++-v3/include/tr1/regex +++ b/libstdc++-v3/include/tr1/regex @@ -53,7 +53,7 @@ namespace tr1 * @defgroup tr1_regex Regular Expressions * A facility for performing regular expression pattern matching. */ - //@{ + ///@{ /** @namespace std::regex_constants * @brief ISO C++ 0x entities sub namespace for regex. @@ -63,7 +63,7 @@ namespace regex_constants /** * @name 5.1 Regular Expression Syntax Options */ - //@{ + ///@{ enum __syntax_option { _S_icase, @@ -174,7 +174,7 @@ namespace regex_constants */ static const syntax_option_type egrep = 1 << _S_egrep; - //@} + ///@} /** * @name 5.2 Matching Rules @@ -185,7 +185,7 @@ namespace regex_constants * below for any bitmask elements set. * */ - //@{ + ///@{ enum __match_flag { @@ -315,12 +315,12 @@ namespace regex_constants */ static const match_flag_type format_first_only = 1 << _S_first_only; - //@} + ///@} /** * @name 5.3 Error Types */ - //@{ + ///@{ enum error_type { @@ -396,7 +396,7 @@ namespace regex_constants */ static const error_type error_stack(_S_error_stack); - //@} + ///@} } // [7.8] Class regex_error @@ -735,7 +735,7 @@ namespace regex_constants * @name Constants * tr1 [7.8.1] std [28.8.1] */ - //@{ + ///@{ static const regex_constants::syntax_option_type icase = regex_constants::icase; static const regex_constants::syntax_option_type nosubs @@ -756,7 +756,7 @@ namespace regex_constants = regex_constants::grep; static const regex_constants::syntax_option_type egrep = regex_constants::egrep; - //@} + ///@} // [7.8.2] construct/copy/destroy /** @@ -1787,7 +1787,7 @@ namespace regex_constants /** * @name 10.? Public Types */ - //@{ + ///@{ typedef sub_match<_Bi_iter> value_type; typedef typename _Base_type::const_reference const_reference; typedef const_reference reference; @@ -1799,13 +1799,13 @@ namespace regex_constants typedef _Allocator allocator_type; typedef typename iterator_traits<_Bi_iter>::value_type char_type; typedef basic_string string_type; - //@} + ///@} public: /** * @name 10.1 Construction, Copying, and Destruction */ - //@{ + ///@{ /** * @brief Constructs a default %match_results container. @@ -1841,12 +1841,12 @@ namespace regex_constants ~match_results() { } - //@} + ///@} /** * @name 10.2 Size */ - //@{ + ///@{ /** * @brief Gets the number of matches and submatches. @@ -1874,12 +1874,12 @@ namespace regex_constants empty() const { return size() == 0; } - //@} + ///@} /** * @name 10.3 Element Access */ - //@{ + ///@{ /** * @brief Gets the length of the indicated submatch. @@ -1988,7 +1988,7 @@ namespace regex_constants { return _Base_type::end(); } #endif - //@} + ///@} /** * @name 10.4 Formatting @@ -1998,7 +1998,7 @@ namespace regex_constants * and escape sequences accepted by these functions are * determined by their @p flags parameter as documented above. */ - //@{ + ///@{ /** * @todo Implement this function. @@ -2017,12 +2017,12 @@ namespace regex_constants regex_constants::match_flag_type __flags = regex_constants::format_default) const; - //@} + ///@} /** * @name 10.5 Allocator */ - //@{ + ///@{ /** * @brief Gets a copy of the allocator. @@ -2031,12 +2031,12 @@ namespace regex_constants //get_allocator() const; using _Base_type::get_allocator; - //@} + ///@} /** * @name 10.6 Swap */ - //@{ + ///@{ /** * @brief Swaps the contents of two match_results. @@ -2049,7 +2049,7 @@ namespace regex_constants std::swap(_M_prefix, __that._M_prefix); std::swap(_M_suffix, __that._M_suffix); } - //@} + ///@} private: bool _M_matched; @@ -2105,7 +2105,7 @@ namespace regex_constants /** * @name Matching, Searching, and Replacing */ - //@{ + ///@{ /** * @brief Determines if there is a match between the regular expression @p e @@ -2432,7 +2432,7 @@ namespace regex_constants return __result; } - //@} + ///@} // tr1 [7.12.1] std [28.12] Class template regex_iterator /** @@ -2718,7 +2718,7 @@ namespace regex_constants typedef regex_token_iterator wsregex_token_iterator; #endif - //@} + ///@} } _GLIBCXX_END_NAMESPACE_VERSION diff --git a/libstdc++-v3/include/tr2/dynamic_bitset b/libstdc++-v3/include/tr2/dynamic_bitset index 1591bc5a494..634679dfc45 100644 --- a/libstdc++-v3/include/tr2/dynamic_bitset +++ b/libstdc++-v3/include/tr2/dynamic_bitset @@ -748,7 +748,7 @@ namespace tr2 } // 23.3.5.2 dynamic_bitset operations: - //@{ + ///@{ /** * @brief Operations on dynamic_bitsets. * @param __rhs A same-sized dynamic_bitset. @@ -789,9 +789,9 @@ namespace tr2 this->_M_do_dif(__rhs); return *this; } - //@} + ///@} - //@{ + ///@{ /** * @brief Operations on dynamic_bitsets. * @param __pos The number of places to shift. @@ -823,7 +823,7 @@ namespace tr2 this->_M_do_reset(); return *this; } - //@} + ///@} // Set, reset, and flip. /** @@ -905,7 +905,7 @@ namespace tr2 operator~() const { return dynamic_bitset<_WordT, _Alloc>(*this).flip(); } - //@{ + ///@{ /** * @brief Array-indexing support. * @param __pos Index into the %dynamic_bitset. @@ -921,7 +921,7 @@ namespace tr2 const_reference operator[](size_type __pos) const { return _M_unchecked_test(__pos); } - //@} + ///@} /** * @brief Returns a numerical interpretation of the %dynamic_bitset. @@ -1052,7 +1052,7 @@ namespace tr2 none() const { return !this->_M_is_any(); } - //@{ + ///@{ /// Self-explanatory. dynamic_bitset operator<<(size_type __pos) const @@ -1061,7 +1061,7 @@ namespace tr2 dynamic_bitset operator>>(size_type __pos) const { return dynamic_bitset(*this) >>= __pos; } - //@} + ///@} /** * @brief Finds the index of the first "on" bit. @@ -1115,7 +1115,7 @@ namespace tr2 } - //@{ + ///@{ /// These comparisons for equality/inequality are, well, @e bitwise. template @@ -1141,10 +1141,10 @@ namespace tr2 operator>=(const dynamic_bitset<_WordT, _Alloc>& __lhs, const dynamic_bitset<_WordT, _Alloc>& __rhs) { return !(__lhs < __rhs); } - //@} + ///@} // 23.3.5.3 bitset operations: - //@{ + ///@{ /** * @brief Global bitwise operations on bitsets. * @param __x A bitset. @@ -1192,7 +1192,7 @@ namespace tr2 __result -= __y; return __result; } - //@} + ///@} /// Stream output operator for dynamic_bitset. template Date: Tue Apr 6 16:24:06 2021 +0100 libstdc++: Fix Doxygen warnings libstdc++-v3/ChangeLog: * include/bits/alloc_traits.h: Use markdown for code font. * include/bits/basic_string.h: Fix @param names. * include/bits/regex.h: Fix duplicate @retval names, and rename. * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add group open to match existing group close. * include/ext/pb_ds/priority_queue.hpp: Add blank line before group open. (cherry picked from commit daef4e4d934716b933fa445a0ec6650aeb642751) diff --git a/libstdc++-v3/include/bits/alloc_traits.h b/libstdc++-v3/include/bits/alloc_traits.h index 86d8ed221ff..4fcaa533f46 100644 --- a/libstdc++-v3/include/bits/alloc_traits.h +++ b/libstdc++-v3/include/bits/alloc_traits.h @@ -341,7 +341,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { __a.deallocate(__p, __n); } /** - * @brief Construct an object of type @a _Tp + * @brief Construct an object of type `_Tp` * @param __a An allocator. * @param __p Pointer to memory of suitable size and alignment for Tp * @param __args Constructor arguments. diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index 0b893bcea85..ab9fb04c451 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -4672,9 +4672,9 @@ _GLIBCXX_END_NAMESPACE_CXX11 /** * @brief Insert a string_view. - * @param __pos Position in string to insert at. - * @param __svt The object convertible to string_view to insert from. - * @param __pos Position in string_view to insert + * @param __pos1 Position in string to insert at. + * @param __svt The object convertible to string_view to insert from. + * @param __pos2 Position in string_view to insert * from. * @param __n The number of characters to insert. * @return Reference to this string. diff --git a/libstdc++-v3/include/bits/regex.h b/libstdc++-v3/include/bits/regex.h index 43d0ddb61bf..aa442e17656 100644 --- a/libstdc++-v3/include/bits/regex.h +++ b/libstdc++-v3/include/bits/regex.h @@ -915,9 +915,9 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 * * @param __s Another matched sequence to compare to this one. * - * @retval <0 this matched sequence will collate before @p __s. - * @retval =0 this matched sequence is equivalent to @p __s. - * @retval <0 this matched sequence will collate after @p __s. + * @retval negative This matched sequence will collate before `__s`. + * @retval zero This matched sequence is equivalent to `__s`. + * @retval positive This matched sequence will collate after `__s`. */ int compare(const sub_match& __s) const @@ -925,13 +925,13 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 /** * @{ - * @brief Compares this sub_match to a string. + * @brief Compares this `sub_match` to a string. * - * @param __s A string to compare to this sub_match. + * @param __s A string to compare to this `sub_match`. * - * @retval <0 this matched sequence will collate before @p __s. - * @retval =0 this matched sequence is equivalent to @p __s. - * @retval <0 this matched sequence will collate after @p __s. + * @retval negative This matched sequence will collate before `__s`. + * @retval zero This matched sequence is equivalent to `__s`. + * @retval positive This matched sequence will collate after `__s`. */ int compare(const string_type& __s) const diff --git a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp index ec94b0d978d..9fec9a078cb 100644 --- a/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp +++ b/libstdc++-v3/include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp @@ -63,6 +63,12 @@ namespace __gnu_pbds { namespace detail { + /** + * @ingroup pbds + * + * @{ + */ + /// Specialization for pairing_heap. template struct container_base_dispatch<_VTp, Cmp_Fn, _Alloc, pairing_heap_tag, diff --git a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp index 987d08bec27..6dca5e1a6f6 100644 --- a/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp +++ b/libstdc++-v3/include/ext/pb_ds/priority_queue.hpp @@ -51,6 +51,7 @@ namespace __gnu_pbds /** * @defgroup heap-based Heap-Based * @ingroup containers-pbds + * * @{ */ @@ -151,6 +152,6 @@ namespace __gnu_pbds swap(priority_queue& other) { base_type::swap(other); } }; -} // namespace __gnu_pbds ///@} heap-based +} // namespace __gnu_pbds #endif commit f5788aaa98bd12fc668f65d9652c7f8b6b35ac09 Author: Jonathan Wakely Date: Thu Apr 8 15:10:35 2021 +0100 libstdc++: Change URL for PSTL libstdc++-v3/ChangeLog: * doc/xml/manual/status_cxx2017.xml: Replace Intel parallelstl link with LLVM repo for PSTL. * doc/html/manual/status.html: Regenerate. diff --git a/libstdc++-v3/doc/html/manual/status.html b/libstdc++-v3/doc/html/manual/status.html index a956ac2721d..1cb14d9b3ff 100644 --- a/libstdc++-v3/doc/html/manual/status.html +++ b/libstdc++-v3/doc/html/manual/status.html @@ -932,7 +932,7 @@ since C++14 and the implementation is complete. 28 Algorithms - 28.1General  28.2Header <algorithm> synopsis  28.3Algorithms requirements  28.4Parallel algorithms Using PSTL28.5Non-modifying sequence operationsY 28.6Mutating sequence operationsY 28.7Sorting and related operationsY 28.8C library algorithmsY  + 28.1General  28.2Header <algorithm> synopsis  28.3Algorithms requirements  28.4Parallel algorithms Using PSTL28.5Non-modifying sequence operationsY 28.6Mutating sequence operationsY 28.7Sorting and related operationsY 28.8C library algorithmsY  29 Numerics diff --git a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml index 0c3c23b4b31..148e3d452a4 100644 --- a/libstdc++-v3/doc/xml/manual/status_cxx2017.xml +++ b/libstdc++-v3/doc/xml/manual/status_cxx2017.xml @@ -1885,7 +1885,7 @@ since C++14 and the implementation is complete. 28.4 Parallel algorithms - Using PSTL + Using PSTL 28.5 commit beb485ddeb066d03b2568bb1bebaa2902b4dbf97 Author: Jonathan Wakely Date: Wed Apr 7 16:05:42 2021 +0100 libstdc++: Fix filesystem::path construction from COW string [PR 99805] Calling the non-const data() member on a COW string makes it "leaked", possibly resulting in reallocating the string to ensure a unique owner. The path::_M_split_cmpts() member parses its _M_pathname string using string_view objects and then calls _M_pathname.data() to find the offset of each string_view from the start of the string. However because _M_pathname is non-const that will cause a COW string to reallocate if it happens to be shared with another string object. This results in the offsets calculated for each component being wrong (i.e. undefined) because the string views no longer refer to substrings of the _M_pathname member. The fix is to use the parse.offset(c) member which gets the offset safely. The bug only happens for the path(string_type&&) constructor and only for COW strings. When constructed from an lvalue string the string's contents are copied rather than just incrementing the refcount, so there's no reallocation when calling the non-const data() member. The testsuite changes check the lvalue case anyway, because we should probably change the deep copying to just be a refcount increment (by adding a path(const string_type&) constructor or an overload for __effective_range(const string_type&), for COW strings only). libstdc++-v3/ChangeLog: PR libstdc++/99805 * src/c++17/fs_path.cc (path::_M_split_cmpts): Do not call non-const member on _M_pathname, to avoid copy-on-write. * testsuite/27_io/filesystem/path/decompose/parent_path.cc: Check construction from strings that might be shared. (cherry picked from commit e06d3f5dd7d0c6b4a20fe813e6ee5addd097f560) diff --git a/libstdc++-v3/src/c++17/fs_path.cc b/libstdc++-v3/src/c++17/fs_path.cc index edfb91fc6c5..812f39fe253 100644 --- a/libstdc++-v3/src/c++17/fs_path.cc +++ b/libstdc++-v3/src/c++17/fs_path.cc @@ -1907,10 +1907,9 @@ path::_M_split_cmpts() _M_cmpts.type(_Type::_Multi); _M_cmpts.reserve(_M_cmpts.size() + buf.size()); auto output = _M_cmpts._M_impl->end(); - for (auto& c : buf) + for (const auto& c : buf) { - auto pos = c.str.data() - _M_pathname.data(); - ::new(output++) _Cmpt(c.str, c.type, pos); + ::new(output++) _Cmpt(c.str, c.type, parser.offset(c)); ++_M_cmpts._M_impl->_M_size; } next = buf.begin(); @@ -1930,9 +1929,8 @@ path::_M_split_cmpts() auto output = _M_cmpts._M_impl->end(); for (int i = 0; i < n; ++i) { - auto c = buf[i]; - auto pos = c.str.data() - _M_pathname.data(); - ::new(output++) _Cmpt(c.str, c.type, pos); + const auto& c = buf[i]; + ::new(output++) _Cmpt(c.str, c.type, parser.offset(c)); ++_M_cmpts._M_impl->_M_size; } } diff --git a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc index cf3724025f7..16175c4072a 100644 --- a/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc +++ b/libstdc++-v3/testsuite/27_io/filesystem/path/decompose/parent_path.cc @@ -18,7 +18,7 @@ // with this library; see the file COPYING3. If not see // . -// 8.4.9 path decomposition [path.decompose] +// C++17 30.10.8.4.9 path decomposition [fs.path.decompose] #include #include @@ -64,9 +64,32 @@ test02() } } +void +test03() +{ + const std::string narrow = "there/are/no/wrong/turns/only/unexpected/paths"; + const path::string_type s(narrow.begin(), narrow.end()); + const auto s1 = s.substr(0, s.length() - 6); // remove "/paths" + const auto s2 = s1.substr(0, s1.length() - 16); // remove "/only/..." + + // PR libstdc++/99805 + path p = path::string_type(s); + auto pp = p.parent_path(); + VERIFY( pp.native() == s1 ); + pp = pp.parent_path().parent_path(); + VERIFY( pp.native() == s2 ); + + path from_lval(s); + pp = from_lval.parent_path(); + VERIFY( pp.native() == s1 ); + pp = pp.parent_path().parent_path(); + VERIFY( pp.native() == s2 ); +} + int main() { test01(); test02(); + test03(); } commit 2feec6285c304d33c72e42e022d9e42d561a7607 Author: François Dumont Date: Fri Jul 3 08:13:19 2020 +0200 libstdc++: Fix [multi]map/[multi]set move constructors noexcept qualification Container move constructors shall not consider their allocator move constructor qualification. libstdc++-v3/ChangeLog: PR libstdc++/96029 * include/bits/stl_tree.h (_Rb_tree_impl(_Rb_tree_impl&&)): Add noexcept qualification based only on _Compare one. * testsuite/23_containers/map/cons/noexcept_move_construct.cc: Add static asserts. * testsuite/23_containers/multimap/cons/noexcept_move_construct.cc: Likewise. * testsuite/23_containers/multiset/cons/noexcept_move_construct.cc: Likewise. * testsuite/23_containers/set/cons/noexcept_move_construct.cc: Likewise. (cherry picked from commit c832cf1c1d114aed70c2f84566cf4d63de0a56d0) diff --git a/libstdc++-v3/include/bits/stl_tree.h b/libstdc++-v3/include/bits/stl_tree.h index 5be15afa257..21b72cebf2e 100644 --- a/libstdc++-v3/include/bits/stl_tree.h +++ b/libstdc++-v3/include/bits/stl_tree.h @@ -698,7 +698,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : _Node_allocator(__a), _Base_key_compare(__comp) { } #else - _Rb_tree_impl(_Rb_tree_impl&&) = default; + _Rb_tree_impl(_Rb_tree_impl&&) + noexcept( is_nothrow_move_constructible<_Base_key_compare>::value ) + = default; explicit _Rb_tree_impl(_Node_allocator&& __a) diff --git a/libstdc++-v3/testsuite/23_containers/map/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/map/cons/noexcept_move_construct.cc index 119b199ddff..25d1c9b5aca 100644 --- a/libstdc++-v3/testsuite/23_containers/map/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/map/cons/noexcept_move_construct.cc @@ -29,6 +29,33 @@ static_assert( std::is_nothrow_constructible::value, "noexcept move constructor with allocator" ); +template + class not_noexcept_move_constructor_alloc : public std::allocator + { + public: + not_noexcept_move_constructor_alloc() noexcept { } + + not_noexcept_move_constructor_alloc( + const not_noexcept_move_constructor_alloc& x) noexcept + : std::allocator(x) + { } + + not_noexcept_move_constructor_alloc( + not_noexcept_move_constructor_alloc&& x) noexcept(false) + : std::allocator(std::move(x)) + { } + + template + struct rebind + { typedef not_noexcept_move_constructor_alloc<_Tp1> other; }; + }; + +typedef std::map, + not_noexcept_move_constructor_alloc>> amtype; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor with not noexcept alloc" ); + struct not_noexcept_less { not_noexcept_less() = default; @@ -42,6 +69,9 @@ struct not_noexcept_less typedef std::map emtype; +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor with not noexcept less" ); + static_assert( !std::is_nothrow_constructible::value, - "except move constructor with allocator" ); + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/multimap/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/multimap/cons/noexcept_move_construct.cc index 44c3015a282..af545ae297c 100644 --- a/libstdc++-v3/testsuite/23_containers/multimap/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/multimap/cons/noexcept_move_construct.cc @@ -29,6 +29,33 @@ static_assert( std::is_nothrow_constructible::value, "noexcept move constructor with allocator" ); +template + class not_noexcept_move_constructor_alloc : public std::allocator + { + public: + not_noexcept_move_constructor_alloc() noexcept { } + + not_noexcept_move_constructor_alloc( + const not_noexcept_move_constructor_alloc& x) noexcept + : std::allocator(x) + { } + + not_noexcept_move_constructor_alloc( + not_noexcept_move_constructor_alloc&& x) noexcept(false) + : std::allocator(std::move(x)) + { } + + template + struct rebind + { typedef not_noexcept_move_constructor_alloc<_Tp1> other; }; + }; + +typedef std::multimap, + not_noexcept_move_constructor_alloc>> ammtype; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor with not noexcept alloc" ); + struct not_noexcept_less { not_noexcept_less() = default; @@ -42,6 +69,9 @@ struct not_noexcept_less typedef std::multimap emmtype; +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor with not noexcept less" ); + static_assert( !std::is_nothrow_constructible::value, - "except move constructor with allocator" ); + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/multiset/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/multiset/cons/noexcept_move_construct.cc index 225b2206ad4..ed4d9128606 100644 --- a/libstdc++-v3/testsuite/23_containers/multiset/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/multiset/cons/noexcept_move_construct.cc @@ -29,6 +29,33 @@ static_assert( std::is_nothrow_constructible::value, "noexcept move constructor with allocator" ); +template + class not_noexcept_move_constructor_alloc : public std::allocator + { + public: + not_noexcept_move_constructor_alloc() noexcept { } + + not_noexcept_move_constructor_alloc( + const not_noexcept_move_constructor_alloc& x) noexcept + : std::allocator(x) + { } + + not_noexcept_move_constructor_alloc( + not_noexcept_move_constructor_alloc&& x) noexcept(false) + : std::allocator(std::move(x)) + { } + + template + struct rebind + { typedef not_noexcept_move_constructor_alloc<_Tp1> other; }; + }; + +typedef std::multiset, + not_noexcept_move_constructor_alloc> amstype; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor with not noexcept alloc" ); + struct not_noexcept_less { not_noexcept_less() = default; @@ -42,6 +69,9 @@ struct not_noexcept_less typedef std::multiset emstype; +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor with not noexcept less" ); + static_assert( !std::is_nothrow_constructible::value, - "except move constructor with allocator" ); + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/set/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/set/cons/noexcept_move_construct.cc index acd84a8fcd0..dc96236a668 100644 --- a/libstdc++-v3/testsuite/23_containers/set/cons/noexcept_move_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/set/cons/noexcept_move_construct.cc @@ -29,6 +29,33 @@ static_assert( std::is_nothrow_constructible::value, "noexcept move constructor with allocator" ); +template + class not_noexcept_move_constructor_alloc : public std::allocator + { + public: + not_noexcept_move_constructor_alloc() noexcept { } + + not_noexcept_move_constructor_alloc( + const not_noexcept_move_constructor_alloc& x) noexcept + : std::allocator(x) + { } + + not_noexcept_move_constructor_alloc( + not_noexcept_move_constructor_alloc&& x) noexcept(false) + : std::allocator(std::move(x)) + { } + + template + struct rebind + { typedef not_noexcept_move_constructor_alloc<_Tp1> other; }; + }; + +typedef std::set, + not_noexcept_move_constructor_alloc> astype; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor with not noexcept alloc" ); + struct not_noexcept_less { not_noexcept_less() = default; @@ -42,6 +69,9 @@ struct not_noexcept_less typedef std::set estype; +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor with not noexcept less" ); + static_assert( !std::is_nothrow_constructible::value, - "except move constructor with allocator" ); + "not noexcept move constructor with allocator" ); commit 1c4e8a96cd695c03ff85299bf2392476feae99bb Author: François Dumont Date: Mon Jan 20 19:15:43 2020 +0100 libstdc++: Fix unordered containers move constructors noexcept qualification _Hashtable move constructor is wrongly qualified as noexcept(true) regardless of _Equal and _H1 copy constructor qualifications. _Hashtable allocator-aware move constructor is missing its noexcept qualification like the depending unordered containers ones. This backport also includes the changes from r11-8062. libstdc++-v3/ChangeLog: PR libstdc++/96029 * include/bits/hashtable.h (_Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, true_type)): Add noexcept qualification. (_Hashtable(_Hashtable&&)): Fix noexcept qualification. (_Hashtable(_Hashtable&&, const allocator_type&)): Add noexcept qualification. * include/bits/unordered_map.h (unordered_map(unordered_map&&, const allocator_type&)): Add noexcept qualification. (unordered_multimap(unordered_multimap&&, const allocator_type&)): Likewise. * include/bits/unordered_set.h (unordered_set(unordered_set&&, const allocator_type&)): Likewise. (unordered_multiset(unordered_multiset&&, const allocator_type&)): Likewise. * include/debug/unordered_map (unordered_map(unordered_map&&, const allocator_type&)): Likewise. (unordered_multimap(unordered_multimap&&, const allocator_type&)): Likewise. * include/debug/unordered_set (unordered_set(unordered_set&&, const allocator_type&)): Likewise. (unordered_multiset(unordered_multiset&&, const allocator_type&)): Likewise. * testsuite/23_containers/unordered_map/allocator/default_init.cc: New test. * testsuite/23_containers/unordered_map/cons/noexcept_default_construct.cc: New test. * testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc: New test. * testsuite/23_containers/unordered_map/modifiers/move_assign.cc: New test. * testsuite/23_containers/unordered_multimap/cons/noexcept_default_construct.cc: New test. * testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc: New test. * testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc: New test. * testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc: New test. * testsuite/23_containers/unordered_set/allocator/default_init.cc: New test. * testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc: New test. * testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc: New test. (cherry picked from commit 12324b9a934654a5c3bf4a614853ded2e0a958af) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index b00319a668b..8705d1f33b8 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -446,6 +446,24 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __hashtable_alloc(__node_alloc_type(__a)) { } + template + static constexpr bool + _S_nothrow_move() + { + if _GLIBCXX17_CONSTEXPR (_No_realloc) + if _GLIBCXX17_CONSTEXPR (is_nothrow_copy_constructible<_H1>()) + return is_nothrow_copy_constructible<_Equal>(); + return false; + } + + _Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, + true_type /* alloc always equal */) + noexcept(_S_nothrow_move()); + + _Hashtable(_Hashtable&&, __node_alloc_type&&, + false_type /* alloc always equal */); + + public: // Constructor, destructor, assignment, swap _Hashtable() = default; @@ -463,11 +481,19 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _Hashtable(const _Hashtable&); - _Hashtable(_Hashtable&&) noexcept; + _Hashtable(_Hashtable&& __ht) + noexcept(_S_nothrow_move()) + : _Hashtable(std::move(__ht), std::move(__ht._M_node_allocator()), + true_type{}) + { } _Hashtable(const _Hashtable&, const allocator_type&); - _Hashtable(_Hashtable&&, const allocator_type&); + _Hashtable(_Hashtable&& __ht, const allocator_type& __a) + noexcept(_S_nothrow_move<__node_alloc_traits::_S_always_equal()>()) + : _Hashtable(std::move(__ht), __node_alloc_type(__a), + typename __node_alloc_traits::is_always_equal{}) + { } // Use delegating constructors. explicit @@ -1285,18 +1311,21 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(_Hashtable&& __ht) noexcept + _Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, + true_type /* alloc always equal */) + noexcept(std::is_nothrow_copy_constructible<_H1>::value && + std::is_nothrow_copy_constructible<_Equal>::value) : __hashtable_base(__ht), __map_base(__ht), __rehash_base(__ht), - __hashtable_alloc(std::move(__ht._M_base_alloc())), + __hashtable_alloc(std::move(__a)), _M_buckets(__ht._M_buckets), _M_bucket_count(__ht._M_bucket_count), _M_before_begin(__ht._M_before_begin._M_nxt), _M_element_count(__ht._M_element_count), _M_rehash_policy(__ht._M_rehash_policy) { - // Update, if necessary, buckets if __ht is using its single bucket. + // Update buckets if __ht is using its single bucket. if (__ht._M_uses_single_bucket()) { _M_buckets = &_M_single_bucket; @@ -1337,11 +1366,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION typename _Traits> _Hashtable<_Key, _Value, _Alloc, _ExtractKey, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits>:: - _Hashtable(_Hashtable&& __ht, const allocator_type& __a) + _Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, + false_type /* alloc always equal */) : __hashtable_base(__ht), __map_base(__ht), __rehash_base(__ht), - __hashtable_alloc(__node_alloc_type(__a)), + __hashtable_alloc(std::move(__a)), _M_buckets(nullptr), _M_bucket_count(__ht._M_bucket_count), _M_element_count(__ht._M_element_count), diff --git a/libstdc++-v3/include/bits/unordered_map.h b/libstdc++-v3/include/bits/unordered_map.h index 42b5c618b8d..d75e89240c4 100644 --- a/libstdc++-v3/include/bits/unordered_map.h +++ b/libstdc++-v3/include/bits/unordered_map.h @@ -209,6 +209,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_map(unordered_map&& __umap, const allocator_type& __a) + noexcept( noexcept(_Hashtable(std::move(__umap._M_h), __a)) ) : _M_h(std::move(__umap._M_h), __a) { } @@ -1355,6 +1356,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multimap(unordered_multimap&& __ummap, const allocator_type& __a) + noexcept( noexcept(_Hashtable(std::move(__ummap._M_h), __a)) ) : _M_h(std::move(__ummap._M_h), __a) { } diff --git a/libstdc++-v3/include/bits/unordered_set.h b/libstdc++-v3/include/bits/unordered_set.h index 7c2b6ece329..c942978557d 100644 --- a/libstdc++-v3/include/bits/unordered_set.h +++ b/libstdc++-v3/include/bits/unordered_set.h @@ -203,6 +203,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_set(unordered_set&& __uset, const allocator_type& __a) + noexcept( noexcept(_Hashtable(std::move(__uset._M_h), __a)) ) : _M_h(std::move(__uset._M_h), __a) { } @@ -1044,6 +1045,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER */ unordered_multiset(unordered_multiset&& __umset, const allocator_type& __a) + noexcept( noexcept(_Hashtable(std::move(__umset._M_h), __a)) ) : _M_h(std::move(__umset._M_h), __a) { } diff --git a/libstdc++-v3/include/debug/unordered_map b/libstdc++-v3/include/debug/unordered_map index 17fbba3aade..54a8cba1c7b 100644 --- a/libstdc++-v3/include/debug/unordered_map +++ b/libstdc++-v3/include/debug/unordered_map @@ -136,6 +136,7 @@ namespace __debug unordered_map(unordered_map&& __umap, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) ) : _Safe(std::move(__umap._M_safe()), __a), _Base(std::move(__umap._M_base()), __a) { } @@ -160,7 +161,7 @@ namespace __debug unordered_map(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) + : unordered_map(__first, __last, __n, hasher(), key_equal(), __a) { } template @@ -168,20 +169,20 @@ namespace __debug size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_map(__first, __last, __n, __hf, key_equal(), __a) + : unordered_map(__first, __last, __n, __hf, key_equal(), __a) { } unordered_map(initializer_list __l, size_type __n, const allocator_type& __a) - : unordered_map(__l, __n, hasher(), key_equal(), __a) + : unordered_map(__l, __n, hasher(), key_equal(), __a) { } unordered_map(initializer_list __l, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_map(__l, __n, __hf, key_equal(), __a) + : unordered_map(__l, __n, __hf, key_equal(), __a) { } ~unordered_map() = default; @@ -831,6 +832,7 @@ namespace __debug unordered_multimap(unordered_multimap&& __umap, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__umap._M_base()), __a)) ) : _Safe(std::move(__umap._M_safe()), __a), _Base(std::move(__umap._M_base()), __a) { } @@ -854,26 +856,26 @@ namespace __debug unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) + : unordered_multimap(__first, __last, __n, hasher(), key_equal(), __a) { } template unordered_multimap(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) + : unordered_multimap(__first, __last, __n, __hf, key_equal(), __a) { } unordered_multimap(initializer_list __l, size_type __n, const allocator_type& __a) - : unordered_multimap(__l, __n, hasher(), key_equal(), __a) + : unordered_multimap(__l, __n, hasher(), key_equal(), __a) { } unordered_multimap(initializer_list __l, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multimap(__l, __n, __hf, key_equal(), __a) + : unordered_multimap(__l, __n, __hf, key_equal(), __a) { } ~unordered_multimap() = default; diff --git a/libstdc++-v3/include/debug/unordered_set b/libstdc++-v3/include/debug/unordered_set index 4d30852186c..609cf42a076 100644 --- a/libstdc++-v3/include/debug/unordered_set +++ b/libstdc++-v3/include/debug/unordered_set @@ -133,6 +133,7 @@ namespace __debug unordered_set(unordered_set&& __uset, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) ) : _Safe(std::move(__uset._M_safe()), __a), _Base(std::move(__uset._M_base()), __a) { } @@ -144,38 +145,38 @@ namespace __debug : _Base(__l, __n, __hf, __eql, __a) { } unordered_set(size_type __n, const allocator_type& __a) - : unordered_set(__n, hasher(), key_equal(), __a) + : unordered_set(__n, hasher(), key_equal(), __a) { } unordered_set(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_set(__n, __hf, key_equal(), __a) + : unordered_set(__n, __hf, key_equal(), __a) { } template unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) + : unordered_set(__first, __last, __n, hasher(), key_equal(), __a) { } template unordered_set(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_set(__first, __last, __n, __hf, key_equal(), __a) + : unordered_set(__first, __last, __n, __hf, key_equal(), __a) { } unordered_set(initializer_list __l, size_type __n, const allocator_type& __a) - : unordered_set(__l, __n, hasher(), key_equal(), __a) + : unordered_set(__l, __n, hasher(), key_equal(), __a) { } unordered_set(initializer_list __l, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_set(__l, __n, __hf, key_equal(), __a) + : unordered_set(__l, __n, __hf, key_equal(), __a) { } ~unordered_set() = default; @@ -701,6 +702,7 @@ namespace __debug unordered_multiset(unordered_multiset&& __uset, const allocator_type& __a) + noexcept( noexcept(_Base(std::move(__uset._M_base()), __a)) ) : _Safe(std::move(__uset._M_safe()), __a), _Base(std::move(__uset._M_base()), __a) { } @@ -712,38 +714,38 @@ namespace __debug : _Base(__l, __n, __hf, __eql, __a) { } unordered_multiset(size_type __n, const allocator_type& __a) - : unordered_multiset(__n, hasher(), key_equal(), __a) + : unordered_multiset(__n, hasher(), key_equal(), __a) { } unordered_multiset(size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__n, __hf, key_equal(), __a) + : unordered_multiset(__n, __hf, key_equal(), __a) { } template unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const allocator_type& __a) - : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) + : unordered_multiset(__first, __last, __n, hasher(), key_equal(), __a) { } template unordered_multiset(_InputIterator __first, _InputIterator __last, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) + : unordered_multiset(__first, __last, __n, __hf, key_equal(), __a) { } unordered_multiset(initializer_list __l, size_type __n, const allocator_type& __a) - : unordered_multiset(__l, __n, hasher(), key_equal(), __a) + : unordered_multiset(__l, __n, hasher(), key_equal(), __a) { } unordered_multiset(initializer_list __l, size_type __n, const hasher& __hf, const allocator_type& __a) - : unordered_multiset(__l, __n, __hf, key_equal(), __a) + : unordered_multiset(__l, __n, __hf, key_equal(), __a) { } ~unordered_multiset() = default; diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/default_init.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/default_init.cc new file mode 100644 index 00000000000..473a5f1ce47 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/allocator/default_init.cc @@ -0,0 +1,69 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do run { target c++11 } } +// { dg-options "-O0" } +// { dg-xfail-run-if "PR c++/65816" { *-*-* } } + +#include +#include +#include + +#include + +using T = int; + +using __gnu_test::default_init_allocator; + +void test01() +{ + typedef default_init_allocator> alloc_type; + typedef std::unordered_map, std::equal_to, + alloc_type> test_type; + + __gnu_cxx::__aligned_buffer buf; + __builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); + + test_type *tmp = ::new(buf._M_addr()) test_type; + + VERIFY( tmp->get_allocator().state == 0 ); + + tmp->~test_type(); +} + +void test02() +{ + typedef default_init_allocator> alloc_type; + typedef std::unordered_map, std::equal_to, + alloc_type> test_type; + + __gnu_cxx::__aligned_buffer buf; + __builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); + + test_type *tmp = ::new(buf._M_addr()) test_type(); + + VERIFY( tmp->get_allocator().state == 0 ); + + tmp->~test_type(); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_default_construct.cc new file mode 100644 index 00000000000..f859ec939d0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_default_construct.cc @@ -0,0 +1,68 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +using type1 = std::unordered_map; + +static_assert(std::is_nothrow_default_constructible::value, + "noexcept default constructible"); + +struct not_noexcept_dflt_cons_hash +{ + not_noexcept_dflt_cons_hash() /* noexcept */; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_map; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +struct not_noexcept_dflt_cons_equal_to +{ + not_noexcept_dflt_cons_equal_to() /* noexcept */; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_map, + not_noexcept_dflt_cons_equal_to>; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +template + struct not_noexcept_dflt_cons_alloc : std::allocator<_Tp> + { + not_noexcept_dflt_cons_alloc() /* noexcept */; + + template + struct rebind + { typedef not_noexcept_dflt_cons_alloc<_Tp1> other; }; + }; + +using type4 = std::unordered_map, std::equal_to, + not_noexcept_dflt_cons_alloc>>; + +static_assert(!std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc new file mode 100644 index 00000000000..b6b5b473553 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc @@ -0,0 +1,65 @@ +// { dg-do compile { target c++11 } } + +// Copyright (C) 2020 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 +// . + +#include + +using type1 = std::unordered_map; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible::value, + "noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_hash +{ + not_noexcept_copy_cons_hash() noexcept; + not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash&) /* noexcept */; + not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash&&) noexcept; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_map; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_equal_to +{ + not_noexcept_copy_cons_equal_to() noexcept; + not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to&) /* noexcept */; + not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to&&) noexcept; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_map, + not_noexcept_copy_cons_equal_to>; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/move_assign.cc b/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/move_assign.cc new file mode 100644 index 00000000000..0a5ef1113d9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_map/modifiers/move_assign.cc @@ -0,0 +1,81 @@ +// { dg-do compile { target c++11 } } + +// Copyright (C) 2020 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 +// . + +#include +#include +#include + +#include +#include +#include + +void test01() +{ + using namespace std; + using __gnu_test::counter_type; + + std::vector> insts { { 0, 0 }, { 1, 1 }, { 2, 2 } }; + typedef unordered_map Map; + Map m; + + counter_type::reset(); + + m.insert(make_move_iterator(insts.begin()), make_move_iterator(insts.end())); + + VERIFY( m.size() == 3 ); + VERIFY( counter_type::default_count == 0 ); + VERIFY( counter_type::copy_count == 0 ); + VERIFY( counter_type::move_count == 3 ); +} + +void test02() +{ + using namespace std; + using __gnu_test::counter_type; + using __gnu_test::propagating_allocator; + + typedef propagating_allocator, false> Alloc; + typedef unordered_map, equal_to, + Alloc> Map; + + Alloc a1(1); + Map m1(3, a1); + m1 = { { 0, 0 }, { 1, 1 }, { 2, 2 } }; + Alloc a2(2); + Map m2(3, a2); + m2 = { { 3, 0 }, { 4, 1 }, { 5, 2 } }; + + counter_type::reset(); + + m2 = move(m1); + + VERIFY( m1.empty() ); + VERIFY( m2.size() == 3 ); + VERIFY( counter_type::default_count == 0 ); + VERIFY( counter_type::copy_count == 0 ); + VERIFY( counter_type::move_count == 3 ); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_default_construct.cc new file mode 100644 index 00000000000..98e2b017ca9 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_default_construct.cc @@ -0,0 +1,68 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +using type1 = std::unordered_multimap; + +static_assert(std::is_nothrow_default_constructible::value, + "noexcept default constructible"); + +struct not_noexcept_dflt_cons_hash +{ + not_noexcept_dflt_cons_hash() /* noexcept */; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_multimap; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +struct not_noexcept_dflt_cons_equal_to +{ + not_noexcept_dflt_cons_equal_to() /* noexcept */; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_multimap, + not_noexcept_dflt_cons_equal_to>; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +template + struct not_noexcept_dflt_cons_alloc : std::allocator<_Tp> + { + not_noexcept_dflt_cons_alloc() /* noexcept */; + + template + struct rebind + { typedef not_noexcept_dflt_cons_alloc<_Tp1> other; }; + }; + +using type4 = std::unordered_multimap, std::equal_to, + not_noexcept_dflt_cons_alloc>>; + +static_assert(!std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc new file mode 100644 index 00000000000..e51ad5065a8 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc @@ -0,0 +1,65 @@ +// { dg-do compile { target c++11 } } + +// Copyright (C) 2020 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 +// . + +#include + +using type1 = std::unordered_multimap; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible::value, + "noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_hash +{ + not_noexcept_copy_cons_hash() noexcept; + not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash&) /* noexcept */; + not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash&&) noexcept; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_multimap; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_equal_to +{ + not_noexcept_copy_cons_equal_to() noexcept; + not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to&) /* noexcept */; + not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to&&) noexcept; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_multimap, + not_noexcept_copy_cons_equal_to>; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc new file mode 100644 index 00000000000..b7c0d802125 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc @@ -0,0 +1,68 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +using type1 = std::unordered_multiset; + +static_assert(std::is_nothrow_default_constructible::value, + "noexcept default constructible"); + +struct not_noexcept_dflt_cons_hash +{ + not_noexcept_dflt_cons_hash() /* noexcept */; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_multiset; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +struct not_noexcept_dflt_cons_equal_to +{ + not_noexcept_dflt_cons_equal_to() /* noexcept */; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_multiset, + not_noexcept_dflt_cons_equal_to>; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +template + struct not_noexcept_dflt_cons_alloc : std::allocator<_Tp> + { + not_noexcept_dflt_cons_alloc() /* noexcept */; + + template + struct rebind + { typedef not_noexcept_dflt_cons_alloc<_Tp1> other; }; + }; + +using type4 = std::unordered_multiset, std::equal_to, + not_noexcept_dflt_cons_alloc>>; + +static_assert(!std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc new file mode 100644 index 00000000000..1ccb8b0cf41 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc @@ -0,0 +1,65 @@ +// { dg-do compile { target c++11 } } + +// Copyright (C) 2020 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 +// . + +#include + +using type1 = std::unordered_multiset; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible::value, + "noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_hash +{ + not_noexcept_copy_cons_hash() noexcept; + not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash&) /* noexcept */; + not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash&&) noexcept; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_multiset; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_equal_to +{ + not_noexcept_copy_cons_equal_to() noexcept; + not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to&) /* noexcept */; + not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to&&) noexcept; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_multiset, + not_noexcept_copy_cons_equal_to>; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/default_init.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/default_init.cc new file mode 100644 index 00000000000..37110dd6eb0 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/allocator/default_init.cc @@ -0,0 +1,69 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do run { target c++11 } } +// { dg-options "-O0" } +// { dg-xfail-run-if "PR c++/65816" { *-*-* } } + +#include +#include +#include + +#include + +using T = int; + +using __gnu_test::default_init_allocator; + +void test01() +{ + typedef default_init_allocator alloc_type; + typedef std::unordered_set, std::equal_to, + alloc_type> test_type; + + __gnu_cxx::__aligned_buffer buf; + __builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); + + test_type *tmp = ::new(buf._M_addr()) test_type; + + VERIFY( tmp->get_allocator().state == 0 ); + + tmp->~test_type(); +} + +void test02() +{ + typedef default_init_allocator alloc_type; + typedef std::unordered_set, std::equal_to, + alloc_type> test_type; + + __gnu_cxx::__aligned_buffer buf; + __builtin_memset(buf._M_addr(), ~0, sizeof(test_type)); + + test_type *tmp = ::new(buf._M_addr()) test_type(); + + VERIFY( tmp->get_allocator().state == 0 ); + + tmp->~test_type(); +} + +int main() +{ + test01(); + test02(); + return 0; +} diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc new file mode 100644 index 00000000000..d60a81ffb7c --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc @@ -0,0 +1,68 @@ +// Copyright (C) 2020 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 +// . + +// { dg-do compile { target c++11 } } + +#include + +using type1 = std::unordered_set; + +static_assert(std::is_nothrow_default_constructible::value, + "noexcept default constructible"); + +struct not_noexcept_dflt_cons_hash +{ + not_noexcept_dflt_cons_hash() /* noexcept */; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_set; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +struct not_noexcept_dflt_cons_equal_to +{ + not_noexcept_dflt_cons_equal_to() /* noexcept */; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_set, + not_noexcept_dflt_cons_equal_to>; + +static_assert( !std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); + +template + struct not_noexcept_dflt_cons_alloc : std::allocator<_Tp> + { + not_noexcept_dflt_cons_alloc() /* noexcept */; + + template + struct rebind + { typedef not_noexcept_dflt_cons_alloc<_Tp1> other; }; + }; + +using type4 = std::unordered_set, std::equal_to, + not_noexcept_dflt_cons_alloc>>; + +static_assert(!std::is_nothrow_default_constructible::value, + "not noexcept default constructible"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc new file mode 100644 index 00000000000..65df57613ae --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc @@ -0,0 +1,65 @@ +// { dg-do compile { target c++11 } } + +// Copyright (C) 2020 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 +// . + +#include + +using type1 = std::unordered_set; + +static_assert( std::is_nothrow_move_constructible::value, + "noexcept move constructor" ); +static_assert( std::is_nothrow_constructible::value, + "noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_hash +{ + not_noexcept_copy_cons_hash() noexcept; + not_noexcept_copy_cons_hash(const not_noexcept_copy_cons_hash&) /* noexcept */; + not_noexcept_copy_cons_hash(not_noexcept_copy_cons_hash&&) noexcept; + + std::size_t + operator()(int) const noexcept; +}; + +using type2 = std::unordered_set; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); + +struct not_noexcept_copy_cons_equal_to +{ + not_noexcept_copy_cons_equal_to() noexcept; + not_noexcept_copy_cons_equal_to(const not_noexcept_copy_cons_equal_to&) /* noexcept */; + not_noexcept_copy_cons_equal_to(not_noexcept_copy_cons_equal_to&&) noexcept; + + bool + operator()(int, int) const noexcept; +}; + +using type3 = std::unordered_set, + not_noexcept_copy_cons_equal_to>; + +static_assert( !std::is_nothrow_move_constructible::value, + "not noexcept move constructor" ); +static_assert( !std::is_nothrow_constructible::value, + "not noexcept move constructor with allocator" ); commit 8fff47b1751042a41ee3797bdde5ab41855c7238 Author: Jonathan Wakely Date: Thu Jul 30 18:41:47 2020 +0100 libstdc++: Fix tests using wrong allocator type libstdc++-v3/ChangeLog: * testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc: Use allocator with the correct value type. * testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc: Likewise. (cherry picked from commit 357beca8bce179315bdf112c0f1df20ff5874f39) diff --git a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc index b7c0d802125..8511cb95421 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc @@ -62,7 +62,7 @@ template }; using type4 = std::unordered_multiset, std::equal_to, - not_noexcept_dflt_cons_alloc>>; + not_noexcept_dflt_cons_alloc>; static_assert(!std::is_nothrow_default_constructible::value, "not noexcept default constructible"); diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc index d60a81ffb7c..44db4aec6cf 100644 --- a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc @@ -62,7 +62,7 @@ template }; using type4 = std::unordered_set, std::equal_to, - not_noexcept_dflt_cons_alloc>>; + not_noexcept_dflt_cons_alloc>; static_assert(!std::is_nothrow_default_constructible::value, "not noexcept default constructible"); commit 348fb9db7858b0fe852da3cd1195b90b2211b983 Author: GCC Administrator Date: Fri Apr 9 00:17:46 2021 +0000 Daily bump. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3b1384e707f..29813eb5fc6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2021-04-08 Richard Biener + + PR lto/99898 + * lto-streamer.h (LTO_minor_version): Bump. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index c12f44c8f0c..e82c93a645d 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210408 +20210409 diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index fdd63cbff1a..82c0b4a7c94 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,219 @@ +2021-04-08 Jonathan Wakely + + Backported from master: + 2020-07-30 Jonathan Wakely + + * testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc: + Use allocator with the correct value type. + * testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc: + Likewise. + +2021-04-08 François Dumont + + Backported from master: + 2020-07-29 François Dumont + + PR libstdc++/96029 + * include/bits/hashtable.h + (_Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, true_type)): + Add noexcept qualification. + (_Hashtable(_Hashtable&&)): Fix noexcept qualification. + (_Hashtable(_Hashtable&&, const allocator_type&)): Add noexcept + qualification. + * include/bits/unordered_map.h + (unordered_map(unordered_map&&, const allocator_type&)): Add noexcept + qualification. + (unordered_multimap(unordered_multimap&&, const allocator_type&)): + Likewise. + * include/bits/unordered_set.h + (unordered_set(unordered_set&&, const allocator_type&)): Likewise. + (unordered_multiset(unordered_multiset&&, const allocator_type&)): + Likewise. + * include/debug/unordered_map + (unordered_map(unordered_map&&, const allocator_type&)): Likewise. + (unordered_multimap(unordered_multimap&&, const allocator_type&)): + Likewise. + * include/debug/unordered_set + (unordered_set(unordered_set&&, const allocator_type&)): Likewise. + (unordered_multiset(unordered_multiset&&, const allocator_type&)): + Likewise. + * testsuite/23_containers/unordered_map/allocator/default_init.cc: + New test. + * testsuite/23_containers/unordered_map/cons/noexcept_default_construct.cc: + New test. + * testsuite/23_containers/unordered_map/cons/noexcept_move_construct.cc: + New test. + * testsuite/23_containers/unordered_map/modifiers/move_assign.cc: + New test. + * testsuite/23_containers/unordered_multimap/cons/noexcept_default_construct.cc: + New test. + * testsuite/23_containers/unordered_multimap/cons/noexcept_move_construct.cc: + New test. + * testsuite/23_containers/unordered_multiset/cons/noexcept_default_construct.cc: + New test. + * testsuite/23_containers/unordered_multiset/cons/noexcept_move_construct.cc: + New test. + * testsuite/23_containers/unordered_set/allocator/default_init.cc: + New test. + * testsuite/23_containers/unordered_set/cons/noexcept_default_construct.cc: + New test. + * testsuite/23_containers/unordered_set/cons/noexcept_move_construct.cc: + New test. + +2021-04-08 François Dumont + + Backported from master: + 2020-07-08 François Dumont + + PR libstdc++/96029 + * include/bits/stl_tree.h (_Rb_tree_impl(_Rb_tree_impl&&)): Add noexcept + qualification based only on _Compare one. + * testsuite/23_containers/map/cons/noexcept_move_construct.cc: Add + static asserts. + * testsuite/23_containers/multimap/cons/noexcept_move_construct.cc: + Likewise. + * testsuite/23_containers/multiset/cons/noexcept_move_construct.cc: + Likewise. + * testsuite/23_containers/set/cons/noexcept_move_construct.cc: Likewise. + +2021-04-08 Jonathan Wakely + + Backported from master: + 2021-04-07 Jonathan Wakely + + PR libstdc++/99805 + * src/c++17/fs_path.cc (path::_M_split_cmpts): Do not call + non-const member on _M_pathname, to avoid copy-on-write. + * testsuite/27_io/filesystem/path/decompose/parent_path.cc: + Check construction from strings that might be shared. + +2021-04-08 Jonathan Wakely + + * doc/xml/manual/status_cxx2017.xml: Replace Intel parallelstl + link with LLVM repo for PSTL. + * doc/html/manual/status.html: Regenerate. + +2021-04-08 Jonathan Wakely + + Backported from master: + 2021-04-06 Jonathan Wakely + + * include/bits/alloc_traits.h: Use markdown for code font. + * include/bits/basic_string.h: Fix @param names. + * include/bits/regex.h: Fix duplicate @retval names, and rename. + * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: Add + group open to match existing group close. + * include/ext/pb_ds/priority_queue.hpp: Add blank line before group + open. + +2021-04-08 Jonathan Wakely + + Backported from master: + 2021-04-06 Jonathan Wakely + + * include/bits/atomic_base.h: Fix doxygen group close. + * include/bits/basic_ios.h: Likewise. + * include/bits/forward_list.h: Likewise. + * include/bits/fs_dir.h: Likewise. + * include/bits/fs_ops.h: Likewise. + * include/bits/fs_path.h: Likewise. + * include/bits/functional_hash.h: Likewise. + * include/bits/gslice.h: Likewise. + * include/bits/gslice_array.h: Likewise. + * include/bits/hashtable_policy.h: Likewise. + * include/bits/indirect_array.h: Likewise. + * include/bits/locale_classes.h: Likewise. + * include/bits/locale_facets.h: Likewise. + * include/bits/locale_facets_nonio.h: Likewise. + * include/bits/mask_array.h: Likewise. + * include/bits/refwrap.h: Likewise. + * include/bits/regex.h: Likewise. + * include/bits/regex_automaton.h: Likewise. + * include/bits/regex_compiler.h: Likewise. + * include/bits/regex_constants.h: Likewise. + * include/bits/regex_error.h: Likewise. + * include/bits/regex_executor.h: Likewise. + * include/bits/regex_scanner.h: Likewise. + * include/bits/shared_ptr.h: Likewise. + * include/bits/shared_ptr_atomic.h: Likewise. + * include/bits/shared_ptr_base.h: Likewise. + * include/bits/slice_array.h: Likewise. + * include/bits/specfun.h: Likewise. + * include/bits/std_function.h: Likewise. + * include/bits/std_mutex.h: Likewise. + * include/bits/stl_deque.h: Likewise. + * include/bits/stl_iterator.h: Likewise. + * include/bits/stl_iterator_base_types.h: Likewise. + * include/bits/stl_map.h: Likewise. + * include/bits/stl_multimap.h: Likewise. + * include/bits/stl_multiset.h: Likewise. + * include/bits/stl_numeric.h: Likewise. + * include/bits/stl_pair.h: Likewise. + * include/bits/stl_set.h: Likewise. + * include/bits/stl_uninitialized.h: Likewise. + * include/bits/stream_iterator.h: Likewise. + * include/bits/streambuf_iterator.h: Likewise. + * include/bits/unique_ptr.h: Likewise. + * include/bits/unordered_map.h: Likewise. + * include/bits/unordered_set.h: Likewise. + * include/decimal/decimal: Likewise. + * include/experimental/any: Likewise. + * include/experimental/array: Likewise. + * include/experimental/bits/fs_dir.h: Likewise. + * include/experimental/bits/fs_fwd.h: Likewise. + * include/experimental/bits/fs_ops.h: Likewise. + * include/experimental/bits/fs_path.h: Likewise. + * include/experimental/buffer: Likewise. + * include/experimental/internet: Likewise. + * include/experimental/optional: Likewise. + * include/experimental/propagate_const: Likewise. + * include/experimental/socket: Likewise. + * include/ext/pb_ds/assoc_container.hpp: Likewise. + * include/ext/pb_ds/detail/priority_queue_base_dispatch.hpp: + Likewise. + * include/ext/pb_ds/detail/tree_policy/node_metadata_selector.hpp: Likewise. + * include/ext/pb_ds/detail/trie_policy/node_metadata_selector.hpp: Likewise. + * include/ext/pb_ds/detail/types_traits.hpp: Likewise. + * include/ext/pb_ds/exception.hpp: Likewise. + * include/ext/pb_ds/priority_queue.hpp: Likewise. + * include/ext/pb_ds/tag_and_trait.hpp: Likewise. + * include/ext/random: Likewise. + * include/std/any: Likewise. + * include/std/atomic: Likewise. + * include/std/bitset: Likewise. + * include/std/chrono: Likewise. + * include/std/complex: Likewise. + * include/std/condition_variable: Likewise. + * include/std/fstream: Likewise. + * include/std/future: Likewise. + * include/std/istream: Likewise. + * include/std/iostream: Likewise. + * include/std/mutex: Likewise. + * include/std/numeric: Likewise. + * include/std/ostream: Likewise. + * include/std/ratio: Likewise. + * include/std/shared_mutex: Likewise. + * include/std/stdexcept: Likewise. + * include/std/streambuf: Likewise. + * include/std/system_error: Likewise. + * include/std/valarray: Likewise. + * include/std/variant: Likewise. + * include/tr1/cmath: Likewise. + * include/tr1/regex: Likewise. + * include/tr2/dynamic_bitset: Likewise. + * libsupc++/atomic_lockfree_defines.h: Likewise. + * libsupc++/exception: Likewise. + * libsupc++/exception.h: Likewise. + * libsupc++/exception_ptr.h: Likewise. + * libsupc++/nested_exception.h: Likewise. + +2021-04-08 Jonathan Wakely + + Backported from master: + 2021-04-08 Jonathan Wakely + + * include/std/string_view: Adjust Doxygen @file comment. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/maintainer-scripts/ChangeLog b/maintainer-scripts/ChangeLog index 2be23318cd4..982fdf70563 100644 --- a/maintainer-scripts/ChangeLog +++ b/maintainer-scripts/ChangeLog @@ -1,3 +1,11 @@ +2021-04-08 Jonathan Wakely + + Backported from master: + 2021-04-08 Jonathan Wakely + + * generate_libstdcxx_web_docs: Add --disable-multilib to + configure command. + 2021-04-08 Release Manager * GCC 10.3.0 released. commit 551c0d959579107bc8d9b748d053ce744665d6f5 Author: Jonathan Wakely Date: Thu Apr 8 18:22:51 2021 +0100 libstdc++: Fix more doxygen markup for group close commands Similar to r11-8009 but for /* @} */ comments this time, which should be /** @} */ for Doxygen to recognize them. libstdc++-v3/ChangeLog: * include/bits/random.h: Fix doxygen group commands. * include/bits/regex_constants.h: Likewise. * include/tr1/random.h: Likewise. (cherry picked from commit 014b6dbcaa80fc46c792c270244e7eeef7dce75f) diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h index cba11299360..2bcac1b41b1 100644 --- a/libstdc++-v3/include/bits/random.h +++ b/libstdc++-v3/include/bits/random.h @@ -1673,7 +1673,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION }; }; - /* @} */ // group random_generators + /// @} group random_generators /** * @addtogroup random_distributions Random Number Distributions @@ -1949,7 +1949,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION operator>>(std::basic_istream<_CharT, _Traits>&, std::uniform_real_distribution<_RealType>&); - /* @} */ // group random_distributions_uniform + /// @} group random_distributions_uniform /** * @addtogroup random_distributions_normal Normal Distributions @@ -3504,7 +3504,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !(__d1 == __d2); } - /* @} */ // group random_distributions_normal + /// @} group random_distributions_normal /** * @addtogroup random_distributions_bernoulli Bernoulli Distributions @@ -4400,7 +4400,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !(__d1 == __d2); } - /* @} */ // group random_distributions_bernoulli + /// @} group random_distributions_bernoulli /** * @addtogroup random_distributions_poisson Poisson Distributions @@ -6046,9 +6046,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !(__d1 == __d2); } - /* @} */ // group random_distributions_poisson + /// @} group random_distributions_poisson - /* @} */ // group random_distributions + /// @} *group random_distributions /** * @addtogroup random_utilities Random Number Utilities @@ -6099,9 +6099,9 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION std::vector _M_v; }; - /* @} */ // group random_utilities + /// @} group random_utilities - /* @} */ // group random + /// @} group random _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/bits/regex_constants.h b/libstdc++-v3/include/bits/regex_constants.h index 8322dac0eca..2926bec42ba 100644 --- a/libstdc++-v3/include/bits/regex_constants.h +++ b/libstdc++-v3/include/bits/regex_constants.h @@ -409,7 +409,7 @@ namespace regex_constants ///@} } // namespace regex_constants -/* @} */ // group regex +/// @} group regex _GLIBCXX_END_NAMESPACE_VERSION } // namespace std diff --git a/libstdc++-v3/include/tr1/random.h b/libstdc++-v3/include/tr1/random.h index 3f777cb0321..20ea2edbbe9 100644 --- a/libstdc++-v3/include/tr1/random.h +++ b/libstdc++-v3/include/tr1/random.h @@ -1543,7 +1543,7 @@ namespace tr1 #endif }; - /* @} */ // group tr1_random_generators + /// @} group tr1_random_generators /** * @addtogroup tr1_random_distributions Random Number Distributions @@ -2046,7 +2046,7 @@ namespace tr1 bool _M_easy; }; - /* @} */ // group tr1_random_distributions_discrete + /// @} group tr1_random_distributions_discrete /** * @addtogroup tr1_random_distributions_continuous Continuous Distributions @@ -2403,9 +2403,9 @@ namespace tr1 result_type _M_l_d; }; - /* @} */ // group tr1_random_distributions_continuous - /* @} */ // group tr1_random_distributions - /* @} */ // group tr1_random + /// @} group tr1_random_distributions_continuous + /// @} group tr1_random_distributions + /// @} group tr1_random } _GLIBCXX_END_NAMESPACE_VERSION commit d7fa35db13d2523155034c444858bb1ae4eedc0e Author: Jonathan Wakely Date: Thu Apr 8 23:39:29 2021 +0100 libstdc++: Remove spurious line break in doxygen comment libstdc++-v3/ChangeLog: * include/bits/basic_string.h: Tweak doxygen comment. (cherry picked from commit 96292c3e3439aa167ed7ae595f89b8776e705897) diff --git a/libstdc++-v3/include/bits/basic_string.h b/libstdc++-v3/include/bits/basic_string.h index ab9fb04c451..f36bd6a4fe6 100644 --- a/libstdc++-v3/include/bits/basic_string.h +++ b/libstdc++-v3/include/bits/basic_string.h @@ -4674,8 +4674,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 * @brief Insert a string_view. * @param __pos1 Position in string to insert at. * @param __svt The object convertible to string_view to insert from. - * @param __pos2 Position in string_view to insert - * from. + * @param __pos2 Position in string_view to insert from. * @param __n The number of characters to insert. * @return Reference to this string. */ commit 66ba422a436db7db4d9dfd926313753fc2c76bf5 Author: Jonathan Wakely Date: Fri Apr 9 00:24:41 2021 +0100 libstdc++: Fix even more doxygen markup for group close commands More fixes like r11-8009 and r11-8066. libstdc++-v3/ChangeLog: * include/bits/fs_fwd.h: Fix doxygen group command. * include/bits/streambuf_iterator.h: Likewise. * include/std/chrono: Likewise. * include/std/memory: Likewise. * include/std/thread: Likewise. * include/tr1/complex: Likewise. (cherry picked from commit 72ddd861d3881eba141c41c1ccbb4e8b3be159a5) diff --git a/libstdc++-v3/include/bits/fs_fwd.h b/libstdc++-v3/include/bits/fs_fwd.h index d94cc414906..0f8fa92a39a 100644 --- a/libstdc++-v3/include/bits/fs_fwd.h +++ b/libstdc++-v3/include/bits/fs_fwd.h @@ -339,7 +339,7 @@ _GLIBCXX_END_NAMESPACE_CXX11 bool is_symlink(file_status) noexcept; } // namespace filesystem -// @} +/// @} _GLIBCXX_END_NAMESPACE_VERSION } // namespace std #endif // C++17 diff --git a/libstdc++-v3/include/bits/streambuf_iterator.h b/libstdc++-v3/include/bits/streambuf_iterator.h index 0681140505f..d77ecc5f9cb 100644 --- a/libstdc++-v3/include/bits/streambuf_iterator.h +++ b/libstdc++-v3/include/bits/streambuf_iterator.h @@ -499,7 +499,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION __i._M_c = __eof; } -// @} group iterators +/// @} group iterators _GLIBCXX_END_NAMESPACE_VERSION } // namespace diff --git a/libstdc++-v3/include/std/chrono b/libstdc++-v3/include/std/chrono index 0bff594f9b2..62a200c73b0 100644 --- a/libstdc++-v3/include/std/chrono +++ b/libstdc++-v3/include/std/chrono @@ -1127,7 +1127,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION using local_days = local_time; #endif // C++20 - // @} + /// @} } // namespace chrono #if __cplusplus > 201103L diff --git a/libstdc++-v3/include/std/memory b/libstdc++-v3/include/std/memory index 3b3fec0d95c..eea472e8600 100644 --- a/libstdc++-v3/include/std/memory +++ b/libstdc++-v3/include/std/memory @@ -177,7 +177,7 @@ undeclare_no_pointers(char*, size_t) { } /// The type of pointer safety supported by the implementation. inline pointer_safety get_pointer_safety() noexcept { return pointer_safety::relaxed; } -// @} +/// @} #if __cplusplus > 201703L #define __cpp_lib_assume_aligned 201811L diff --git a/libstdc++-v3/include/std/thread b/libstdc++-v3/include/std/thread index b1ed458ba21..f25e74a685e 100644 --- a/libstdc++-v3/include/std/thread +++ b/libstdc++-v3/include/std/thread @@ -428,7 +428,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION } } - // @} group threads + /// @} group threads #ifdef __cpp_lib_jthread diff --git a/libstdc++-v3/include/tr1/complex b/libstdc++-v3/include/tr1/complex index 3c9e6e27b30..9a4ee8cf128 100644 --- a/libstdc++-v3/include/tr1/complex +++ b/libstdc++-v3/include/tr1/complex @@ -411,7 +411,7 @@ namespace tr1 pow(const std::complex<_Tp>& __x, const std::complex<_Tp>& __y) { return std::pow(__x, __y); } -// @} group complex_numbers +/// @} group complex_numbers } _GLIBCXX_END_NAMESPACE_VERSION commit 637418ec2c6f559d4fac074db3bafc34a728484b Author: Jonathan Wakely Date: Fri Apr 9 12:05:39 2021 +0100 libstdc++: Fix invalid constexpr function in C++11 mode [PR 99985] I keep forgetting that a constexpr function in C++11 has to be a single return statement. libstdc++-v3/ChangeLog: PR libstdc++/99985 * include/bits/hashtable.h (_Hashtable::_S_nothrow_move()): Fix to be a valid constexpr function in C++11. * testsuite/23_containers/unordered_set/cons/99985.cc: New test. (cherry picked from commit 40ccb47b505b528244ee305923681c0ae3b6f4d5) diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index 8705d1f33b8..e9a6cfe8b83 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -450,10 +450,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION static constexpr bool _S_nothrow_move() { - if _GLIBCXX17_CONSTEXPR (_No_realloc) - if _GLIBCXX17_CONSTEXPR (is_nothrow_copy_constructible<_H1>()) +#if __cplusplus <= 201402L + return __and_<__bool_constant<_No_realloc>, + is_nothrow_copy_constructible<_H1>, + is_nothrow_copy_constructible<_Equal>>::value; +#else + if constexpr (_No_realloc) + if constexpr (is_nothrow_copy_constructible<_H1>()) return is_nothrow_copy_constructible<_Equal>(); return false; +#endif } _Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, diff --git a/libstdc++-v3/testsuite/23_containers/unordered_set/cons/99985.cc b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/99985.cc new file mode 100644 index 00000000000..b209f7627f5 --- /dev/null +++ b/libstdc++-v3/testsuite/23_containers/unordered_set/cons/99985.cc @@ -0,0 +1,47 @@ +// Copyright (C) 2021 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 +// . + +// { dg-options "-std=gnu++11" } +// { dg-do compile { target c++11 } } + +#include +#include + +template + using Set = std::unordered_set, std::equal_to, Alloc>; + +// PR libstdc++/99985 - invalid constexpr function in C++11 mode + +void +test01() +{ + using A = std::allocator; + A a; + Set s; + static_assert( noexcept( Set(std::move(s)) ), "non-throwing" ); + static_assert( noexcept( Set(std::move(s), a) ), "non-throwing" ); +} + +void +test02() +{ + using A = __gnu_test::uneq_allocator; + A a; + Set s; + static_assert( noexcept( Set(std::move(s)) ), "non-throwing" ); + static_assert( ! noexcept( Set(std::move(s), a) ), "throwing" ); +} commit 2ed860be33b61ea553bf44976ef877c8356d601b Author: Jonathan Wakely Date: Fri Apr 9 15:47:26 2021 +0100 libstdc++: Fix bootstrap error due to inconsistent noexcept-specifier [PR 99983] The backport of r11-8062 as r10-9673 missed out a piece, which causes bootstrap failures. PR bootstrap/99983 * include/bits/hashtable.h (_Hashtable): Fix noexcept-speciofier on definition to match the one on the declaration. diff --git a/libstdc++-v3/include/bits/hashtable.h b/libstdc++-v3/include/bits/hashtable.h index e9a6cfe8b83..310eb52dd51 100644 --- a/libstdc++-v3/include/bits/hashtable.h +++ b/libstdc++-v3/include/bits/hashtable.h @@ -1319,8 +1319,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION _H1, _H2, _Hash, _RehashPolicy, _Traits>:: _Hashtable(_Hashtable&& __ht, __node_alloc_type&& __a, true_type /* alloc always equal */) - noexcept(std::is_nothrow_copy_constructible<_H1>::value && - std::is_nothrow_copy_constructible<_Equal>::value) + noexcept(_S_nothrow_move()) : __hashtable_base(__ht), __map_base(__ht), __rehash_base(__ht), commit 60b589b5858fb8ad414583c6b493e0897f1bde5f Author: Thomas Schwinge Date: Fri Apr 9 16:03:32 2021 +0200 Add 'libgomp.oacc-c-c++-common/static-variable-1.c' [PR84991, PR84992, PR90779] libgomp/ PR middle-end/84991 PR middle-end/84992 PR middle-end/90779 * testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: New. (cherry picked from commit ffa0ae6eeef3ad15d3f288283e4c477193052f1a) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c new file mode 100644 index 00000000000..1d415cdcf76 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/static-variable-1.c @@ -0,0 +1,460 @@ +/* "Function scope" (top-level block scope) 'static' variables + + ... inside OpenACC compute construct regions as well as OpenACC 'routine'. + + This is to document/verify aspects of GCC's observed behavior, not + necessarily as it's (intended to be?) restricted by the OpenACC + specification. See also PR84991, PR84992, PR90779 etc., and + "C/C++ 'static' + variables" (only visible to members of the GitHub OpenACC organization). +*/ + + +#undef NDEBUG +#include +#include +#include +#include + + +#define IF_DEBUG if (0) + + +/* Without explicit 'num_gangs'. */ + +static void t0_c(void) +{ + IF_DEBUG + __builtin_printf ("%s\n", __FUNCTION__); + + const int i_limit = 11; + const int var_init = 16; + + for (int i = 0; i < i_limit; ++i) + { + int result = 0; + int num_gangs_actual = -1; +#pragma acc parallel \ + reduction(max:num_gangs_actual) \ + reduction(max:result) + { + num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG); + + static int var = var_init; + +#pragma acc atomic capture + result = ++var; + + /* Irrespective of the order in which the gang-redundant threads + execute, 'var' has now been incremented 'num_gangs_actual' times, and + the final value captured as 'result'. */ + } + /* Without an explicit 'num_gangs' clause GCC assigns 'num_gangs(1)' + because it doesn't see any use of gang-level parallelism inside the + region. */ + assert(num_gangs_actual == 1); + assert(result == var_init + num_gangs_actual * (1 + i)); + } +} + + +/* Call a gang-level routine. */ + +static const int t0_r_var_init = 61; + +#pragma acc routine gang +__attribute__((noinline)) +static int t0_r_r(void) +{ + static int var = t0_r_var_init; + + int tmp; +#pragma acc atomic capture + tmp = ++var; + + return tmp; +} + +static void t0_r(void) +{ + IF_DEBUG + __builtin_printf ("%s\n", __FUNCTION__); + + const int i_limit = 11; + + for (int i = 0; i < i_limit; ++i) + { + int result = 0; + int num_gangs_actual = -1; +#pragma acc parallel \ + reduction(max:num_gangs_actual) \ + reduction(max:result) + { + num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG); + + result = t0_r_r(); + + /* Irrespective of the order in which the gang-redundant threads + execute, 'var' has now been incremented 'num_gangs_actual' times, and + the final value captured as 'result'. */ + } + /* The number of gangs selected by the implemention ought to but must not + be bigger than one. */ + IF_DEBUG + __builtin_printf ("%d: num_gangs_actual: %d\n", i, num_gangs_actual); + assert(num_gangs_actual >= 1); + assert(result == t0_r_var_init + num_gangs_actual * (1 + i)); + } +} + + +/* Explicit 'num_gangs'. */ + +static void t1_c(void) +{ + IF_DEBUG + __builtin_printf ("%s\n", __FUNCTION__); + + const int i_limit = 22; + const int num_gangs_request = 444; + const int var_init = 5; + + for (int i = 0; i < i_limit; ++i) + { + int result = 0; + int num_gangs_actual = -1; +#pragma acc parallel \ + num_gangs(num_gangs_request) \ + reduction(max:num_gangs_actual) \ + reduction(max:result) + { + num_gangs_actual = 1 + __builtin_goacc_parlevel_id(GOMP_DIM_GANG); + + static int var = var_init; + +#pragma acc atomic capture + result = ++var; + + /* Irrespective of the order in which the gang-redundant threads + execute, 'var' has now been incremented 'num_gangs_actual' times, and + the final value captured as 'result'. */ + } + if (acc_get_device_type() == acc_device_host) + assert(num_gangs_actual == 1); + else + assert(num_gangs_actual == num_gangs_request); + assert(result == var_init + num_gangs_actual * (1 + i)); + } +} + + +/* Check the same routine called from two compute constructs. */ + +static const int t1_r2_var_init = 166; + +#pragma acc routine gang +__attribute__((noinline)) +static int t1_r2_r(void) +{ + static int var = t1_r2_var_init; + + int tmp; +#pragma acc atomic capture + tmp = ++var; + + return tmp; +} + +static void t1_r2(void) +{ + IF_DEBUG + __builtin_printf ("%s\n", __FUNCTION__); + + const int i_limit = 71; + /* The checking assumes the same 'num_gangs' for all compute constructs. */ + const int num_gangs_request = 333; + int num_gangs_actual = -1; + if (acc_get_device_type() == acc_device_host) + num_gangs_actual = 1; + else + { + /* We're assuming that the implementation is able to accomodate the + 'num_gangs' requested (which really ought to be true for + 'num_gangs'). */ + num_gangs_actual = num_gangs_request; + } + + for (int i = 0; i < i_limit; ++i) + { + int result_1 = 0; +#pragma acc parallel \ + num_gangs(num_gangs_request) \ + reduction(max:result_1) + { + result_1 = t1_r2_r(); + + /* Irrespective of the order in which the gang-redundant threads + execute, 'var' has now been incremented 'num_gangs_actual' times, and + the final value captured as 'result_1'. */ + } + IF_DEBUG + __builtin_printf ("%d: result_1: %d\n", i, result_1); + assert(result_1 == t1_r2_var_init + num_gangs_actual * (1 + (i * 3 + 0))); + + int result_2 = 0; +#pragma acc parallel \ + num_gangs(num_gangs_request) \ + reduction(max:result_2) + { + result_2 = t1_r2_r() + t1_r2_r(); + + /* Irrespective of the order in which the gang-redundant threads + execute, 'var' has now been incremented '2 * num_gangs_actual' times. + However, the order of the two 't1_r2_r' function calls is not + synchronized (between different gang-redundant threads). We thus + cannot verify the actual 'result_2' values in this case. */ + } + IF_DEBUG + __builtin_printf ("%d: result_2: %d\n", i, result_2); + if (num_gangs_actual == 1) + /* Per the rationale above, only in this case we can check the actual + result. */ + assert(result_2 == (t1_r2_var_init + num_gangs_actual * (1 + (i * 3 + 1)) + + t1_r2_var_init + num_gangs_actual * (1 + (i * 3 + 2)))); + /* But we can generally check low and high limits. */ + { + /* Must be bigger than '2 * result_1'. */ + int c = 2 * result_1; + IF_DEBUG + __builtin_printf (" > %d\n", c); + assert(result_2 > c); + } + { + /* ..., but limited by the base value for next 'i'. */ + int c = 2 * (t1_r2_var_init + num_gangs_actual * (0 + ((i + 1) * 3 + 0))); + IF_DEBUG + __builtin_printf (" < %d\n", c); + assert(result_2 < c); + } + } +} + + +/* Asynchronous execution. */ + +static const int t2_var_init_2 = -55; + +#pragma acc routine gang +__attribute__((noinline)) +static int t2_r(void) +{ + static int var = t2_var_init_2; + + int tmp; +#pragma acc atomic capture + tmp = ++var; + + return tmp; +} + +static void t2(void) +{ + IF_DEBUG + __builtin_printf ("%s\n", __FUNCTION__); + + const int i_limit = 12; + const int num_gangs_request_1 = 14; + const int var_init_1 = 5; + int results_1[i_limit][num_gangs_request_1]; + memset (results_1, 0, sizeof results_1); + const int num_gangs_request_2 = 5; + int results_2[i_limit][num_gangs_request_2]; + memset (results_2, 0, sizeof results_2); + const int num_gangs_request_3 = 34; + const int var_init_3 = 1250; + int results_3[i_limit][num_gangs_request_3]; + memset (results_3, 0, sizeof results_3); + +#pragma acc data \ + copy(results_1, results_2, results_3) + { + for (int i = 0; i < i_limit; ++i) + { + /* The following 'async' clauses effect asynchronous execution, but + using the same async-argument for each compute construct implies that + the respective compute constructs' execution is synchronized with + itself, meaning that all 'i = 0' execution has finished (on the + device) before 'i = 1' is started (on the device), etc. */ + +#pragma acc parallel \ + present(results_1) \ + num_gangs(num_gangs_request_1) \ + async(1) + { + static int var = var_init_1; + + int tmp; +#pragma acc atomic capture + tmp = ++var; + + results_1[i][__builtin_goacc_parlevel_id(GOMP_DIM_GANG)] += tmp; + } + +#pragma acc parallel \ + present(results_2) \ + num_gangs(num_gangs_request_2) \ + async(2) + { + results_2[i][__builtin_goacc_parlevel_id(GOMP_DIM_GANG)] += t2_r(); + } + +#pragma acc parallel \ + present(results_3) \ + num_gangs(num_gangs_request_3) \ + async(3) + { + static int var = var_init_3; + + int tmp; +#pragma acc atomic capture + tmp = ++var; + + results_3[i][__builtin_goacc_parlevel_id(GOMP_DIM_GANG)] += tmp; + } + } +#pragma acc wait + } + int num_gangs_actual_1; + int num_gangs_actual_2; + int num_gangs_actual_3; + if (acc_get_device_type() == acc_device_host) + { + num_gangs_actual_1 = 1; + num_gangs_actual_2 = 1; + num_gangs_actual_3 = 1; + } + else + { + /* We're assuming that the implementation is able to accomodate the + 'num_gangs' requested (which really ought to be true for + 'num_gangs'). */ + num_gangs_actual_1 = num_gangs_request_1; + num_gangs_actual_2 = num_gangs_request_2; + num_gangs_actual_3 = num_gangs_request_3; + } + + /* For 'i = 0', 'results_*[i][0..num_gangs_actual_*]' are expected to each + contain one value of '(1 + var_init_*)..(var_init_* + num_gangs_actual_*)', + and so on for increasing 'i'. Their order however is unspecified due to + the gang-redundant execution. (Thus checking that their sums match.) */ + + int result_1 = 0; + int result_2 = 0; + int result_3 = 0; + for (int i = 0; i < i_limit; ++i) + { + int result_1_ = 0; + for (int g = 0; g < num_gangs_actual_1; ++g) + { + IF_DEBUG + __builtin_printf ("results_1[%d][%d]: %d\n", i, g, results_1[i][g]); + result_1_ += results_1[i][g]; + } + IF_DEBUG + __builtin_printf ("%d result_1_: %d\n", i, result_1_); + assert (result_1_ == (((var_init_1 + num_gangs_actual_1 * (1 + i)) * (1 + var_init_1 + num_gangs_actual_1 * (1 + i)) / 2) + - ((var_init_1 + num_gangs_actual_1 * (0 + i)) * (1 + var_init_1 + num_gangs_actual_1 * (0 + i)) / 2))); + result_1 += result_1_; + + int result_2_ = 0; + for (int g = 0; g < num_gangs_actual_2; ++g) + { + IF_DEBUG + __builtin_printf ("results_2[%d][%d]: %d\n", i, g, results_2[i][g]); + result_2_ += results_2[i][g]; + } + IF_DEBUG + __builtin_printf ("%d result_2_: %d\n", i, result_2_); + assert (result_2_ == (((t2_var_init_2 + num_gangs_actual_2 * (1 + i)) * (1 + t2_var_init_2 + num_gangs_actual_2 * (1 + i)) / 2) + - ((t2_var_init_2 + num_gangs_actual_2 * (0 + i)) * (1 + t2_var_init_2 + num_gangs_actual_2 * (0 + i)) / 2))); + result_2 += result_2_; + + int result_3_ = 0; + for (int g = 0; g < num_gangs_actual_3; ++g) + { + IF_DEBUG + __builtin_printf ("results_3[%d][%d]: %d\n", i, g, results_3[i][g]); + result_3_ += results_3[i][g]; + } + IF_DEBUG + __builtin_printf ("%d result_3_: %d\n", i, result_3_); + assert (result_3_ == (((var_init_3 + num_gangs_actual_3 * (1 + i)) * (1 + var_init_3 + num_gangs_actual_3 * (1 + i)) / 2) + - ((var_init_3 + num_gangs_actual_3 * (0 + i)) * (1 + var_init_3 + num_gangs_actual_3 * (0 + i)) / 2))); + result_3 += result_3_; + } + IF_DEBUG + __builtin_printf ("result_1: %d\n", result_1); + assert (result_1 == (((var_init_1 + num_gangs_actual_1 * i_limit) * (1 + var_init_1 + num_gangs_actual_1 * i_limit) / 2) + - (var_init_1 * (var_init_1 + 1) / 2))); + IF_DEBUG + __builtin_printf ("result_2: %d\n", result_2); + assert (result_2 == (((t2_var_init_2 + num_gangs_actual_2 * i_limit) * (1 + t2_var_init_2 + num_gangs_actual_2 * i_limit) / 2) + - (t2_var_init_2 * (t2_var_init_2 + 1) / 2))); + IF_DEBUG + __builtin_printf ("result_3: %d\n", result_3); + assert (result_3 == (((var_init_3 + num_gangs_actual_3 * i_limit) * (1 + var_init_3 + num_gangs_actual_3 * i_limit) / 2) + - (var_init_3 * (var_init_3 + 1) / 2))); +} + + +#pragma acc routine seq +__attribute__((noinline)) +static int pr84991_1_r_s(int n) +{ + static const int test[] = {1,2,3,4}; + return test[n]; +} + +static void pr84991_1(void) +{ + int n[1]; + n[0] = 3; +#pragma acc parallel copy(n) + { + n[0] = pr84991_1_r_s(n[0]); + } + assert(n[0] == 4); +} + + +static void pr84992_1(void) +{ + int n[1]; + n[0] = 3; +#pragma acc parallel copy(n) + { + static const int test[] = {1,2,3,4}; + n[0] = test[n[0]]; + } + assert(n[0] == 4); +} + + +int main(void) +{ + t0_c(); + + t0_r(); + + t1_c(); + + t1_r2(); + + t2(); + + pr84991_1(); + + pr84992_1(); + + return 0; +} commit 3bb551c6751304fb2d51cc8569f066dd8a9090e2 Author: Marek Polacek Date: Fri Jan 8 15:48:41 2021 -0500 c++: ICE when late parsing noexcept/NSDMI [PR98333] Since certain members of a class are a complete-class context [class.mem.general]p7, we delay their parsing untile the whole class has been parsed. For instance, NSDMIs and noexcept-specifiers. The order in which we perform this delayed parsing matters; we were first parsing NSDMIs and only they did we parse noexcept-specifiers. That turns out to be wrong: since NSDMIs may use noexcept-specifiers, we must process noexcept-specifiers first. Otherwise we'll ICE in code that doesn't expect to see DEFERRED_PARSE. This doesn't just shift the problem, noexcept-specifiers can use members with a NSDMI just fine, and I've also tested a similar test with this member function: bool f() { return __has_nothrow_constructor (S); } and that compiled fine too. gcc/cp/ChangeLog: PR c++/98333 * parser.c (cp_parser_class_specifier_1): Perform late-parsing of NSDMIs before late-parsing of noexcept-specifiers. gcc/testsuite/ChangeLog: PR c++/98333 * g++.dg/cpp0x/noexcept62.C: New test. (cherry picked from commit c37f1d4081f5a19e39192d13e2a3acea13662e5a) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 1f4a28ff7c0..42201564b5d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -24091,31 +24091,10 @@ cp_parser_class_specifier_1 (cp_parser* parser) maybe_end_member_template_processing (); } vec_safe_truncate (unparsed_funs_with_default_args, 0); - /* Now parse any NSDMIs. */ - save_ccp = current_class_ptr; - save_ccr = current_class_ref; - FOR_EACH_VEC_SAFE_ELT (unparsed_nsdmis, ix, decl) - { - if (class_type != DECL_CONTEXT (decl)) - { - if (pushed_scope) - pop_scope (pushed_scope); - class_type = DECL_CONTEXT (decl); - pushed_scope = push_scope (class_type); - } - inject_this_parameter (class_type, TYPE_UNQUALIFIED); - cp_parser_late_parsing_nsdmi (parser, decl); - } - vec_safe_truncate (unparsed_nsdmis, 0); - current_class_ptr = save_ccp; - current_class_ref = save_ccr; - if (pushed_scope) - pop_scope (pushed_scope); /* If there are noexcept-specifiers that have not yet been processed, - take care of them now. */ - class_type = NULL_TREE; - pushed_scope = NULL_TREE; + take care of them now. Do this before processing NSDMIs as they + may depend on noexcept-specifiers already having been processed. */ FOR_EACH_VEC_SAFE_ELT (unparsed_noexcepts, ix, decl) { tree ctx = DECL_CONTEXT (decl); @@ -24163,6 +24142,25 @@ cp_parser_class_specifier_1 (cp_parser* parser) maybe_end_member_template_processing (); } vec_safe_truncate (unparsed_noexcepts, 0); + + /* Now parse any NSDMIs. */ + save_ccp = current_class_ptr; + save_ccr = current_class_ref; + FOR_EACH_VEC_SAFE_ELT (unparsed_nsdmis, ix, decl) + { + if (class_type != DECL_CONTEXT (decl)) + { + if (pushed_scope) + pop_scope (pushed_scope); + class_type = DECL_CONTEXT (decl); + pushed_scope = push_scope (class_type); + } + inject_this_parameter (class_type, TYPE_UNQUALIFIED); + cp_parser_late_parsing_nsdmi (parser, decl); + } + vec_safe_truncate (unparsed_nsdmis, 0); + current_class_ptr = save_ccp; + current_class_ref = save_ccr; if (pushed_scope) pop_scope (pushed_scope); diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept62.C b/gcc/testsuite/g++.dg/cpp0x/noexcept62.C new file mode 100644 index 00000000000..53606c79142 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept62.C @@ -0,0 +1,10 @@ +// PR c++/98333 +// { dg-do compile { target c++11 } } + +struct T { + template + struct S { + S () noexcept (N) {} + }; + int a = __has_nothrow_constructor (S); +}; commit 6f45079013256ed730c92bf35af4e6394cb5a2c0 Author: Marek Polacek Date: Fri Apr 9 18:31:12 2021 -0400 c++: ICE with delayed noexcept and attribute used [PR97966] Another ICE with delayed noexcept parsing, but a bit gnarlier. A function definition marked with __attribute__((used)) ought to be emitted even when it is not referenced in the TU. For a member function template marked with __attribute__((used)) this means that it will be instantiated: in instantiate_class_template_1 we have 11971 /* Instantiate members marked with attribute used. */ 11972 if (r != error_mark_node && DECL_PRESERVE_P (r)) 11973 mark_used (r); It is not so surprising that this doesn't work well with delayed noexcept parsing: when we're processing the function template we delay the parsing, so the member "foo" is found, but then when we're instantiating it, "foo" hasn't yet been seen, which creates a discrepancy and a crash ensues. "foo" hasn't yet been seen because instantiate_class_template_1 just loops over the class members and instantiates right away. To make it work, this patch uses a vector to keep track of members marked with attribute used and uses it to instantiate such members only after we're done with the class; in particular, after we have called finish_member_declaration for each member. And we ought to be verifying that we did emit such members, so I've added a bunch of dg-finals. gcc/cp/ChangeLog: PR c++/97966 * pt.c (instantiate_class_template_1): Instantiate members marked with attribute used only after we're done instantiating the class. gcc/testsuite/ChangeLog: PR c++/97966 * g++.dg/cpp0x/noexcept63.C: New test. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index d329c0128ba..548f79dbb3a 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11762,6 +11762,9 @@ instantiate_class_template_1 (tree type) class, except we also need to push the enclosing classes. */ push_nested_class (type); + /* A vector to hold members marked with attribute used. */ + auto_vec used; + /* Now members are processed in the order of declaration. */ for (member = CLASSTYPE_DECL_LIST (pattern); member; member = TREE_CHAIN (member)) @@ -11839,7 +11842,7 @@ instantiate_class_template_1 (tree type) finish_member_declaration (r); /* Instantiate members marked with attribute used. */ if (r != error_mark_node && DECL_PRESERVE_P (r)) - mark_used (r); + used.safe_push (r); if (TREE_CODE (r) == FUNCTION_DECL && DECL_OMP_DECLARE_REDUCTION_P (r)) cp_check_omp_declare_reduction (r); @@ -11917,7 +11920,7 @@ instantiate_class_template_1 (tree type) /*flags=*/0); /* Instantiate members marked with attribute used. */ if (r != error_mark_node && DECL_PRESERVE_P (r)) - mark_used (r); + used.safe_push (r); } else if (TREE_CODE (r) == FIELD_DECL) { @@ -12130,6 +12133,11 @@ instantiate_class_template_1 (tree type) if (TYPE_CONTAINS_VPTR_P (type) && CLASSTYPE_KEY_METHOD (type)) vec_safe_push (keyed_classes, type); + /* Now that we've gone through all the members, instantiate those + marked with attribute used. */ + for (tree x : used) + mark_used (x); + return type; } diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept63.C b/gcc/testsuite/g++.dg/cpp0x/noexcept63.C new file mode 100644 index 00000000000..cf048f56c2a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept63.C @@ -0,0 +1,63 @@ +// PR c++/97966 +// { dg-do compile { target c++11 } } + +template +struct S1 { + __attribute__((used)) S1() noexcept(noexcept(this->foo())) { } + void foo(); +}; + +template +struct S2 { + __attribute__((used)) void bar() noexcept(noexcept(this->foo())) { } + void foo(); +}; + +template +struct S3 { + void __attribute__((used)) bar() noexcept(noexcept(this->foo())) { } + void foo(); +}; + +template +struct S4 { + [[gnu::used]] void bar() noexcept(noexcept(this->foo())) { } + void foo(); +}; + +template +struct S5 { + void bar() noexcept(noexcept(this->foo())) __attribute__((used)) { } + void foo(); +}; + +template +struct S6 { + template + struct N { + [[gnu::used]] void bar() noexcept(noexcept(this->foo())) { } + void foo(); + }; +}; + +void +g () +{ + S1<1> s1; + S2<1> s2; + S3<1> s3; + S4<1> s4; + S5<1> s5; + S6<1>::N<1> n; +} + +// Make sure that we did emit the functions marked with attribute used +// even though they're not referenced in this TU. (Well, the S1() +// constructor is.) +// { dg-final { scan-assembler "_ZN2S1ILi1EEC1Ev" } } +// { dg-final { scan-assembler "_ZN2S1ILi1EEC2Ev" } } +// { dg-final { scan-assembler "_ZN2S2ILi1EE3barEv" } } +// { dg-final { scan-assembler "_ZN2S3ILi1EE3barEv" } } +// { dg-final { scan-assembler "_ZN2S4ILi1EE3barEv" } } +// { dg-final { scan-assembler "_ZN2S5ILi1EE3barEv" } } +// { dg-final { scan-assembler "_ZN2S6ILi1EE1NILi1EE3barEv" } } commit f0f62557c3de0313673d7c0527277e86231ee95b Author: Marek Polacek Date: Wed Feb 3 17:57:22 2021 -0500 c++: Fix bogus -Wvolatile warning in C++20 [PR98947] Since most of volatile is deprecated in C++20, we are required to warn for compound assignments to volatile variables and so on. But here we have volatile int x, y, z; (b ? x : y) = 1; and we shouldn't warn, because simple assignments like x = 24; should not provoke the warning when they are a discarded-value expression. We warn here because when ?: is used as an lvalue, we transform it in cp_build_modify_expr/COND_EXPR from (a ? b : c) = rhs to (a ? (b = rhs) : (c = rhs)) and build_conditional_expr then calls mark_lvalue_use for the new artificial assignments, which then evokes the warning. The calls to mark_lvalue_use were added in r160289 to suppress warnings in Wunused-var-10.c, but looks like they're no longer needed. To warn on (b ? (x = 2) : y) = 1; (b ? x : (y = 5)) = 1; I've tweaked a check in mark_use/MODIFY_EXPR. I'd argue this is a regression because GCC 9 doesn't warn. gcc/cp/ChangeLog: PR c++/98947 * call.c (build_conditional_expr_1): Don't call mark_lvalue_use on arg2/arg3. * expr.c (mark_use) : Don't check read_p when issuing the -Wvolatile warning. Only set TREE_THIS_VOLATILE if a warning was emitted. gcc/testsuite/ChangeLog: PR c++/98947 * g++.dg/cpp2a/volatile5.C: New test. (cherry picked from commit 7a18bc4ae62081021f4fd90d591a588cac931f77) diff --git a/gcc/cp/call.c b/gcc/cp/call.c index aa8d84fa90c..01ad56ee66e 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5474,8 +5474,6 @@ build_conditional_expr_1 (const op_location_t &loc, && same_type_p (arg2_type, arg3_type)) { result_type = arg2_type; - arg2 = mark_lvalue_use (arg2); - arg3 = mark_lvalue_use (arg3); goto valid_operands; } diff --git a/gcc/cp/expr.c b/gcc/cp/expr.c index 9b535708c57..6a7569418b1 100644 --- a/gcc/cp/expr.c +++ b/gcc/cp/expr.c @@ -226,17 +226,17 @@ mark_use (tree expr, bool rvalue_p, bool read_p, a volatile-qualified type is deprecated unless the assignment is either a discarded-value expression or appears in an unevaluated context." */ - if (read_p - && !cp_unevaluated_operand + if (!cp_unevaluated_operand && (TREE_THIS_VOLATILE (lhs) || CP_TYPE_VOLATILE_P (TREE_TYPE (lhs))) && !TREE_THIS_VOLATILE (expr)) { - warning_at (location_of (expr), OPT_Wvolatile, - "using value of simple assignment with %-" - "qualified left operand is deprecated"); - /* Make sure not to warn about this assignment again. */ - TREE_THIS_VOLATILE (expr) = true; + if (warning_at (location_of (expr), OPT_Wvolatile, + "using value of simple assignment with " + "%-qualified left operand is " + "deprecated")) + /* Make sure not to warn about this assignment again. */ + TREE_THIS_VOLATILE (expr) = true; } break; } diff --git a/gcc/testsuite/g++.dg/cpp2a/volatile5.C b/gcc/testsuite/g++.dg/cpp2a/volatile5.C new file mode 100644 index 00000000000..1f9d23845b4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/volatile5.C @@ -0,0 +1,15 @@ +// PR c++/98947 +// { dg-do compile } + +volatile int x, y, z; + +void +f (bool b) +{ + (b ? x : y) = 1; + (b ? x : y) += 1; // { dg-warning "compound assignment" "" { target c++20 } } + z = (b ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + ((z = 2) ? x : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + (b ? (x = 2) : y) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } + (b ? x : (y = 5)) = 1; // { dg-warning "using value of simple assignment" "" { target c++20 } } +} commit 6fcf6e5977541b2383760cb4e15ff0403055b13a Author: Marek Polacek Date: Thu Mar 4 14:25:01 2021 -0500 c++: Pointer-to-member fn conversion with noexcept [PR99374] The issue in this PR is that we wrongly reject converting pointers to member function of incomplete types, one of which has noexcept. Recall that pointers (including pointers to member functions) to non-throwing functions can be implicitly converted to potentially-throwing functions (but not vice versa). We reject the conversion when called from can_convert_arg_bad because standard_conversion can't create such a conversion. It comes down to the DERIVED_FROM_P check in the TYPE_PTRMEMFUNC_P block. It considers every class derived from itself, but not when the class is incomplete. But surely we want to reach fnptr_conv_p when tbase is fbase (one of them could be an alias to the other so use same_type_p instead of ==). Another approach would be to not perform DERIVED_FROM_P at all when either tbase or fbase are incomplete (so perhaps something like at the end of ptr_reasonably_similar). gcc/cp/ChangeLog: PR c++/99374 * call.c (standard_conversion): When converting pointers to member, don't return NULL when the bases are equivalent but incomplete. gcc/testsuite/ChangeLog: PR c++/99374 * g++.dg/cpp1z/noexcept-type23.C: New test. (cherry picked from commit 02a3554879001e8f1405d17e096ed68fc3f76975) diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 01ad56ee66e..b65cc6ae6f7 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -1434,7 +1434,9 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, tree fbase = class_of_this_parm (fromfn); tree tbase = class_of_this_parm (tofn); - if (!DERIVED_FROM_P (fbase, tbase)) + /* If FBASE and TBASE are equivalent but incomplete, DERIVED_FROM_P + yields false. But a pointer to member of incomplete class is OK. */ + if (!same_type_p (fbase, tbase) && !DERIVED_FROM_P (fbase, tbase)) return NULL; tree fstat = static_fn_type (fromfn); diff --git a/gcc/testsuite/g++.dg/cpp1z/noexcept-type23.C b/gcc/testsuite/g++.dg/cpp1z/noexcept-type23.C new file mode 100644 index 00000000000..612dd6ceb5e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/noexcept-type23.C @@ -0,0 +1,14 @@ +// PR c++/99374 +// { dg-do compile { target c++17 } } + +struct S; +struct R; +using F1 = int (S::*)(); +using F2 = int (S::*)() noexcept; +using F3 = int (R::*)() noexcept; +using T = S; +using F4 = int (T::*)() noexcept; +F1 f21 = F2(); +F1 f41 = F4(); +F2 f12 = F1(); // { dg-error "cannot convert" } +F1 f31 = F3(); // { dg-error "cannot convert" } commit c7d7c15540d5173f76b570bd457e866f09a17722 Author: Marek Polacek Date: Fri Mar 5 10:41:41 2021 -0500 c++: ICE with -Wshadow and enumerator in template [PR99120] We crash here, because in a template, an enumerator doesn't have a type until we've called finish_enum_value_list. But our -Wshadow implementation, check_local_shadow, is called when we pushdecl in build_enumerator, which takes place before finish_enum_value_list. gcc/cp/ChangeLog: PR c++/99120 * name-lookup.c (check_local_shadow): Check if the type of decl is non-null before checking TYPE_PTR*. gcc/testsuite/ChangeLog: PR c++/99120 * g++.dg/warn/Wshadow-17.C: New test. (cherry picked from commit c2e64c33d9d903f0a52565ad98300feea0ffc580) diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 76f3edb04c8..533d79542c9 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -2802,7 +2802,7 @@ check_local_shadow (tree decl) /* Don't warn for artificial things that are not implicit typedefs. */ if (DECL_ARTIFICIAL (decl) && !DECL_IMPLICIT_TYPEDEF_P (decl)) return; - + if (nonlambda_method_basetype ()) if (tree member = lookup_member (current_nonlambda_class_type (), DECL_NAME (decl), /*protect=*/0, @@ -2814,8 +2814,9 @@ check_local_shadow (tree decl) is a function or a pointer-to-function. */ if (!OVL_P (member) || TREE_CODE (decl) == FUNCTION_DECL - || TYPE_PTRFN_P (TREE_TYPE (decl)) - || TYPE_PTRMEMFUNC_P (TREE_TYPE (decl))) + || (TREE_TYPE (decl) + && (TYPE_PTRFN_P (TREE_TYPE (decl)) + || TYPE_PTRMEMFUNC_P (TREE_TYPE (decl))))) { auto_diagnostic_group d; if (warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wshadow, diff --git a/gcc/testsuite/g++.dg/warn/Wshadow-17.C b/gcc/testsuite/g++.dg/warn/Wshadow-17.C new file mode 100644 index 00000000000..0dee397796f --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wshadow-17.C @@ -0,0 +1,11 @@ +// PR c++/99120 +// { dg-options "-Wshadow" } + +struct S { + void X(); + + template + void fn () { + enum { X }; + } +}; commit 581e87b67233556d566df3a0ea33be9c19fbcb2f Author: Marek Polacek Date: Fri Apr 9 18:41:21 2021 -0400 c++: const_cast of null pointer in constant expr [PR99176] Here we reject constexpr const int *p = nullptr; constexpr int *q = const_cast(p); with "conversion of 'const int*' null pointer to 'int*' is not a constant expression", which seems bogus. This code has been rejected since r238909 which added the can_convert check when converting a null pointer. I'm not finding any standard rule that this check was supposed to enforce. The original discussion was here and here . Since can_convert never assumes a C-style cast, it rejects casting away constness as in the test above and in: constexpr int *q = (int *)(const int *) nullptr; Removing the check only breaks constexpr-nullptr-2.C by not giving any diagnostic for line 229: constexpr B *pb2 = static_cast(pa0); // { dg-error "not a constant expression" } but the cast seems to be valid: we do [expr.static.cast]/7, and [expr.const] only says that a reinterpreter_cast and converting from void* is invalid in constexpr. The can_convert check rejected convering from void *, but only when converting from a null pointer, so it's not good enough. So I've added a check to catch conversions from cv void*. I realize it's not a great time to be adding additional checking, but removing the can_convert check would then technically be a regression. Let's limit the new check to only trigger for integer_zerop and then remove it in GCC 12. gcc/cp/ChangeLog: DR 1312 PR c++/99176 * constexpr.c (is_std_construct_at): New overload. (is_std_allocator_allocate): New overload. (cxx_eval_call_expression): Use the new overloads. (cxx_eval_constant_expression): Reject casting from void * as per DR 1312. Don't check can_convert. gcc/testsuite/ChangeLog: DR 1312 PR c++/99176 * g++.dg/cpp0x/constexpr-nullptr-2.C: Adjust dg-error. * g++.dg/cpp0x/constexpr-cast2.C: New test. * g++.dg/cpp0x/constexpr-cast3.C: New test. diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index ad3853940ff..3611a826013 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1769,6 +1769,16 @@ is_std_construct_at (tree fndecl) return name && id_equal (name, "construct_at"); } +/* Overload for the above taking constexpr_call*. */ + +static inline bool +is_std_construct_at (const constexpr_call *call) +{ + return (call + && call->fundef + && is_std_construct_at (call->fundef->decl)); +} + /* Return true if FNDECL is std::allocator::{,de}allocate. */ static inline bool @@ -1791,6 +1801,16 @@ is_std_allocator_allocate (tree fndecl) return decl_in_std_namespace_p (decl); } +/* Overload for the above taking constexpr_call*. */ + +static inline bool +is_std_allocator_allocate (const constexpr_call *call) +{ + return (call + && call->fundef + && is_std_allocator_allocate (call->fundef->decl)); +} + /* Return true if FNDECL is __dynamic_cast. */ static inline bool @@ -2197,9 +2217,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, if (TREE_CODE (t) == CALL_EXPR && cxx_replaceable_global_alloc_fn (fun) && (CALL_FROM_NEW_OR_DELETE_P (t) - || (ctx->call - && ctx->call->fundef - && is_std_allocator_allocate (ctx->call->fundef->decl)))) + || is_std_allocator_allocate (ctx->call))) { const int nargs = call_expr_nargs (t); tree arg0 = NULL_TREE; @@ -2267,9 +2285,7 @@ cxx_eval_call_expression (const constexpr_ctx *ctx, tree t, argument. */ if (TREE_CODE (t) == CALL_EXPR && cxx_placement_new_fn (fun) - && ctx->call - && ctx->call->fundef - && is_std_construct_at (ctx->call->fundef->decl)) + && is_std_construct_at (ctx->call)) { const int nargs = call_expr_nargs (t); tree arg1 = NULL_TREE; @@ -6270,6 +6286,36 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, if (VOID_TYPE_P (type)) return void_node; + /* [expr.const]: a conversion from type cv void* to a pointer-to-object + type cannot be part of a core constant expression as a resolution to + DR 1312. */ + if (integer_zerop (op) /* FIXME: Remove in GCC 12. */ + && TYPE_PTROB_P (type) + && TYPE_PTR_P (TREE_TYPE (op)) + && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (op))) + /* Inside a call to std::construct_at or to + std::allocator::{,de}allocate, we permit casting from void* + because that is compiler-generated code. */ + && !is_std_construct_at (ctx->call) + && !is_std_allocator_allocate (ctx->call)) + { + /* Likewise, don't error when casting from void* when OP is + &heap uninit and similar. */ + tree sop = tree_strip_nop_conversions (op); + if (TREE_CODE (sop) == ADDR_EXPR + && VAR_P (TREE_OPERAND (sop, 0)) + && DECL_ARTIFICIAL (TREE_OPERAND (sop, 0))) + /* OK */; + else + { + if (!ctx->quiet) + error_at (loc, "cast from %qT is not allowed", + TREE_TYPE (op)); + *non_constant_p = true; + return t; + } + } + if (TREE_CODE (op) == PTRMEM_CST && !TYPE_PTRMEM_P (type)) op = cplus_expand_constant (op); @@ -6288,26 +6334,10 @@ cxx_eval_constant_expression (const constexpr_ctx *ctx, tree t, if (TYPE_REF_P (type)) { if (!ctx->quiet) - error_at (loc, - "dereferencing a null pointer"); + error_at (loc, "dereferencing a null pointer"); *non_constant_p = true; return t; } - else if (TYPE_PTR_P (TREE_TYPE (op))) - { - tree from = TREE_TYPE (op); - - if (!can_convert (type, from, tf_none)) - { - if (!ctx->quiet) - error_at (loc, - "conversion of %qT null pointer to %qT " - "is not a constant expression", - from, type); - *non_constant_p = true; - return t; - } - } } else { diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C new file mode 100644 index 00000000000..7c37f6a3f5a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast2.C @@ -0,0 +1,16 @@ +// DR 1312 - Simulated reinterpret_cast in constant expressions. +// PR c++/99176 +// { dg-do compile { target c++11 } } + +static int i; +constexpr void *vp0 = nullptr; +constexpr void *vpi = &i; +constexpr int *p1 = (int *) vp0; // { dg-error "cast from .void\\*. is not allowed" } +constexpr int *p2 = (int *) vpi; // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } +constexpr int *p3 = static_cast(vp0); // { dg-error "cast from .void\\*. is not allowed" } +constexpr int *p4 = static_cast(vpi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } +constexpr void *p5 = vp0; +constexpr void *p6 = vpi; + +constexpr int *pi = &i; +constexpr bool b = ((int *)(void *) pi == pi); // { dg-error "cast from .void\\*. is not allowed" "integer_zerop" { xfail *-*-* } } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-cast3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast3.C new file mode 100644 index 00000000000..a330a99f7de --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-cast3.C @@ -0,0 +1,14 @@ +// PR c++/99176 +// { dg-do compile { target c++11 } } + +constexpr const int *p = nullptr; +constexpr int *q1 = const_cast(p); +constexpr int *q2 = (int *)(const int *) nullptr; + +struct B { }; +struct D : B { }; +constexpr B *q3 = static_cast(nullptr); +constexpr D *pd = nullptr; +constexpr B *pb = nullptr; +constexpr B *q4 = static_cast(pd); +constexpr D *q5 = static_cast(pb); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C index afb4b37be5a..92f3bbdc0a6 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-nullptr-2.C @@ -163,7 +163,7 @@ constexpr const void *pv2 = pv0; constexpr void *pv3 = pv2; // { dg-error "invalid conversion|not a constant expression" } constexpr const void *pv4 = pv2; -constexpr X *px4 = pv0; // { dg-error "invalid conversion|not a constant expression" } +constexpr X *px4 = pv0; // { dg-error "cast from|invalid conversion|not a constant expression" } } @@ -226,7 +226,7 @@ constexpr A *pa3 = pd0; // { dg-error "ambiguous base" } constexpr A *pa4 = static_cast(pd0); // { dg-error "ambiguous base" } constexpr B *pb1 = pa0; // { dg-error "invalid conversion|not a constant expression" } -constexpr B *pb2 = static_cast(pa0); // { dg-error "not a constant expression" } +constexpr B *pb2 = static_cast(pa0); constexpr C *pc1 = pa0; // { dg-error "invalid conversion|not a constant expression" } constexpr D *pd1 = pa0; // { dg-error "ambiguous base|invalid conversion" } commit b281edd801018ed703ce7bb0d49fef59ff8cef8b Author: Marek Polacek Date: Thu Mar 4 20:20:40 2021 -0500 c++: -Wconversion vs value-dependent expressions [PR99331] This PR complains that we issue a -Wconversion warning in template struct X {}; template X foo(); saying "conversion from 'long unsigned int' to 'int' may change value". While it's not technically wrong, I suspect -Wconversion warnings aren't all that useful for value-dependent expressions. So this patch disables them. This is a regression that started with r241425: @@ -7278,7 +7306,7 @@ convert_template_argument (tree parm, val = error_mark_node; } } - else if (!dependent_template_arg_p (orig_arg) + else if (!type_dependent_expression_p (orig_arg) && !uses_template_parms (t)) /* We used to call digest_init here. However, digest_init will report errors, which we don't want when complain Here orig_arg is SIZEOF_EXPR; dependent_template_arg_p (orig_arg) was true, but type_dependent_expression_p (orig_arg) is false so we warn in convert_nontype_argument. gcc/cp/ChangeLog: PR c++/99331 * call.c (build_converted_constant_expr_internal): Don't emit -Wconversion warnings. gcc/testsuite/ChangeLog: PR c++/99331 * g++.dg/warn/Wconversion5.C: New test. (cherry picked from commit 9efd72d28956eb79c7fca38e3c959733a3bb25bb) diff --git a/gcc/cp/call.c b/gcc/cp/call.c index b65cc6ae6f7..75b207fb876 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4394,6 +4394,9 @@ build_converted_constant_expr_internal (tree type, tree expr, && processing_template_decl) conv = next_conversion (conv); + /* Issuing conversion warnings for value-dependent expressions is + likely too noisy. */ + warning_sentinel w (warn_conversion); conv->check_narrowing = true; conv->check_narrowing_const_only = true; expr = convert_like (conv, expr, complain); diff --git a/gcc/testsuite/g++.dg/warn/Wconversion5.C b/gcc/testsuite/g++.dg/warn/Wconversion5.C new file mode 100644 index 00000000000..f5ae6312bc5 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wconversion5.C @@ -0,0 +1,19 @@ +// PR c++/99331 +// { dg-do compile { target c++11 } } +// { dg-options "-Wconversion" } +// Don't issue -Wconversion warnings for value-dependent expressions. + +template struct X {}; +template struct Y {}; +template X foo(); +template X foo2(); +template Y foo3(); +template Y<1024> foo4(); // { dg-error "narrowing conversion" } +template Y<1u> foo5(); +template X<__INT_MAX__ + 1U> foo6(); // { dg-error "narrowing conversion" } + +template +struct S { + using t = X; + using u = X; +}; commit 3252b78f7ef7847b109e7b43daf7ca1a6f0d6fab Author: Marek Polacek Date: Thu Apr 1 10:42:43 2021 -0400 c++: GC collects live data when synthesizing operator== [PR99831] Here we crash in reshape_init because we're accessing ggc_freed & poisoned data: since r277865 in defaulted_late_check we call synthesize_method here: if (kind == sfk_comparison) { /* If the function was declared constexpr, check that the definition qualifies. Otherwise we can define the function lazily. */ if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn)) synthesize_method (fn); return; } which in this test triggers when we're processing the string<"a">{} in the static_assert. First, we create a CONSTRUCTOR for the "{}" in cp_parser_functional_cast, then we call finish_compound_literal which calls complete_type and that results in garbage collection, which then frees the CONSTRUCTOR {} we created when parsing the braced-list in string<"a">{} -- at this point, it's not referenced by anything. (That's not the case for 'type' in finish_compound_literal: the symbol table contains a node for operator==, so ggc_mark_roots goes and marks the fn decl, its type, its arguments etc., as used, so we don't collect it.) We could just bump function_depth around the new call to synthesize_method to prevent GC. gcc/cp/ChangeLog: PR c++/99831 * method.c (defaulted_late_check): ++ and -- function_depth around the call to synthesize_method. * pt.c: Remove the saved_trees global. gcc/testsuite/ChangeLog: PR c++/99831 * g++.dg/other/gc6.C: New test. (cherry picked from commit 6a60ffc297b9d4903543a25538e62e7fb39420a9) diff --git a/gcc/cp/method.c b/gcc/cp/method.c index 3a3e060843e..bfd1004dcaa 100644 --- a/gcc/cp/method.c +++ b/gcc/cp/method.c @@ -2934,7 +2934,12 @@ defaulted_late_check (tree fn) /* If the function was declared constexpr, check that the definition qualifies. Otherwise we can define the function lazily. */ if (DECL_DECLARED_CONSTEXPR_P (fn) && !DECL_INITIAL (fn)) - synthesize_method (fn); + { + /* Prevent GC. */ + function_depth++; + synthesize_method (fn); + function_depth--; + } return; } diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 548f79dbb3a..145c0b8063f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -63,7 +63,6 @@ static GTY(()) struct pending_template *last_pending_template; int processing_template_parmlist; static int template_header_count; -static GTY(()) tree saved_trees; static vec inline_parm_levels; static GTY(()) struct tinst_level *current_tinst_level; diff --git a/gcc/testsuite/g++.dg/other/gc6.C b/gcc/testsuite/g++.dg/other/gc6.C new file mode 100644 index 00000000000..ff45dd313d6 --- /dev/null +++ b/gcc/testsuite/g++.dg/other/gc6.C @@ -0,0 +1,16 @@ +// PR c++/99831 +// { dg-do compile { target c++20 } } +// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" } + +template struct S { + constexpr S(const char (&str)[N]) : value{} { } + char value[N]; +}; +template struct string { + constexpr bool operator==(const string &) const = default; +}; +template void operator+(string) { + char value[1]; + S{value}; +} +static_assert(string<"a">{} == string<"a">{}); commit 0d4128a514186ac5c41fde10085acb2dcc9118fd Author: Marek Polacek Date: Fri Apr 2 17:11:32 2021 -0400 c++: GC during late parsing collects live data [PR91416] Coming back to : This is a crash that points to a GC problem. Consider this test: __attribute__ ((unused)) struct S { S() { } } s; We're parsing a simple-declaration. While parsing the decl specs, we parse the attribute, which means creating a TREE_LIST using ggc_alloc_*. A function body is a complete-class context so when parsing the member-specification of this class-specifier, we parse the bodies of the functions we'd queued in cp_parser_late_parsing_for_member. This then leads to this call chain: cp_parser_function_definition_after_declarator -> expand_or_defer_fn -> expand_or_defer_fn_1 -> maybe_clone_body -> expand_or_defer_fn -> cgraph_node::finalize_function -> ggc_collect. In this test, the ggc_collect call collects the TREE_LIST we had allocated, and a crash duly ensues. I couldn't do what Richard suggested, that is, attach the attribute list to struct S, because we don't pass decl_specs from cp_parser_type_specifier down to cp_parser_class_specifier. Therefore I've attempted to do "push the decl_specifiers onto a vec that is a GC root", except I couldn't really push the decl_specifiers, because first I'd have to mark cp_decl_specifier_seq with GTY(()) and even that wouldn't be enough for me to be able to create static GTY(()) vec But here we only care about cp_decl_specifier_seq::attributes, so the patch is just this. I've also extended the test so now we test a nested class too. gcc/cp/ChangeLog: PR c++/91416 * parser.c: Create a GC root for attributes in a decl specifier. (cp_parser_type_specifier): Push/pop ->attributes onto/from it. gcc/testsuite/ChangeLog: PR c++/91416 * g++.dg/other/gc7.C: New test. (cherry picked from commit a809d8a737da1ccebcd93065fc57fc0f4d94894a) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 42201564b5d..6aba7e5a2c8 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -17631,6 +17631,11 @@ cp_parser_explicit_specialization (cp_parser* parser) --parser->num_template_parameter_lists; } +/* Preserve the attributes across a garbage collect (by making it a GC + root), which can occur when parsing a member function. */ + +static GTY(()) vec *cp_parser_decl_specs_attrs; + /* Parse a type-specifier. type-specifier: @@ -17723,8 +17728,12 @@ cp_parser_type_specifier (cp_parser* parser, /* Parse tentatively so that we can back up if we don't find a class-specifier. */ cp_parser_parse_tentatively (parser); + if (decl_specs->attributes) + vec_safe_push (cp_parser_decl_specs_attrs, decl_specs->attributes); /* Look for the class-specifier. */ type_spec = cp_parser_class_specifier (parser); + if (decl_specs->attributes) + cp_parser_decl_specs_attrs->pop (); invoke_plugin_callbacks (PLUGIN_FINISH_TYPE, type_spec); /* If that worked, we're done. */ if (cp_parser_parse_definitely (parser)) diff --git a/gcc/testsuite/g++.dg/other/gc7.C b/gcc/testsuite/g++.dg/other/gc7.C new file mode 100644 index 00000000000..ab436bac72f --- /dev/null +++ b/gcc/testsuite/g++.dg/other/gc7.C @@ -0,0 +1,16 @@ +// PR c++/91416 - GC during late parsing collects live data. +// { dg-do compile } +// { dg-options "--param ggc-min-heapsize=0 --param ggc-min-expand=0" } + +__attribute__ ((unused)) struct S { + S() { } +} s; + +__attribute__ ((unused)) struct X { + void fn () + { + __attribute__ ((unused)) struct N { + N() { } + } n; + } +} x; commit 8f4f2fbc17c2a225c29ea20a2b6046cbdc7b3155 Author: Marek Polacek Date: Thu Apr 8 14:39:28 2021 -0400 c++: Fix two issues with auto function parameter [PR99806] When we have a member function with auto parameter like this: struct S { void f(auto); }; cp_parser_member_declaration -> grokfield produces a FUNCTION_DECL "void S::foo(auto:1)", and then finish_fully_implicit_template turns that FUNCTION_DECL into a TEMPLATE_DECL. The bug here is that we only call cp_parser_save_default_args for a FUNCTION_DECL. As a consequence, abbrev10.C is rejected because we complain that the default argument has not been defined, and abbrev11.C ICEs, because we don't re-parse the delayed noexcept, so the DEFERRED_PARSE tree leaks into tsubst* where we crash. This patch fixes both issues. gcc/cp/ChangeLog: PR c++/99806 * parser.c (cp_parser_member_declaration): Call cp_parser_save_default_args even for function templates. Use STRIP_TEMPLATE on the declaration we're passing. gcc/testsuite/ChangeLog: PR c++/99806 * g++.dg/concepts/abbrev10.C: New test. * g++.dg/concepts/abbrev11.C: New test. (cherry picked from commit 625dadaf5df5a2ae0d8c5660fd1eec8ba354479c) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 6aba7e5a2c8..d486cf5998f 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -25437,8 +25437,8 @@ cp_parser_member_declaration (cp_parser* parser) || !DECL_DECLARES_FUNCTION_P (decl)) finish_member_declaration (decl); - if (TREE_CODE (decl) == FUNCTION_DECL) - cp_parser_save_default_args (parser, decl); + if (DECL_DECLARES_FUNCTION_P (decl)) + cp_parser_save_default_args (parser, STRIP_TEMPLATE (decl)); else if (TREE_CODE (decl) == FIELD_DECL && DECL_INITIAL (decl)) /* Add DECL to the queue of NSDMI to be parsed later. */ diff --git a/gcc/testsuite/g++.dg/concepts/abbrev10.C b/gcc/testsuite/g++.dg/concepts/abbrev10.C new file mode 100644 index 00000000000..b611346e926 --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev10.C @@ -0,0 +1,18 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +struct S { + void f(auto, auto, int = 3); + void f2(auto, auto, int = 3) { } + template static T g(T, auto, int = 3); +}; + +void +g () +{ + S::g(1, 2); + S s; + s.f(1, 2); + s.f2(1, 2); +} diff --git a/gcc/testsuite/g++.dg/concepts/abbrev11.C b/gcc/testsuite/g++.dg/concepts/abbrev11.C new file mode 100644 index 00000000000..ddb479313df --- /dev/null +++ b/gcc/testsuite/g++.dg/concepts/abbrev11.C @@ -0,0 +1,10 @@ +// PR c++/99806 +// { dg-do compile { target c++14 } } +// { dg-additional-options "-fconcepts" } + +template concept C = requires (T a) { a.f(0); }; +struct S { + void f(auto) noexcept(B); + static constexpr bool B = true; +}; +static_assert(C, ""); commit 18f103bd9e5465a10caeb70e2c7890a80c79d60a Author: Marek Polacek Date: Fri Apr 9 20:03:45 2021 -0400 c++: ICE with real-to-int conversion in template [PR97973] In this test we are building a call in a template, but since neither the function nor any of its arguments are dependent, we go down the normal path in finish_call_expr. convert_arguments sees that we're binding a reference to int to double and therein convert_to_integer creates a FIX_TRUNC_EXPR. Later, we call check_function_arguments which folds the arguments, and, in a template, fold_for_warn calls fold_non_dependent_expr. But tsubst_copy_and_build should not see a FIX_TRUNC_EXPR (see the patch discussed in ) or we crash. So let's not create a FIX_TRUNC_EXPR in a template in the first place and instead use IMPLICIT_CONV_EXPR. gcc/cp/ChangeLog: PR c++/97973 * call.c (conv_unsafe_in_template_p): New. (convert_like): Use it. gcc/testsuite/ChangeLog: PR c++/97973 * g++.dg/conversion/real-to-int1.C: New test. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 75b207fb876..d4515f21e04 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -7305,6 +7305,27 @@ maybe_warn_array_conv (location_t loc, conversion *c, tree expr) "are only available with %<-std=c++2a%> or %<-std=gnu++2a%>"); } +/* Return true if converting FROM to TO is unsafe in a template. */ + +static bool +conv_unsafe_in_template_p (tree to, tree from) +{ + /* Converting classes involves TARGET_EXPR. */ + if (CLASS_TYPE_P (to) || CLASS_TYPE_P (from)) + return true; + + /* Converting real to integer produces FIX_TRUNC_EXPR which tsubst + doesn't handle. */ + if (SCALAR_FLOAT_TYPE_P (from) && INTEGRAL_OR_ENUMERATION_TYPE_P (to)) + return true; + + /* Converting integer to real isn't a trivial conversion, either. */ + if (INTEGRAL_OR_ENUMERATION_TYPE_P (from) && SCALAR_FLOAT_TYPE_P (to)) + return true; + + return false; +} + /* Wrapper for convert_like_real_1 that handles creating IMPLICIT_CONV_EXPR. */ static tree @@ -7320,7 +7341,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, tree conv_expr = NULL_TREE; if (processing_template_decl && convs->kind != ck_identity - && (CLASS_TYPE_P (convs->type) || CLASS_TYPE_P (TREE_TYPE (expr)))) + && conv_unsafe_in_template_p (convs->type, TREE_TYPE (expr))) { conv_expr = build1 (IMPLICIT_CONV_EXPR, convs->type, expr); if (convs->kind != ck_ref_bind) diff --git a/gcc/testsuite/g++.dg/conversion/real-to-int1.C b/gcc/testsuite/g++.dg/conversion/real-to-int1.C new file mode 100644 index 00000000000..f7b990b3f4b --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/real-to-int1.C @@ -0,0 +1,17 @@ +// PR c++/97973 + +void (*foo[1])(const int &); +void (*foo2[1])(const double &); + +template +void f () +{ + (foo[0])(1.1); + (foo2[0])(1); +} + +void +g () +{ + f (); +} commit e8a35b479038ada80c1ae1b6a3fa1251c00f75a8 Author: GCC Administrator Date: Sat Apr 10 00:17:13 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e82c93a645d..8d175511292 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210409 +20210410 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b576f9a3678..9f80dc009e4 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,104 @@ +2021-04-10 Marek Polacek + + PR c++/97973 + * call.c (conv_unsafe_in_template_p): New. + (convert_like): Use it. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-09 Marek Polacek + + PR c++/99806 + * parser.c (cp_parser_member_declaration): Call + cp_parser_save_default_args even for function templates. Use + STRIP_TEMPLATE on the declaration we're passing. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-03 Marek Polacek + + PR c++/91416 + * parser.c: Create a GC root for attributes in a decl specifier. + (cp_parser_type_specifier): Push/pop ->attributes onto/from it. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-01 Marek Polacek + + PR c++/99831 + * method.c (defaulted_late_check): ++ and -- function_depth around + the call to synthesize_method. + * pt.c: Remove the saved_trees global. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-25 Marek Polacek + + PR c++/99331 + * call.c (build_converted_constant_expr_internal): Don't emit + -Wconversion warnings. + +2021-04-09 Marek Polacek + + DR 1312 + PR c++/99176 + * constexpr.c (is_std_construct_at): New overload. + (is_std_allocator_allocate): New overload. + (cxx_eval_call_expression): Use the new overloads. + (cxx_eval_constant_expression): Reject casting + from void * as per DR 1312. Don't check can_convert. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-05 Marek Polacek + + PR c++/99120 + * name-lookup.c (check_local_shadow): Check if the type of decl + is non-null before checking TYPE_PTR*. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-05 Marek Polacek + + PR c++/99374 + * call.c (standard_conversion): When converting pointers to + member, don't return NULL when the bases are equivalent but + incomplete. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-02-05 Marek Polacek + + PR c++/98947 + * call.c (build_conditional_expr_1): Don't call mark_lvalue_use + on arg2/arg3. + * expr.c (mark_use) : Don't check read_p when + issuing the -Wvolatile warning. Only set TREE_THIS_VOLATILE if + a warning was emitted. + +2021-04-09 Marek Polacek + + PR c++/97966 + * pt.c (instantiate_class_template_1): Instantiate members + marked with attribute used only after we're done instantiating + the class. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-01-19 Marek Polacek + + PR c++/98333 + * parser.c (cp_parser_class_specifier_1): Perform late-parsing + of NSDMIs before late-parsing of noexcept-specifiers. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2913065bf31..4cf6c547a7e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,86 @@ +2021-04-10 Marek Polacek + + PR c++/97973 + * g++.dg/conversion/real-to-int1.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-09 Marek Polacek + + PR c++/99806 + * g++.dg/concepts/abbrev10.C: New test. + * g++.dg/concepts/abbrev11.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-03 Marek Polacek + + PR c++/91416 + * g++.dg/other/gc7.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-04-01 Marek Polacek + + PR c++/99831 + * g++.dg/other/gc6.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-25 Marek Polacek + + PR c++/99331 + * g++.dg/warn/Wconversion5.C: New test. + +2021-04-09 Marek Polacek + + DR 1312 + PR c++/99176 + * g++.dg/cpp0x/constexpr-nullptr-2.C: Adjust dg-error. + * g++.dg/cpp0x/constexpr-cast2.C: New test. + * g++.dg/cpp0x/constexpr-cast3.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-05 Marek Polacek + + PR c++/99120 + * g++.dg/warn/Wshadow-17.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-03-05 Marek Polacek + + PR c++/99374 + * g++.dg/cpp1z/noexcept-type23.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-02-05 Marek Polacek + + PR c++/98947 + * g++.dg/cpp2a/volatile5.C: New test. + +2021-04-09 Marek Polacek + + PR c++/97966 + * g++.dg/cpp0x/noexcept63.C: New test. + +2021-04-09 Marek Polacek + + Backported from master: + 2021-01-19 Marek Polacek + + PR c++/98333 + * g++.dg/cpp0x/noexcept62.C: New test. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index f76d32e398c..8f820af776b 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,13 @@ +2021-04-09 Thomas Schwinge + + Backported from master: + 2021-04-09 Thomas Schwinge + + PR middle-end/84991 + PR middle-end/84992 + PR middle-end/90779 + * testsuite/libgomp.oacc-c-c++-common/static-variable-1.c: New. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 82c0b4a7c94..8c0f50a4241 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,47 @@ +2021-04-09 Jonathan Wakely + + PR bootstrap/99983 + * include/bits/hashtable.h (_Hashtable): Fix noexcept-speciofier + on definition to match the one on the declaration. + +2021-04-09 Jonathan Wakely + + Backported from master: + 2021-04-09 Jonathan Wakely + + PR libstdc++/99985 + * include/bits/hashtable.h (_Hashtable::_S_nothrow_move()): Fix + to be a valid constexpr function in C++11. + * testsuite/23_containers/unordered_set/cons/99985.cc: New test. + +2021-04-09 Jonathan Wakely + + Backported from master: + 2021-04-09 Jonathan Wakely + + * include/bits/fs_fwd.h: Fix doxygen group command. + * include/bits/streambuf_iterator.h: Likewise. + * include/std/chrono: Likewise. + * include/std/memory: Likewise. + * include/std/thread: Likewise. + * include/tr1/complex: Likewise. + +2021-04-09 Jonathan Wakely + + Backported from master: + 2021-04-08 Jonathan Wakely + + * include/bits/basic_string.h: Tweak doxygen comment. + +2021-04-09 Jonathan Wakely + + Backported from master: + 2021-04-08 Jonathan Wakely + + * include/bits/random.h: Fix doxygen group commands. + * include/bits/regex_constants.h: Likewise. + * include/tr1/random.h: Likewise. + 2021-04-08 Jonathan Wakely Backported from master: commit 149eef254022b00f5c933a19ea8703189ca90bcc Author: GCC Administrator Date: Sun Apr 11 00:17:17 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 8d175511292..4320a50e9c4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210410 +20210411 commit 1004d3bb5e590a2cc3d22bc9fb11d3bf4978a982 Author: Marek Polacek Date: Sun Apr 11 16:58:09 2021 -0400 c++: Use FOR_EACH_VEC_ELT instead of range-based for loop. gcc/cp/ChangeLog: PR c++/97966 * pt.c (instantiate_class_template_1): Use FOR_EACH_VEC_ELT instead of range-based for loop. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 145c0b8063f..c1752fd1894 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12134,7 +12134,9 @@ instantiate_class_template_1 (tree type) /* Now that we've gone through all the members, instantiate those marked with attribute used. */ - for (tree x : used) + unsigned int i; + tree x; + FOR_EACH_VEC_ELT (used, i, x) mark_used (x); return type; commit 701e88fa56d557aefeda375e6aeaa66c60c7b792 Author: GCC Administrator Date: Mon Apr 12 00:17:17 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 4320a50e9c4..d61002305d5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210411 +20210412 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 9f80dc009e4..d8cbfaada9e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2021-04-11 Marek Polacek + + PR c++/97966 + * pt.c (instantiate_class_template_1): Use FOR_EACH_VEC_ELT instead + of range-based for loop. + 2021-04-10 Marek Polacek PR c++/97973 commit e976dc67ac5b0f6e9ea5e7e0e4f99c40e5abcd28 Author: Tobias Burnus Date: Fri Apr 9 10:18:24 2021 +0200 Fortran: Fix fndecl with -fcoarray=lib [PR99817] gcc/fortran/ChangeLog: PR fortran/99817 * trans-types.c (gfc_get_function_type): Also generate hidden coarray argument for character arguments. gcc/testsuite/ChangeLog: PR fortran/99817 * gfortran.dg/coarray/dummy_2.f90: New test. (cherry picked from commit d31f485dedc86773152d0384bc6ba5583b259a42) diff --git a/gcc/fortran/trans-types.c b/gcc/fortran/trans-types.c index d3fef08b4b9..68d903d47ae 100644 --- a/gcc/fortran/trans-types.c +++ b/gcc/fortran/trans-types.c @@ -3115,14 +3115,14 @@ gfc_get_function_type (gfc_symbol * sym, gfc_actual_arglist *actual_args) vec_safe_push (typelist, boolean_type_node); /* Coarrays which are descriptorless or assumed-shape pass with -fcoarray=lib the token and the offset as hidden arguments. */ - else if (arg - && flag_coarray == GFC_FCOARRAY_LIB - && ((arg->ts.type != BT_CLASS - && arg->attr.codimension - && !arg->attr.allocatable) - || (arg->ts.type == BT_CLASS - && CLASS_DATA (arg)->attr.codimension - && !CLASS_DATA (arg)->attr.allocatable))) + if (arg + && flag_coarray == GFC_FCOARRAY_LIB + && ((arg->ts.type != BT_CLASS + && arg->attr.codimension + && !arg->attr.allocatable) + || (arg->ts.type == BT_CLASS + && CLASS_DATA (arg)->attr.codimension + && !CLASS_DATA (arg)->attr.allocatable))) { vec_safe_push (typelist, pvoid_type_node); /* caf_token. */ vec_safe_push (typelist, gfc_array_index_type); /* caf_offset. */ diff --git a/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 new file mode 100644 index 00000000000..35263745bb8 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/coarray/dummy_2.f90 @@ -0,0 +1,26 @@ +! { dg-do compile } +! +! PR fortran/99817 +! +! Contributed by G. Steinmetz +! +subroutine s1 (x) + character(*) :: x(*)[*] +end + +subroutine s2 (x) + character(*), dimension(*), codimension[*] :: x + integer :: i + i = len(x) +end + +subroutine s3 (x, y) + character(*), dimension(:) :: x[*] + character(*) :: y +end + +subroutine s4 (x, y, z) + character(*), dimension(:) :: x[2, *] + character(*), dimension(*) :: y + character(*) :: z +end commit 32a859531e854382c18abf0b14a306d83f793eb5 Author: Jonathan Wakely Date: Mon Aug 24 16:18:31 2020 +0100 libstdc++: Fix std::indirectly_readable ambiguity [LWG 3446] This implements the proposed resolution of LWG 3446. I'm also adding another new constrained specialization which isn't proposed by 3446, to resolve the ambiguity when a type has both value_type and element_type but denoting different types. libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (indirectly_readable): Add partial specializations to resolve ambiguities (LWG 3446). * testsuite/24_iterators/associated_types/readable.traits.cc: Check types with both value_type and element_type. (cherry picked from commit 186aa6304570e15065f31482e9c27326a3a6679f) diff --git a/libstdc++-v3/include/bits/iterator_concepts.h b/libstdc++-v3/include/bits/iterator_concepts.h index e2ad37179be..4f118df6b02 100644 --- a/libstdc++-v3/include/bits/iterator_concepts.h +++ b/libstdc++-v3/include/bits/iterator_concepts.h @@ -220,6 +220,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION template requires is_object_v<_Tp> struct __cond_value_type<_Tp> { using value_type = remove_cv_t<_Tp>; }; + + template + concept __has_member_value_type + = requires { typename _Tp::value_type; }; + + template + concept __has_member_element_type + = requires { typename _Tp::element_type; }; + } // namespace __detail template struct indirectly_readable_traits { }; @@ -238,16 +247,33 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION : indirectly_readable_traits<_Iter> { }; - template requires requires { typename _Tp::value_type; } + template<__detail::__has_member_value_type _Tp> struct indirectly_readable_traits<_Tp> : __detail::__cond_value_type { }; - template requires requires { typename _Tp::element_type; } + template<__detail::__has_member_element_type _Tp> struct indirectly_readable_traits<_Tp> : __detail::__cond_value_type { }; + // _GLIBCXX_RESOLVE_LIB_DEFECTS + // 3446. indirectly_readable_traits ambiguity for types with both [...] + template<__detail::__has_member_value_type _Tp> + requires __detail::__has_member_element_type<_Tp> + && same_as, + remove_cv_t> + struct indirectly_readable_traits<_Tp> + : __detail::__cond_value_type + { }; + + // LWG 3446 doesn't add this, but it's needed for the case where + // value_type and element_type are both present, but not the same type. + template<__detail::__has_member_value_type _Tp> + requires __detail::__has_member_element_type<_Tp> + struct indirectly_readable_traits<_Tp> + { }; + namespace __detail { template diff --git a/libstdc++-v3/testsuite/24_iterators/associated_types/readable.traits.cc b/libstdc++-v3/testsuite/24_iterators/associated_types/readable.traits.cc index b503b0cdc1e..3c9c3927153 100644 --- a/libstdc++-v3/testsuite/24_iterators/associated_types/readable.traits.cc +++ b/libstdc++-v3/testsuite/24_iterators/associated_types/readable.traits.cc @@ -141,3 +141,29 @@ struct J // iterator_traits matches constrained specialization in the library, // so use its value_type. static_assert( check_alias ); + +struct I2 +{ + using element_type = int; +}; +// iterator_traits is not specialized, and no standard specialization +// matches, so use indirectly_readable_traits. +static_assert( check_alias::value_type> ); + +// LWG 3446 +struct I3 +{ + using value_type = long; + using element_type = const long; +}; +// iterator_traits is not specialized, and no standard specialization +// matches, so use indirectly_readable_traits. +static_assert( check_alias::value_type> ); + +// Correction to LWG 3446 +struct I4 +{ + using value_type = int; + using element_type = long; +}; +static_assert( ! has_alias ); commit b6bef1cbc14080d5dd0a7ddbb81aa4b68ece84a3 Author: Jonathan Wakely Date: Mon Apr 12 12:49:17 2021 +0100 libstdc++: Implement LWG 3404 for C++20 subrange [PR 100044] These deduction guides became useless with LWG 3282 (implemented in commit r10-6741) and so were removed by LWG 3404. libstdc++-v3/ChangeLog: PR libstdc++/100044 * include/std/ranges (__detail::__iterator_sentinel_pair): Remove helper concept. (subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove deduction guides, as per LWG 3404. * testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class template argument deduction fails. (cherry picked from commit 7569ce583f540ae22c585cc5159e3b23deedd987) diff --git a/libstdc++-v3/include/std/ranges b/libstdc++-v3/include/std/ranges index 8e00222c2e8..a8ec806235d 100644 --- a/libstdc++-v3/include/std/ranges +++ b/libstdc++-v3/include/std/ranges @@ -222,11 +222,6 @@ namespace ranges && __convertible_to_non_slicing<_Up, tuple_element_t<0, _Tp>> && convertible_to<_Vp, tuple_element_t<1, _Tp>>; - template - concept __iterator_sentinel_pair - = !range<_Tp> && __pair_like<_Tp> - && sentinel_for, tuple_element_t<0, _Tp>>; - } // namespace __detail enum class subrange_kind : bool { unsized, sized }; @@ -387,16 +382,6 @@ namespace ranges __detail::__make_unsigned_like_t>) -> subrange<_It, _Sent, subrange_kind::sized>; - template<__detail::__iterator_sentinel_pair _Pr> - subrange(_Pr) - -> subrange, tuple_element_t<1, _Pr>>; - - template<__detail::__iterator_sentinel_pair _Pr> - subrange(_Pr, __detail::__make_unsigned_like_t>>) - -> subrange, tuple_element_t<1, _Pr>, - subrange_kind::sized>; - template subrange(_Rng&&) -> subrange, sentinel_t<_Rng>, diff --git a/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc b/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc index 5c2f1de45ad..3d21774c966 100644 --- a/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc +++ b/libstdc++-v3/testsuite/std/ranges/subrange/lwg3282_neg.cc @@ -29,3 +29,18 @@ struct Base {}; struct Derived : Base {}; subrange sd; subrange sb = sd; // { dg-error "conversion" } + +void +test_lwg3404() +{ + // LWG 3404. Finish removing subrange's conversions from pair-like + std::pair p; + subrange sb1(p); // { dg-error "no matching function" } + // { dg-error "class template argument deduction" "" { target *-*-* } 38 } + subrange sb2(p, p.second - p.first); // { dg-error "no matching function" } + // { dg-error "class template argument deduction" "" { target *-*-* } 40 } + + // { dg-prune-output "in requirements with" } + // { dg-prune-output "template constraint failure" } + // { dg-prune-output "unsatisfied constraints" } +} commit df25ad4531d4ec6c314816f587509ffb336a9842 Author: GCC Administrator Date: Tue Apr 13 00:17:10 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index d61002305d5..177ba027bbe 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210412 +20210413 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index aa5932be872..8ab8f4d0125 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,12 @@ +2021-04-12 Tobias Burnus + + Backported from master: + 2021-04-09 Tobias Burnus + + PR fortran/99817 + * trans-types.c (gfc_get_function_type): Also generate hidden + coarray argument for character arguments. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4cf6c547a7e..77daafb94e8 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2021-04-12 Tobias Burnus + + Backported from master: + 2021-04-09 Tobias Burnus + + PR fortran/99817 + * gfortran.dg/coarray/dummy_2.f90: New test. + 2021-04-10 Marek Polacek PR c++/97973 diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 8c0f50a4241..0913c65a8a9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,26 @@ +2021-04-12 Jonathan Wakely + + Backported from master: + 2021-04-12 Jonathan Wakely + + PR libstdc++/100044 + * include/std/ranges (__detail::__iterator_sentinel_pair): + Remove helper concept. + (subrange(_Pr), subrange(Pr, __make_unsigned_like<...>)): Remove + deduction guides, as per LWG 3404. + * testsuite/std/ranges/subrange/lwg3282_neg.cc: Check that class + template argument deduction fails. + +2021-04-12 Jonathan Wakely + + Backported from master: + 2020-08-24 Jonathan Wakely + + * include/bits/iterator_concepts.h (indirectly_readable): Add + partial specializations to resolve ambiguities (LWG 3446). + * testsuite/24_iterators/associated_types/readable.traits.cc: + Check types with both value_type and element_type. + 2021-04-09 Jonathan Wakely PR bootstrap/99983 commit 63d4c1b5a4333b8ed709b2c6fd1ef030a1c601b8 Author: Eric Botcazou Date: Tue Apr 13 11:57:55 2021 +0200 Fix thinko in libcpp preparation patch for modules The problem is that the new IS_MACRO_LOC macro: inline bool IS_MACRO_LOC (location_t loc) { return !IS_ORDINARY_LOC (loc) && !IS_ADHOC_LOC (loc); } is not fully correct since the position of the macro lines is not fixed: /* Returns the lowest location [of a token resulting from macro expansion] encoded in this line table. */ inline location_t LINEMAPS_MACRO_LOWEST_LOCATION (const line_maps *set) { return LINEMAPS_MACRO_USED (set) ? MAP_START_LOCATION (LINEMAPS_LAST_MACRO_MAP (set)) : MAX_LOCATION_T + 1; } In Ada, LINEMAPS_MACRO_USED is false so LINEMAPS_MACRO_LOWEST_LOCATION is MAX_LOCATION_T + 1, but IS_MACRO_LOC nevertheless returns true for anything in the range [LINE_MAP_MAX_LOCATION; MAX_LOCATION_T], thus yielding an ICE in linemap_macro_map_lookup for very large files. libcpp/ * include/line-map.h (IS_MACRO_LOC): Delete. * line-map.c (linemap_location_from_macro_expansion_p): Test LINEMAPS_MACRO_LOWEST_LOCATION of the linemap. diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index dbbc13762e3..916cdebcd6a 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -561,7 +561,7 @@ struct GTY((tag ("2"))) line_map_macro : public line_map { #define linemap_assert_fails(EXPR) (! (EXPR)) #endif -/* Get whether location LOC is an ad-hoc, ordinary or macro location. */ +/* Get whether location LOC is an ordinary location. */ inline bool IS_ORDINARY_LOC (location_t loc) @@ -569,18 +569,14 @@ IS_ORDINARY_LOC (location_t loc) return loc < LINE_MAP_MAX_LOCATION; } +/* Get whether location LOC is an ad-hoc location. */ + inline bool IS_ADHOC_LOC (location_t loc) { return loc > MAX_LOCATION_T; } -inline bool -IS_MACRO_LOC (location_t loc) -{ - return !IS_ORDINARY_LOC (loc) && !IS_ADHOC_LOC (loc); -} - /* Categorize line map kinds. */ inline bool diff --git a/libcpp/line-map.c b/libcpp/line-map.c index 8a390d0857b..1dce2292522 100644 --- a/libcpp/line-map.c +++ b/libcpp/line-map.c @@ -1244,7 +1244,7 @@ linemap_location_from_macro_expansion_p (const class line_maps *set, if (IS_ADHOC_LOC (location)) location = get_location_from_adhoc_loc (set, location); - return IS_MACRO_LOC (location); + return location >= LINEMAPS_MACRO_LOWEST_LOCATION (set); } /* Given two virtual locations *LOC0 and *LOC1, return the first commit cac0f0e24d853c8893f4c71f1eca260d431afc85 Author: Eric Botcazou Date: Tue Apr 13 17:10:03 2021 +0200 Further increase the limit on the size of accepted Ada files It turns out that the limit on the size of accepted Ada files had been already lowered earlier, namely when location ranges had been introduced. Now we do not make use of location ranges in Ada so we can recoup the loss. gcc/ada/ * gcc-interface/misc.c (gnat_init): Set default range bits to 0. * gcc-interface/trans.c (extract_encoding): Delete. (decode_name): Likewise. (File_Name_to_gnu): New function. (gigi): Call it to translate file names. Replace assertion on 1-1 mapping between files and line maps with conditional error. diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c index d68b37384ff..775ab190515 100644 --- a/gcc/ada/gcc-interface/misc.c +++ b/gcc/ada/gcc-interface/misc.c @@ -366,6 +366,9 @@ gnat_init (void) sbitsize_one_node = sbitsize_int (1); sbitsize_unit_node = sbitsize_int (BITS_PER_UNIT); + /* In Ada, we do not use location ranges. */ + line_table->default_range_bits = 0; + /* Register our internal error function. */ global_dc->internal_error = &internal_error_function; diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c index 7ecf321c250..a2cbaae2326 100644 --- a/gcc/ada/gcc-interface/trans.c +++ b/gcc/ada/gcc-interface/trans.c @@ -252,17 +252,27 @@ static tree build_raise_check (int, enum exception_info_kind); static tree create_init_temporary (const char *, tree, tree *, Node_Id); static bool maybe_make_gnu_thunk (Entity_Id gnat_thunk, tree gnu_thunk); -/* Hooks for debug info back-ends, only supported and used in a restricted set - of configurations. */ -static const char *extract_encoding (const char *) ATTRIBUTE_UNUSED; -static const char *decode_name (const char *) ATTRIBUTE_UNUSED; - /* This makes gigi's file_info_ptr visible in this translation unit, so that Sloc_to_locus can look it up when deciding whether to map decls to instances. */ static struct File_Info_Type *file_map; +/* Return the string of the identifier allocated for the file name Id. */ + +static const char* +File_Name_to_gnu (Name_Id Id) +{ + /* __gnat_to_canonical_file_spec translates file names from pragmas + Source_Reference that contain host style syntax not understood by GDB. */ + const char *name = __gnat_to_canonical_file_spec (Get_Name_String (Id)); + + /* Use the identifier table to make a permanent copy of the file name as + the name table gets reallocated after Gigi returns but before all the + debugging information is output. */ + return IDENTIFIER_POINTER (get_identifier (name)); +} + /* This is the main program of the back-end. It sets up all the table structures and then generates code. */ @@ -316,23 +326,18 @@ gigi (Node_Id gnat_root, for (i = 0; i < number_file; i++) { - /* Use the identifier table to make a permanent copy of the filename as - the name table gets reallocated after Gigi returns but before all the - debugging information is output. The __gnat_to_canonical_file_spec - call translates filenames from pragmas Source_Reference that contain - host style syntax not understood by gdb. */ - const char *filename - = IDENTIFIER_POINTER - (get_identifier - (__gnat_to_canonical_file_spec - (Get_Name_String (file_info_ptr[i].File_Name)))); - /* We rely on the order isomorphism between files and line maps. */ - gcc_assert ((int) LINEMAPS_ORDINARY_USED (line_table) == i); + if ((int) LINEMAPS_ORDINARY_USED (line_table) != i) + { + gcc_assert (i > 0); + error ("%s contains too many lines", + File_Name_to_gnu (file_info_ptr[i - 1].File_Name)); + } /* We create the line map for a source file at once, with a fixed number of columns chosen to avoid jumping over the next power of 2. */ - linemap_add (line_table, LC_ENTER, 0, filename, 1); + linemap_add (line_table, LC_ENTER, 0, + File_Name_to_gnu (file_info_ptr[i].File_Name), 1); linemap_line_start (line_table, file_info_ptr[i].Num_Source_Lines, 252); linemap_position_for_column (line_table, 252 - 1); linemap_add (line_table, LC_LEAVE, 0, NULL, 0); @@ -10976,28 +10981,7 @@ set_end_locus_from_node (tree gnu_node, Node_Id gnat_node) return false; } } - -/* Return a colon-separated list of encodings contained in encoded Ada - name. */ - -static const char * -extract_encoding (const char *name) -{ - char *encoding = (char *) ggc_alloc_atomic (strlen (name)); - get_encoding (name, encoding); - return encoding; -} -/* Extract the Ada name from an encoded name. */ - -static const char * -decode_name (const char *name) -{ - char *decoded = (char *) ggc_alloc_atomic (strlen (name) * 2 + 60); - __gnat_decode (name, decoded, 0); - return decoded; -} - /* Post an error message. MSG is the error message, properly annotated. NODE is the node at which to post the error and the node to use for the '&' substitution. */ commit d83dace65b97112320042c7f4941b64ef339799d Author: Jonathan Wakely Date: Tue Apr 13 16:55:37 2021 +0100 libstdc++: Fix to work freestanding [PR 100060] libstdc++-v3/ChangeLog: PR libstdc++/100060 * include/std/bit: Only include for hosted build, use otherwise. (cherry picked from commit 474cb5a0a404c5de7c1cd21aac8b1b7e7ce95d9b) diff --git a/libstdc++-v3/include/std/bit b/libstdc++-v3/include/std/bit index f22ee528555..2b24f0d450b 100644 --- a/libstdc++-v3/include/std/bit +++ b/libstdc++-v3/include/std/bit @@ -34,7 +34,23 @@ #if __cplusplus >= 201402L #include -#include + +#if _GLIBCXX_HOSTED +# include +#else +# include +/// @cond undocumented +namespace __gnu_cxx +{ + template + struct __int_traits + { + static constexpr int __digits = std::numeric_limits<_Tp>::digits; + static constexpr _Tp __max = std::numeric_limits<_Tp>::max(); + }; +} +/// @endcond +#endif namespace std _GLIBCXX_VISIBILITY(default) { commit 062b65404f0d139d683411d88e46f972cdd3b372 Author: GCC Administrator Date: Wed Apr 14 00:17:08 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 177ba027bbe..3219cc3cd75 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210413 +20210414 diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 86fd883487b..d0deb4bd622 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,12 @@ +2021-04-13 Eric Botcazou + + * gcc-interface/misc.c (gnat_init): Set default range bits to 0. + * gcc-interface/trans.c (extract_encoding): Delete. + (decode_name): Likewise. + (File_Name_to_gnu): New function. + (gigi): Call it to translate file names. Replace assertion on + 1-1 mapping between files and line maps with conditional error. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog index 0d1120a6dd9..34065338294 100644 --- a/libcpp/ChangeLog +++ b/libcpp/ChangeLog @@ -1,3 +1,9 @@ +2021-04-13 Eric Botcazou + + * include/line-map.h (IS_MACRO_LOC): Delete. + * line-map.c (linemap_location_from_macro_expansion_p): Test + LINEMAPS_MACRO_LOWEST_LOCATION of the linemap. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 0913c65a8a9..11d6d0e6186 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,12 @@ +2021-04-13 Jonathan Wakely + + Backported from master: + 2021-04-13 Jonathan Wakely + + PR libstdc++/100060 + * include/std/bit: Only include for + hosted build, use otherwise. + 2021-04-12 Jonathan Wakely Backported from master: commit e9cc5cc589ca3fac2738c9def311e6079172f79f Author: Martin Liska Date: Wed Apr 14 15:39:10 2021 +0200 Sync gcc-changelog scripts. contrib/ChangeLog: * gcc-changelog/git_commit.py: Sync with master. * gcc-changelog/git_email.py: Likewise. * gcc-changelog/git_update_version.py: Likewise. * gcc-changelog/setup.cfg: Likewise. * gcc-changelog/test_email.py: Likewise. * gcc-changelog/test_patches.txt: Likewise. diff --git a/contrib/gcc-changelog/git_commit.py b/contrib/gcc-changelog/git_commit.py index ee1973371be..b28f7deac23 100755 --- a/contrib/gcc-changelog/git_commit.py +++ b/contrib/gcc-changelog/git_commit.py @@ -214,6 +214,7 @@ class ChangeLogEntry: self.lines = [] self.files = [] self.file_patterns = [] + self.opened_parentheses = 0 def parse_file_names(self): # Whether the content currently processed is between a star prefix the @@ -223,8 +224,14 @@ class ChangeLogEntry: for line in self.lines: # If this line matches the star prefix, start the location # processing on the information that follows the star. + # Note that we need to skip macro names that can be in form of: + # + # * config/i386/i386.md (*fix_trunc_i387_1, + # *add3_ne, *add3_eq_0, *add3_ne_0, + # *fist2__1, *3_1): + # m = star_prefix_regex.match(line) - if m: + if m and len(m.group('spaces')) == 1: in_location = True line = m.group('content') @@ -307,8 +314,9 @@ class GitCommit: if self.revert_commit: self.info = self.commit_to_info_hook(self.revert_commit) + # Allow complete deletion of ChangeLog files in a commit project_files = [f for f in self.info.modified_files - if self.is_changelog_filename(f[0]) + if (self.is_changelog_filename(f[0], allow_suffix=True) and f[1] != 'D') or f[0] in misc_files] ignored_files = [f for f in self.info.modified_files if self.in_ignored_location(f[0])] @@ -328,6 +336,7 @@ class GitCommit: self.parse_changelog() self.parse_file_names() self.check_for_empty_description() + self.check_for_broken_parentheses() self.deduce_changelog_locations() self.check_file_patterns() if not self.errors: @@ -343,8 +352,14 @@ class GitCommit: return [x[0] for x in self.info.modified_files if x[1] == 'A'] @classmethod - def is_changelog_filename(cls, path): - return path.endswith('/ChangeLog') or path == 'ChangeLog' + def is_changelog_filename(cls, path, allow_suffix=False): + basename = os.path.basename(path) + if basename == 'ChangeLog': + return True + elif allow_suffix and basename.startswith('ChangeLog'): + return True + else: + return False @classmethod def find_changelog_location(cls, name): @@ -400,8 +415,10 @@ class GitCommit: if line != line.rstrip(): self.errors.append(Error('trailing whitespace', line)) if len(line.replace('\t', ' ' * TAB_WIDTH)) > LINE_LIMIT: - self.errors.append(Error('line exceeds %d character limit' - % LINE_LIMIT, line)) + # support long filenames + if not line.startswith('\t* ') or not line.endswith(':') or ' ' in line[3:-1]: + self.errors.append(Error('line exceeds %d character limit' + % LINE_LIMIT, line)) m = changelog_regex.match(line) if m: last_entry = ChangeLogEntry(m.group(1).rstrip('/'), @@ -490,7 +507,8 @@ class GitCommit: else: m = star_prefix_regex.match(line) if m: - if len(m.group('spaces')) != 1: + if (len(m.group('spaces')) != 1 and + last_entry.opened_parentheses == 0): msg = 'one space should follow asterisk' self.errors.append(Error(msg, line)) else: @@ -502,6 +520,7 @@ class GitCommit: msg = f'empty group "{needle}" found' self.errors.append(Error(msg, line)) last_entry.lines.append(line) + self.process_parentheses(last_entry, line) else: if last_entry.is_empty: msg = 'first line should start with a tab, ' \ @@ -509,6 +528,18 @@ class GitCommit: self.errors.append(Error(msg, line)) else: last_entry.lines.append(line) + self.process_parentheses(last_entry, line) + + def process_parentheses(self, last_entry, line): + for c in line: + if c == '(': + last_entry.opened_parentheses += 1 + elif c == ')': + if last_entry.opened_parentheses == 0: + msg = 'bad wrapping of parenthesis' + self.errors.append(Error(msg, line)) + else: + last_entry.opened_parentheses -= 1 def parse_file_names(self): for entry in self.changelog_entries: @@ -532,6 +563,12 @@ class GitCommit: msg = 'missing description of a change' self.errors.append(Error(msg, line)) + def check_for_broken_parentheses(self): + for entry in self.changelog_entries: + if entry.opened_parentheses != 0: + msg = 'bad parentheses wrapping' + self.errors.append(Error(msg, entry.lines[0])) + def get_file_changelog_location(self, changelog_file): for file in self.info.modified_files: if file[0] == changelog_file: diff --git a/contrib/gcc-changelog/git_email.py b/contrib/gcc-changelog/git_email.py index 00ad00458f4..b0547b363aa 100755 --- a/contrib/gcc-changelog/git_email.py +++ b/contrib/gcc-changelog/git_email.py @@ -66,7 +66,7 @@ class GitEmail(GitCommit): t = 'A' else: t = 'M' - modified_files.append((target, t)) + modified_files.append((target if t != 'D' else source, t)) git_info = GitInfo(None, date, author, body, modified_files) super().__init__(git_info, strict=strict, commit_to_info_hook=lambda x: None) diff --git a/contrib/gcc-changelog/git_update_version.py b/contrib/gcc-changelog/git_update_version.py index d2cadb8811c..1e2b22b008b 100755 --- a/contrib/gcc-changelog/git_update_version.py +++ b/contrib/gcc-changelog/git_update_version.py @@ -26,6 +26,9 @@ from git_repository import parse_git_revisions current_timestamp = datetime.datetime.now().strftime('%Y%m%d\n') +# Skip the following commits, they cannot be correctly processed +IGNORED_COMMITS = ('c2be82058fb40f3ae891c68d185ff53e07f14f45') + def read_timestamp(path): with open(path) as f: @@ -98,6 +101,7 @@ def update_current_branch(): head = head.parents[1] commits = parse_git_revisions(args.git_path, '%s..%s' % (commit.hexsha, head.hexsha)) + commits = [c for c in commits if c.info.hexsha not in IGNORED_COMMITS] for git_commit in reversed(commits): prepend_to_changelog_files(repo, args.git_path, git_commit, not args.dry_mode) diff --git a/contrib/gcc-changelog/setup.cfg b/contrib/gcc-changelog/setup.cfg index 9e4a0f6479c..efc313f6d52 100644 --- a/contrib/gcc-changelog/setup.cfg +++ b/contrib/gcc-changelog/setup.cfg @@ -1,2 +1,5 @@ +[flake8] +max-line-length = 120 + [tool:pytest] addopts = -vv --flake8 diff --git a/contrib/gcc-changelog/test_email.py b/contrib/gcc-changelog/test_email.py index 5db56caef9e..8abf5c37487 100755 --- a/contrib/gcc-changelog/test_email.py +++ b/contrib/gcc-changelog/test_email.py @@ -404,3 +404,23 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-Add-horse2.patch') assert not email.errors assert email.changelog_entries[0].files == ['koníček.txt'] + + def test_modification_of_old_changelog(self): + email = self.from_patch_glob('0001-fix-old-ChangeLog.patch') + assert not email.errors + + def test_multiline_parentheses(self): + email = self.from_patch_glob('0001-Add-macro.patch') + assert not email.errors + + def test_multiline_bad_parentheses(self): + email = self.from_patch_glob('0002-Wrong-macro-changelog.patch') + assert email.errors[0].message == 'bad parentheses wrapping' + + def test_changelog_removal(self): + email = self.from_patch_glob('0001-ChangeLog-removal.patch', strict=True) + assert not email.errors + + def test_long_filenames(self): + email = self.from_patch_glob('0001-long-filenames') + assert not email.errors diff --git a/contrib/gcc-changelog/test_patches.txt b/contrib/gcc-changelog/test_patches.txt index ffd13682d5c..3f9806dc076 100644 --- a/contrib/gcc-changelog/test_patches.txt +++ b/contrib/gcc-changelog/test_patches.txt @@ -3398,4 +3398,151 @@ index 00000000000..56c67f58752 -- 2.29.2 +=== 0001-fix-old-ChangeLog.patch === +From fd498465b2801203089616be9a0e3c1f4fc065a0 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 13 Jan 2021 11:45:37 +0100 +Subject: [PATCH] Fix a changelog. + +--- + gcc/ChangeLog-2020 | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gcc/ChangeLog-2020 b/gcc/ChangeLog-2020 +index 6553720acad..2c170ef014a 100644 +--- a/gcc/ChangeLog-2020 ++++ b/gcc/ChangeLog-2020 +@@ -1 +1,2 @@ + ++ + +-- +2.29.2 +=== 0001-Add-macro.patch === +From 9b7eedc932fe594547fb060b36dfd9e4178c4f9b Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 13 Jan 2021 16:26:45 +0100 +Subject: [PATCH 1/2] Add macro. + +gcc/ChangeLog: + + * config/i386/i386.md (*fix_trunc_i387_1, *add3_eq, + *add3_ne, *add3_eq_0, *add3_ne_0, *add3_eq, + *fist2__1, *3_1, *di3_doubleword): + Use ix86_pre_reload_split instead of can_create_pseudo_p in condition. + * config/i386/sse.md + (*fix_trunc_i387_1, *add3_eq, + *add3_ne, *add3_eq_0, *add3_ne_0, *add3_eq, + *fist2__1): This should also work. +--- + gcc/config/i386/i386.md | 1 + + gcc/config/i386/sse.md | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md +index b60784a2908..ac63591b33f 100644 +--- a/gcc/config/i386/i386.md ++++ b/gcc/config/i386/i386.md +@@ -1 +1,2 @@ + ++ + +diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md +index 7f03fc491c3..0e17997db26 100644 +--- a/gcc/config/i386/sse.md ++++ b/gcc/config/i386/sse.md +@@ -1 +1,2 @@ + ++ + +-- +2.29.2 + +=== 0002-Wrong-macro-changelog.patch === +From 3542802111d4c6752ac7233ef96655b7fb78aae4 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Wed, 13 Jan 2021 16:54:58 +0100 +Subject: [PATCH 2/2] Wrong macro changelog + +gcc/ChangeLog: + * config/i386/i386.md (*fix_trunc_i387_1, + (foo): Change it. +--- + gcc/config/i386/i386.md | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md +index ac63591b33f..ff4d61764e7 100644 +--- a/gcc/config/i386/i386.md ++++ b/gcc/config/i386/i386.md +@@ -1 +1,2 @@ + ++ +-- +2.29.2 + +=== 0001-ChangeLog-removal.patch === +From b39fadf9df1a9510afcab0a391182da7dc68de24 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Fri, 12 Mar 2021 09:10:55 +0100 +Subject: [PATCH] Test ChangeLog removal. + +gcc/ChangeLog: + + * ipa-icf.c (make_pass_ipa_icf): Add line. +--- +diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog +deleted file mode 100644 +index 94e87f6bcde..00000000000 +--- a/gcc/analyzer/ChangeLog ++++ /dev/null +@@ -1,1 +0,0 @@ +- foo +diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c +index 5dd33a75c3a..c4ce432cb98 100644 +--- a/gcc/ipa-icf.c ++++ b/gcc/ipa-icf.c +@@ -3655,3 +3655,4 @@ make_pass_ipa_icf (gcc::context *ctxt) + { + return new ipa_icf::pass_ipa_icf (ctxt); + } ++ +-- +2.30.1 + +=== 0001-long-filenames === +From 0a5b3f87bdac5e61f9a626c795d30f9e93198585 Mon Sep 17 00:00:00 2001 +From: Martin Liska +Date: Mon, 12 Apr 2021 13:10:14 +0200 +Subject: [PATCH] libstdc++: Fix some tests that fail in C++20 mode + +The linear_congruential_engine negative tests fail with a different +error in C++20 mode, because double is no longer an invalid type for +NTTP. Adjust the expected errors. + +libstdc++-v3/ChangeLog: + + * testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc: + Adjust expected error for C++20 mode. + * testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc: + Likewise. +--- + .../linear_congruential_engine/requirements/non_uint_neg.cc | 4 +++- + .../random/linear_congruential/requirements/non_uint_neg.cc | 3 ++- + 2 files changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc +index e04e8ca6972..a36d63c6c7b 100644 +--- a/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc ++++ b/libstdc++-v3/testsuite/26_numerics/random/linear_congruential_engine/requirements/non_uint_neg.cc +@@ -1 +1,2 @@ + ++ +diff --git a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc +index 5ad82db1def..53b15f32516 100644 +--- a/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc ++++ b/libstdc++-v3/testsuite/tr1/5_numerical_facilities/random/linear_congruential/requirements/non_uint_neg.cc +@@ -1 +1,2 @@ + ++ commit ca27b58ee2b5feda80a97eacd01b4f780d216778 Author: GCC Administrator Date: Thu Apr 15 00:17:34 2021 +0000 Daily bump. diff --git a/contrib/ChangeLog b/contrib/ChangeLog index cfcc8b12b53..977fcbcf1e8 100644 --- a/contrib/ChangeLog +++ b/contrib/ChangeLog @@ -1,3 +1,12 @@ +2021-04-14 Martin Liska + + * gcc-changelog/git_commit.py: Sync with master. + * gcc-changelog/git_email.py: Likewise. + * gcc-changelog/git_update_version.py: Likewise. + * gcc-changelog/setup.cfg: Likewise. + * gcc-changelog/test_email.py: Likewise. + * gcc-changelog/test_patches.txt: Likewise. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 3219cc3cd75..e9d3aa7a596 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210414 +20210415 commit 088c0b5ccf8b670efc25bcbea722c86c8d1faadc Author: GCC Administrator Date: Fri Apr 16 00:17:23 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e9d3aa7a596..e74bf2b4f1c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210415 +20210416 commit d15a2a00a384672c5f8228d49eba2b0c09048a43 Author: Tamar Christina Date: Fri Apr 16 16:58:50 2021 +0100 SVE: Fix wrong sve predicate split (PR100048) The attached testcase generates the following paradoxical subregs when creating the predicates. (insn 22 21 23 2 (set (reg:VNx8BI 100) (subreg:VNx8BI (reg:VNx2BI 103) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) (const_int 1 [0x1]) (const_int 0 [0]) repeated x5 ]) (nil))) and (insn 15 14 16 2 (set (reg:VNx8BI 96) (subreg:VNx8BI (reg:VNx2BI 99) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) repeated x7 ]) (nil))) This causes CSE to incorrectly think that the two predicates are equal because some of the significant bits get ignored due to the subreg. The attached patch instead makes it so it always looks at all 16-bits of the predicate, but in turn means we need to generate a TRN that matches the expected result mode. In effect in RTL we keep the mode as VNx16BI but during codegen re-interpret them as the mode the predicate instruction wanted: (insn 10 9 11 2 (set (reg:VNx8BI 96) (subreg:VNx8BI (reg:VNx16BI 99) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) repeated x7 ]) (nil))) Which needed correction to the TRN pattern. A new TRN1_CONV unspec is introduced which allows one to keep the arguments as VNx16BI but encode the instruction as a type of the last operand. (insn 9 8 10 2 (set (reg:VNx16BI 99) (unspec:VNx16BI [ (reg:VNx16BI 97) (reg:VNx16BI 98) (reg:VNx2BI 100) ] UNSPEC_TRN1_CONV)) (nil)) This allows us remove all the paradoxical subregs and end up with (insn 16 15 17 2 (set (reg:VNx8BI 101) (subreg:VNx8BI (reg:VNx16BI 104) 0)) (expr_list:REG_EQUAL (const_vector:VNx8BI [ (const_int 1 [0x1]) (const_int 0 [0]) (const_int 1 [0x1]) (const_int 0 [0]) repeated x5 ]) (nil))) gcc/ChangeLog: PR target/100048 * config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv): New. * config/aarch64/aarch64.c (aarch64_expand_sve_const_pred_trn): Use new TRN optab. * config/aarch64/iterators.md (UNSPEC_TRN1_CONV): New. gcc/testsuite/ChangeLog: PR target/100048 * gcc.target/aarch64/sve/pr100048.c: New test. (cherry picked from commit 8535755af70f819d820553b2e73e72a16a984599) diff --git a/gcc/config/aarch64/aarch64-sve.md b/gcc/config/aarch64/aarch64-sve.md index d17a7770690..bd51323e57d 100644 --- a/gcc/config/aarch64/aarch64-sve.md +++ b/gcc/config/aarch64/aarch64-sve.md @@ -8455,6 +8455,20 @@ "\t%0., %1., %2." ) +;; Special purpose permute used by the predicate generation instructions. +;; Unlike the normal permute patterns, these instructions operate on VNx16BI +;; regardless of the element size, so that all input and output bits are +;; well-defined. Operand 3 then indicates the size of the permute. +(define_insn "@aarch64_sve_trn1_conv" + [(set (match_operand:VNx16BI 0 "register_operand" "=Upa") + (unspec:VNx16BI [(match_operand:VNx16BI 1 "register_operand" "Upa") + (match_operand:VNx16BI 2 "register_operand" "Upa") + (match_operand:PRED_ALL 3 "aarch64_simd_imm_zero")] + UNSPEC_TRN1_CONV))] + "TARGET_SVE" + "trn1\t%0., %1., %2." +) + ;; ========================================================================= ;; == Conversions ;; ========================================================================= diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 9b400c49ac6..688f6986741 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -5067,12 +5067,12 @@ aarch64_expand_sve_const_pred_trn (rtx target, rtx_vector_builder &builder, } } - /* Emit the TRN1 itself. */ + /* Emit the TRN1 itself. We emit a TRN that operates on VNx16BI + operands but permutes them as though they had mode MODE. */ machine_mode mode = aarch64_sve_pred_mode (permute_size).require (); - target = aarch64_target_reg (target, mode); - emit_insn (gen_aarch64_sve (UNSPEC_TRN1, mode, target, - gen_lowpart (mode, a), - gen_lowpart (mode, b))); + target = aarch64_target_reg (target, GET_MODE (a)); + rtx type_reg = CONST0_RTX (mode); + emit_insn (gen_aarch64_sve_trn1_conv (mode, target, a, b, type_reg)); return target; } diff --git a/gcc/config/aarch64/iterators.md b/gcc/config/aarch64/iterators.md index 0a7145281fa..ff5b23d71b1 100644 --- a/gcc/config/aarch64/iterators.md +++ b/gcc/config/aarch64/iterators.md @@ -633,6 +633,7 @@ UNSPEC_UZP2Q ; Used in aarch64-sve.md. UNSPEC_ZIP1Q ; Used in aarch64-sve.md. UNSPEC_ZIP2Q ; Used in aarch64-sve.md. + UNSPEC_TRN1_CONV ; Used in aarch64-sve.md. UNSPEC_COND_CMPEQ_WIDE ; Used in aarch64-sve.md. UNSPEC_COND_CMPGE_WIDE ; Used in aarch64-sve.md. UNSPEC_COND_CMPGT_WIDE ; Used in aarch64-sve.md. diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c new file mode 100644 index 00000000000..525933863f7 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/sve/pr100048.c @@ -0,0 +1,25 @@ +/* { dg-additional-options "-O2 -fno-schedule-insns" } */ +/* { dg-final { check-function-bodies "**" "" "-DCHECK_ASM" } } */ + +#include "arm_sve.h" + +/* +** foo: +** ptrue (p[0-7])\.d, all +** pfalse (p[0-7])\.b +** ptrue (p[0-7])\.s, all +** trn1 (p[0-7])\.d, \2\.d, \3\.d +** trn1 \2\.d, \1\.d, \3\.d +** faddv (h[0-31]), \4\, (z[0-31]).h +** faddv (h[0-31]), \2\, \6\.h +** str \5, [x0] +** str \7, [x0, 2] +** ret +*/ +void foo(svfloat16_t in, float16_t *dst) { + const svbool_t pg_q0 = svdupq_n_b16(1, 0, 1, 0, 0, 0, 0, 0); + const svbool_t pg_f0 = svdupq_n_b16(1, 0, 0, 0, 0, 0, 0, 0); + dst[0] = svaddv_f16(pg_f0, in); + dst[1] = svaddv_f16(pg_q0, in); +} + commit 85c3858465b9fc8c05d11c7b0a6c72792788f33f Author: GCC Administrator Date: Sat Apr 17 00:17:10 2021 +0000 Daily bump. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 29813eb5fc6..5fd8c10fe33 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2021-04-16 Tamar Christina + + Backported from master: + 2021-04-16 Tamar Christina + + PR target/100048 + * config/aarch64/aarch64-sve.md (@aarch64_sve_trn1_conv): New. + * config/aarch64/aarch64.c (aarch64_expand_sve_const_pred_trn): Use new + TRN optab. + * config/aarch64/iterators.md (UNSPEC_TRN1_CONV): New. + 2021-04-08 Richard Biener PR lto/99898 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index e74bf2b4f1c..be1258941c2 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210416 +20210417 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 77daafb94e8..91b7fa8dd33 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2021-04-16 Tamar Christina + + Backported from master: + 2021-04-16 Tamar Christina + + PR target/100048 + * gcc.target/aarch64/sve/pr100048.c: New test. + 2021-04-12 Tobias Burnus Backported from master: commit b18305e6746b57ac051386465f6077700932ffc4 Author: GCC Administrator Date: Sun Apr 18 00:17:13 2021 +0000 Daily bump. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index be1258941c2..94c7da9c4c5 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210417 +20210418 commit e4dcb3383bff4c209a918127551cabc56b4171ae Author: Hafiz Abid Qadeer Date: Thu Apr 8 17:31:30 2021 +0100 [OpenACC] Fix an ICE where a loop with GT condition is collapsed. We have seen an ICE both on trunk and devel/omp/gcc-10 branches which can be reprodued with this simple testcase. It occurs if an OpenACC loop has a collapse clause and any of the loop being collapsed uses GT or GE condition. This issue is specific to OpenACC. int main (void) { int ix, iy; int dim_x = 16, dim_y = 16; { for (iy = dim_y - 1; iy > 0; --iy) for (ix = dim_x - 1; ix > 0; --ix) ; } } The problem is caused by a failing assertion in expand_oacc_collapse_init. It checks that cond_code for fd->loop should be same as cond_code for all the loops that are being collapsed. As the cond_code for fd->loop is LT_EXPR with collapse clause (set at the end of omp_extract_for_data), this assertion forces that all the loop in collapse clause should use < operator. There does not seem to be anything in the code which demands this condition as loop with > condition works ok otherwise. I digged old mailing list a bit but could not find any discussion on this change. Looking at the code, expand_oacc_for checks that fd->loop->cond_code is either LT_EXPR or GT_EXPR. I guess the original intention was to have similar checks on the loop which are being collapsed. But the way check was written does not acheive that. I have fixed it by modifying the check in the assertion to be same as check on fd->loop->cond_code. I tested goacc and libgomp (with nvptx offloading) and did not see any regression. I have added new tests to check collapse with GT/GE condition. PR middle-end/98088 gcc/ * omp-expand.c (expand_oacc_collapse_init): Update condition in a gcc_assert. gcc/testsuite/ * c-c++-common/goacc/collapse-2.c: New. libgomp/ * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Add check for loop with GT/GE condition. * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. (cherry picked from commit ac200799acb5cd2fb9e1758f6bf5fff1978daaeb) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index 90df5c90547..b73fcf0b0a2 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -1569,7 +1569,7 @@ expand_oacc_collapse_init (const struct omp_for_data *fd, tree diff_type = iter_type; tree plus_type = iter_type; - gcc_assert (loop->cond_code == fd->loop.cond_code); + gcc_assert (loop->cond_code == LT_EXPR || loop->cond_code == GT_EXPR); if (POINTER_TYPE_P (iter_type)) plus_type = sizetype; diff --git a/gcc/testsuite/c-c++-common/goacc/collapse-2.c b/gcc/testsuite/c-c++-common/goacc/collapse-2.c new file mode 100644 index 00000000000..e46028cd5c4 --- /dev/null +++ b/gcc/testsuite/c-c++-common/goacc/collapse-2.c @@ -0,0 +1,56 @@ +/* Test for ICE as reported in PR98088. */ + +int i, j; + +void +f1 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 5; i > 5; i--) + for (j = 5; j > 0; j--) + ; +} + +void +f2 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 0; i < 5; i++) + for (j = 5; j > 0; j--) + ; +} + +void +f3 (void) +{ + #pragma acc parallel + #pragma acc loop collapse (2) + for (i = 5; i >= 0; i--) + for (j = 5; j >= 0; j--) + ; +} + +void f4 () +{ + #pragma acc parallel loop tile(2, 3) + for (int i = 0; i > 8; i++) + for (int j = 0; j > 8; j++); +} + +void f5 () +{ + #pragma acc parallel loop tile(2, 3) + for (int i = 0; i > 8; i++) + for (long j = 0; j > 8; j++); +} + +void +f6 (int a[32][32]) +{ + #pragma acc parallel loop collapse(2) + for (int i = 16; i > 8; i--) + for (int j = 16; j > 8; j--) + a[i][j] = i + j; +} diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-2.c index 1ea0a6b846d..7a8cfd2f3d4 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-2.c @@ -5,7 +5,7 @@ int main (void) { - int i, j, k, l = 0, f = 0, x = 0; + int i, j, k, l = 0, f = 0, x = 0, l2 = 0; int m1 = 4, m2 = -5, m3 = 17; #pragma acc parallel @@ -20,6 +20,19 @@ main (void) } } + /* Test loop with > condition. */ +#pragma acc parallel + #pragma acc loop seq collapse(3) reduction(+:l2) + for (i = -2; i < m1; i++) + for (j = -3; j > (m2 - 1); j--) + { + for (k = 13; k < m3; k++) + { + if ((i + 2) * 12 + (j + 5) * 4 + (k - 13) != 9 + f++) + l2++; + } + } + for (i = -2; i < m1; i++) for (j = m2; j < -2; j++) { @@ -30,7 +43,7 @@ main (void) } } - if (l != x) + if (l != x || l2 != x) abort (); return 0; diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c index 680042892e4..50f538d0a32 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/collapse-3.c @@ -7,7 +7,7 @@ int main (void) { - int i2, l = 0, r = 0; + int i2, l = 0, r = 0, l2 = 0; int a[3][3][3]; memset (a, '\0', sizeof (a)); @@ -27,13 +27,24 @@ main (void) l += 1; } + /* Test loop with >= condition. */ +#pragma acc parallel + { + #pragma acc loop collapse(2) reduction(|:l2) + for (i2 = 0; i2 < 2; i2++) + for (int j = 1; j >= 0; j--) + for (int k = 0; k < 2; k++) + if (a[i2][j][k] != i2 + j * 4 + k * 16) + l2 += 1; + } + for (i2 = 0; i2 < 2; i2++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) if (a[i2][j][k] != i2 + j * 4 + k * 16) r += 1; - if (l != r) + if (l != r || l2 != r) abort (); return 0; } commit aff57bcebe534b1d92f78bdfb89a4001a6d12af2 Author: Harald Anlauf Date: Fri Apr 16 16:24:31 2021 +0200 PR fortran/63797 - Bogus ambiguous reference to 'sqrt' The interface of an intrinsic procedure is automatically explicit. Do not write it to the module file to prevent wrong ambiguities on USE. gcc/fortran/ChangeLog: PR fortran/63797 * module.c (write_symtree): Do not write interface of intrinsic procedure to module file for F2003 and newer. gcc/testsuite/ChangeLog: PR fortran/63797 * gfortran.dg/pr63797.f90: New test. Co-authored-by: Paul Thomas (cherry picked from commit d264194c1069fbcd129222f86455137f29a5c6fd) diff --git a/gcc/fortran/module.c b/gcc/fortran/module.c index 9a5b1cb7625..0c14f2a8105 100644 --- a/gcc/fortran/module.c +++ b/gcc/fortran/module.c @@ -6078,6 +6078,17 @@ write_symtree (gfc_symtree *st) if (check_unique_name (st->name)) return; + /* From F2003 onwards, intrinsic procedures are no longer subject to + the restriction, "that an elemental intrinsic function here be of + type integer or character and each argument must be an initialization + expr of type integer or character" is lifted so that intrinsic + procedures can be over-ridden. This requires that the intrinsic + symbol not appear in the module file, thereby preventing ambiguity + when USEd. */ + if (strcmp (sym->module, "(intrinsic)") == 0 + && (gfc_option.allow_std & GFC_STD_F2003)) + return; + p = find_pointer (sym); if (p == NULL) gfc_internal_error ("write_symtree(): Symbol not written"); diff --git a/gcc/testsuite/gfortran.dg/pr63797.f90 b/gcc/testsuite/gfortran.dg/pr63797.f90 new file mode 100644 index 00000000000..1131e8167b1 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr63797.f90 @@ -0,0 +1,60 @@ +! { dg-do compile } +! PR63797 - Bogus ambiguous reference to 'sqrt' + +module mod1 + implicit none + real, parameter :: z = sqrt (0.0) + real :: w = sqrt (1.0) + interface + pure real function sqrt_ifc (x) + real, intent(in) :: x + end function sqrt_ifc + end interface +contains + pure function myroot () result (f) + procedure(sqrt_ifc), pointer :: f + intrinsic :: sqrt + f => sqrt + end function myroot +end module mod1 + +module mod2 + implicit none + type t + real :: a = 0. + end type + interface sqrt + module procedure sqrt + end interface +contains + elemental function sqrt (a) + type(t), intent(in) :: a + type(t) :: sqrt + sqrt% a = a% a + end function sqrt +end module mod2 + +module mod3 + implicit none + abstract interface + function real_func (x) + real :: real_func + real, intent (in) :: x + end function real_func + end interface + intrinsic :: sqrt + procedure(real_func), pointer :: real_root => sqrt +end module mod3 + +program test + use mod1 + use mod2 + use mod3 + implicit none + type(t) :: x, y + procedure(sqrt_ifc), pointer :: root + root => myroot () + y = sqrt (x) + y% a = sqrt (x% a) + z - w + root (x% a) + y% a = real_root (x% a) +end program test commit 6af956c84f34df613dba2626affaf7482fe3a8a8 Author: GCC Administrator Date: Mon Apr 19 00:17:16 2021 +0000 Daily bump. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5fd8c10fe33..15d41f05ec9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2021-04-18 Hafiz Abid Qadeer + + Backported from master: + 2021-04-11 Hafiz Abid Qadeer + + PR middle-end/98088 + * omp-expand.c (expand_oacc_collapse_init): Update condition in + a gcc_assert. + 2021-04-16 Tamar Christina Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 94c7da9c4c5..fac6a1c7805 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210418 +20210419 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 8ab8f4d0125..39bab1f2b2d 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2021-04-18 Harald Anlauf + + Backported from master: + 2021-04-16 Harald Anlauf + Paul Thomas + + PR fortran/63797 + * module.c (write_symtree): Do not write interface of intrinsic + procedure to module file for F2003 and newer. + 2021-04-12 Tobias Burnus Backported from master: diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 91b7fa8dd33..57c688431b6 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,20 @@ +2021-04-18 Harald Anlauf + + Backported from master: + 2021-04-16 Harald Anlauf + Paul Thomas + + PR fortran/63797 + * gfortran.dg/pr63797.f90: New test. + +2021-04-18 Hafiz Abid Qadeer + + Backported from master: + 2021-04-11 Hafiz Abid Qadeer + + PR middle-end/98088 + * c-c++-common/goacc/collapse-2.c: New. + 2021-04-16 Tamar Christina Backported from master: diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 8f820af776b..9bd9c3d2c56 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,13 @@ +2021-04-18 Hafiz Abid Qadeer + + Backported from master: + 2021-04-11 Hafiz Abid Qadeer + + PR middle-end/98088 + * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Add check + for loop with GT/GE condition. + * testsuite/libgomp.oacc-c-c++-common/collapse-3.c: Likewise. + 2021-04-09 Thomas Schwinge Backported from master: commit f44242b40b715b16d0295eb93fa92ce56e5bfa77 Author: Eric Botcazou Date: Mon Apr 19 10:13:36 2021 +0200 Fix another -freorder-blocks-and-partition glitch with Windows SEH Since GCC 8, the -freorder-blocks-and-partition pass can split a function into hot and cold parts, thus generating 2 FDEs for a single function in DWARF for exception purposes and doing an equivalent trick for Windows SEH. Now the Windows system unwinder does not support arbitrarily large frames and there is even a hard limit on the encoding of the CFI, which changes the stack allocation strategy when it is topped and which must be reflected everywhere. gcc/ * config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with frames larger than the SEH maximum frame size. gcc/testsuite/ * gnat.dg/opt92.adb: New test. diff --git a/gcc/config/i386/winnt.c b/gcc/config/i386/winnt.c index 201f69e74c4..a39d09f06da 100644 --- a/gcc/config/i386/winnt.c +++ b/gcc/config/i386/winnt.c @@ -921,15 +921,17 @@ i386_pe_seh_cold_init (FILE *f, const char *name) /* In the normal case, the frame pointer is near the bottom of the frame so we can do the full stack allocation and set it afterwards. There - is an exception when the function accesses prior frames so, in this - case, we need to pre-allocate a small chunk before setting it. */ - if (crtl->accesses_prior_frames) - alloc_offset = seh->cfa_offset; - else + is an exception if the function overflows the SEH maximum frame size + or accesses prior frames so, in this case, we need to pre-allocate a + small chunk of stack before setting it. */ + offset = seh->sp_offset - INCOMING_FRAME_SP_OFFSET; + if (offset < SEH_MAX_FRAME_SIZE && !crtl->accesses_prior_frames) alloc_offset = seh->sp_offset; + else + alloc_offset = MIN (seh->cfa_offset + 240, seh->sp_offset); offset = alloc_offset - INCOMING_FRAME_SP_OFFSET; - if (offset > 0 && offset < SEH_MAX_FRAME_SIZE) + if (offset > 0) fprintf (f, "\t.seh_stackalloc\t" HOST_WIDE_INT_PRINT_DEC "\n", offset); for (int regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++) @@ -958,7 +960,7 @@ i386_pe_seh_cold_init (FILE *f, const char *name) fprintf (f, ", " HOST_WIDE_INT_PRINT_DEC "\n", offset); } - if (crtl->accesses_prior_frames) + if (alloc_offset != seh->sp_offset) { offset = seh->sp_offset - alloc_offset; if (offset > 0 && offset < SEH_MAX_FRAME_SIZE) diff --git a/gcc/testsuite/gnat.dg/opt92.adb b/gcc/testsuite/gnat.dg/opt92.adb new file mode 100644 index 00000000000..f6eb6a034ec --- /dev/null +++ b/gcc/testsuite/gnat.dg/opt92.adb @@ -0,0 +1,38 @@ +-- { dg-do compile { target { lp64 || llp64 } } } +-- { dg-options "-O2 -gnatws" } + +procedure Main is + + subtype Int64 is Long_Long_Integer; + + type Arr is array (Int64 range <>) of Boolean; + + Pow : constant := 10; + + procedure Compute (B : in out Arr) is + Factor : Int64 := 3; + Num : Int64; + begin + while Factor <= 10 ** (Pow / 2) loop + Num := Factor; + while Num < 10 ** Pow loop + if B (Num) then + Factor := Num; + exit; + end if; + Num := Num + 2; + end loop; + Num := Factor * Factor; + while Num < 10 ** Pow loop + B (Num) := False; + Num := Num + Factor * 2; + end loop; + Factor := Factor + 2; + end loop; + end; + + B : Arr (1 .. 10 ** Pow) := (others => True); + +begin + Compute (B); +end; commit 67e95b6908b842e437089e867e5eed6dbbe264f2 Author: Jonathan Wakely Date: Mon Oct 26 12:02:50 2020 +0000 libstdc++: Fix declarations of memalign etc. for freestanding [PR 97570] libstdc++-v3/ChangeLog: PR libstdc++/97570 * libsupc++/new_opa.cc: Declare size_t in global namespace. Remove unused header. (cherry picked from commit 93e9a7bcd5434a24c945de33cd7fa01a25f68418) diff --git a/libstdc++-v3/libsupc++/new_opa.cc b/libstdc++-v3/libsupc++/new_opa.cc index b935936e19a..732fe827cda 100644 --- a/libstdc++-v3/libsupc++/new_opa.cc +++ b/libstdc++-v3/libsupc++/new_opa.cc @@ -26,7 +26,6 @@ #include #include #include -#include #include #include "new" @@ -44,6 +43,7 @@ using std::new_handler; using std::bad_alloc; #if ! _GLIBCXX_HOSTED +using std::size_t; extern "C" { # if _GLIBCXX_HAVE_ALIGNED_ALLOC commit af408874e3d94492ac08ba17462b3ff8ecb4d791 Author: Tobias Burnus Date: Fri Nov 27 11:17:50 2020 +0100 OpenACC: Fix integer-type issue with collapse/tile [PR97880] gcc/ChangeLog: PR c/97880 * omp-expand.c (expand_oacc_collapse_init, expand_oacc_collapse_vars): Use now passed diff_type. (expand_oacc_for): Take largest type for diff_type, taking tiling and collapsing into account. gcc/testsuite/ChangeLog: PR c/97880 * gcc.dg/goacc/tile-1.c: New test. (cherry picked from commit f324479caf0ac326534f4fcf72cb12991ccddb3d) diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index b73fcf0b0a2..af4059cc2ab 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -1548,8 +1548,8 @@ struct oacc_collapse static tree expand_oacc_collapse_init (const struct omp_for_data *fd, gimple_stmt_iterator *gsi, - oacc_collapse *counts, tree bound_type, - location_t loc) + oacc_collapse *counts, tree diff_type, + tree bound_type, location_t loc) { tree tiling = fd->tiling; tree total = build_int_cst (bound_type, 1); @@ -1566,17 +1566,12 @@ expand_oacc_collapse_init (const struct omp_for_data *fd, const omp_for_data_loop *loop = &fd->loops[ix]; tree iter_type = TREE_TYPE (loop->v); - tree diff_type = iter_type; tree plus_type = iter_type; gcc_assert (loop->cond_code == LT_EXPR || loop->cond_code == GT_EXPR); if (POINTER_TYPE_P (iter_type)) plus_type = sizetype; - if (POINTER_TYPE_P (diff_type) || TYPE_UNSIGNED (diff_type)) - diff_type = signed_type_for (diff_type); - if (TYPE_PRECISION (diff_type) < TYPE_PRECISION (integer_type_node)) - diff_type = integer_type_node; if (tiling) { @@ -1664,7 +1659,8 @@ expand_oacc_collapse_init (const struct omp_for_data *fd, static void expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner, gimple_stmt_iterator *gsi, - const oacc_collapse *counts, tree ivar) + const oacc_collapse *counts, tree ivar, + tree diff_type) { tree ivar_type = TREE_TYPE (ivar); @@ -1676,7 +1672,6 @@ expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner, const oacc_collapse *collapse = &counts[ix]; tree v = inner ? loop->v : collapse->outer; tree iter_type = TREE_TYPE (v); - tree diff_type = TREE_TYPE (collapse->step); tree plus_type = iter_type; enum tree_code plus_code = PLUS_EXPR; tree expr; @@ -1698,7 +1693,7 @@ expand_oacc_collapse_vars (const struct omp_for_data *fd, bool inner, } expr = fold_build2 (MULT_EXPR, diff_type, fold_convert (diff_type, expr), - collapse->step); + fold_convert (diff_type, collapse->step)); expr = fold_build2 (plus_code, iter_type, inner ? collapse->outer : collapse->base, fold_convert (plus_type, expr)); @@ -6039,6 +6034,12 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) plus_code = POINTER_PLUS_EXPR; plus_type = sizetype; } + for (int ix = fd->collapse; ix--;) + { + tree diff_type2 = TREE_TYPE (fd->loops[ix].step); + if (TYPE_PRECISION (diff_type) < TYPE_PRECISION (diff_type2)) + diff_type = diff_type2; + } if (POINTER_TYPE_P (diff_type) || TYPE_UNSIGNED (diff_type)) diff_type = signed_type_for (diff_type); if (TYPE_PRECISION (diff_type) < TYPE_PRECISION (integer_type_node)) @@ -6122,7 +6123,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) { gcc_assert (!gimple_in_ssa_p (cfun) && up); counts = XALLOCAVEC (struct oacc_collapse, fd->collapse); - tree total = expand_oacc_collapse_init (fd, &gsi, counts, + tree total = expand_oacc_collapse_init (fd, &gsi, counts, diff_type, TREE_TYPE (fd->loop.n2), loc); if (SSA_VAR_P (fd->loop.n2)) @@ -6284,7 +6285,7 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) gsi_insert_before (&gsi, ass, GSI_SAME_STMT); if (fd->collapse > 1 || fd->tiling) - expand_oacc_collapse_vars (fd, false, &gsi, counts, v); + expand_oacc_collapse_vars (fd, false, &gsi, counts, v, diff_type); if (fd->tiling) { @@ -6354,7 +6355,8 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd) /* Initialize the user's loop vars. */ gsi = gsi_start_bb (elem_body_bb); - expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset); + expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset, + diff_type); } } diff --git a/gcc/testsuite/gcc.dg/goacc/tile-1.c b/gcc/testsuite/gcc.dg/goacc/tile-1.c new file mode 100644 index 00000000000..6898397ad5e --- /dev/null +++ b/gcc/testsuite/gcc.dg/goacc/tile-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ + +/* PR c/97880 */ + +void f () +{ + #pragma acc parallel loop tile(2, 3) + for (int i = 0; i < 8; i++) + for (long j = 0; j < 8; j++); +} commit ab83ce42ea0b2fbc09d51b7bd5e69905dcaa2041 Author: François Dumont Date: Sun Mar 7 19:11:02 2021 +0100 libstdc++: [_GLIBCXX_DEBUG] Fix management of __dp_sign_max_size [PR 99402] __dp_sign precision indicates that we found out what iterator comes first or last in the range. __dp_sign_max_size is the same plus it gives the information of the max size of the range that is to say the max_size value such that distance(lhs, rhs) < max_size. Thanks to this additional information we are able to tell when a copy of n elements to that range will fail even if we do not know exactly how large it is. This patch makes sure that we are properly using this information. libstdc++-v3/ChangeLog: PR libstdc++/99402 * include/debug/helper_functions.h (__can_advance(_InputIterator, const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const _Safe_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * include/debug/macros.h (__glibcxx_check_can_increment_dist): New, use latter. (__glibcxx_check_can_increment_range): Adapt to use latter. (__glibcxx_check_can_decrement_range): Likewise. * include/debug/safe_iterator.h (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const _Safe_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * include/debug/safe_iterator.tcc (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, int)): New. (_Safe_iterator<>::_M_valid_range(const _Safe_iterator<>&, std::pair&, bool)): Adapt for __dp_sign_max_size. (__copy_move_a): Adapt to use __glibcxx_check_can_increment_dist. (__copy_move_backward_a): Likewise. (__equal_aux): Likewise. * include/debug/stl_iterator.h (__can_advance(const std::reverse_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. (__can_advance(const std::move_iterator<>&, const std::pair<_Diff, _Distance_precision>&, int)): New. * testsuite/25_algorithms/copy/debug/99402.cc: New test. diff --git a/libstdc++-v3/include/debug/helper_functions.h b/libstdc++-v3/include/debug/helper_functions.h index 62d5309257f..9e2d206f06c 100644 --- a/libstdc++-v3/include/debug/helper_functions.h +++ b/libstdc++-v3/include/debug/helper_functions.h @@ -64,7 +64,7 @@ namespace __gnu_debug { private: typedef - typename std::iterator_traits<_Iterator>::difference_type _ItDiffType; + typename std::iterator_traits<_Iterator>::difference_type _ItDiffType; template::__type> @@ -287,6 +287,18 @@ namespace __gnu_debug __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>&, _Size); + template + _GLIBCXX_CONSTEXPR + inline bool + __can_advance(_InputIterator, const std::pair<_Diff, _Distance_precision>&, int) + { return true; } + + template + bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>&, + const std::pair<_Diff, _Distance_precision>&, int); + /** Helper function to extract base iterator of random access safe iterator * in order to reduce performance impact of debug mode. Limited to random * access iterator because it is the only category for which it is possible diff --git a/libstdc++-v3/include/debug/macros.h b/libstdc++-v3/include/debug/macros.h index 73fb50d0cbd..1f45f8e0adc 100644 --- a/libstdc++-v3/include/debug/macros.h +++ b/libstdc++-v3/include/debug/macros.h @@ -104,6 +104,12 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \ ._M_iterator(_First, #_First) \ ._M_integer(_Size, #_Size)) +#define __glibcxx_check_can_increment_dist(_First,_Dist,_Way) \ + _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Dist, _Way), \ + _M_message(__gnu_debug::__msg_iter_subscript_oob) \ + ._M_iterator(_First, #_First) \ + ._M_integer(_Way * _Dist.first, #_Dist)) + #define __glibcxx_check_can_increment_range(_First1,_Last1,_First2) \ do \ { \ @@ -115,7 +121,7 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \ ._M_iterator(_Last1, #_Last1), \ __FILE__,__LINE__,__PRETTY_FUNCTION__); \ _GLIBCXX_DEBUG_VERIFY_COND_AT( \ - __gnu_debug::__can_advance(_First2, __dist.first),\ + __gnu_debug::__can_advance(_First2, __dist, 1), \ _M_message(__gnu_debug::__msg_iter_subscript_oob)\ ._M_iterator(_First2, #_First2) \ ._M_integer(__dist.first), \ @@ -133,7 +139,7 @@ _GLIBCXX_DEBUG_VERIFY(__gnu_debug::__can_advance(_First, _Size), \ ._M_iterator(_Last1, #_Last1), \ __FILE__,__LINE__,__PRETTY_FUNCTION__); \ _GLIBCXX_DEBUG_VERIFY_COND_AT( \ - __gnu_debug::__can_advance(_First2, -__dist.first),\ + __gnu_debug::__can_advance(_First2, __dist, -1), \ _M_message(__gnu_debug::__msg_iter_subscript_oob)\ ._M_iterator(_First2, #_First2) \ ._M_integer(-__dist.first), \ diff --git a/libstdc++-v3/include/debug/safe_iterator.h b/libstdc++-v3/include/debug/safe_iterator.h index 687b844fd75..2f51618dd88 100644 --- a/libstdc++-v3/include/debug/safe_iterator.h +++ b/libstdc++-v3/include/debug/safe_iterator.h @@ -405,6 +405,12 @@ namespace __gnu_debug bool _M_can_advance(difference_type __n, bool __strict = false) const; + // Can we advance the iterator using @p __dist in @p __way direction. + template + bool + _M_can_advance(const std::pair<_Diff, _Distance_precision>& __dist, + int __way) const; + // Is the iterator range [*this, __rhs) valid? bool _M_valid_range(const _Safe_iterator& __rhs, @@ -956,6 +962,14 @@ namespace __gnu_debug _Size __n) { return __it._M_can_advance(__n); } + template + inline bool + __can_advance(const _Safe_iterator<_Iterator, _Sequence, _Category>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __it._M_can_advance(__dist, __way); } + template _Iterator __base(const _Safe_iterator<_Iterator, _Sequence, diff --git a/libstdc++-v3/include/debug/safe_iterator.tcc b/libstdc++-v3/include/debug/safe_iterator.tcc index 312a88911ee..79a8ee28d97 100644 --- a/libstdc++-v3/include/debug/safe_iterator.tcc +++ b/libstdc++-v3/include/debug/safe_iterator.tcc @@ -92,24 +92,32 @@ namespace __gnu_debug if (__n == 0) return true; + std::pair __dist = __n < 0 + ? _M_get_distance_from_begin() + : _M_get_distance_to_end(); + if (__n < 0) - { - std::pair __dist = - _M_get_distance_from_begin(); - return __dist.second == __dp_exact - ? __dist.first >= -__n - : !__strict && __dist.first > 0; - } - else - { - std::pair __dist = - _M_get_distance_to_end(); - return __dist.second == __dp_exact - ? __dist.first >= __n - : !__strict && __dist.first > 0; - } + __n = -__n; + + return __dist.second > __dp_sign + ? __dist.first >= __n + : !__strict && __dist.first > 0; } + template + template + bool + _Safe_iterator<_Iterator, _Sequence, _Category>:: + _M_can_advance(const std::pair<_Diff, _Distance_precision>& __dist, + int __way) const + { + return __dist.second == __dp_exact + ? _M_can_advance(__way * __dist.first) + : _M_can_advance(__way * (__dist.first == 0 + ? 0 + : __dist.first < 0 ? -1 : 1)); + } + template typename _Distance_traits<_Iterator>::__type _Safe_iterator<_Iterator, _Sequence, _Category>:: @@ -191,19 +199,12 @@ namespace __gnu_debug /* Determine iterators order */ __dist = _M_get_distance_to(__rhs); - switch (__dist.second) + if (__dist.second != __dp_equality) { - case __dp_equality: - if (__dist.first == 0) - return true; - break; - - case __dp_sign: - case __dp_exact: // If range is not empty first iterator must be dereferenceable. - if (__dist.first > 0) - return !__check_dereferenceable || _M_dereferenceable(); - return __dist.first == 0; + return __dist.first == 0 + || (__dist.first > 0 + && (!__check_dereferenceable || _M_dereferenceable())); } // Assume that this is a valid range; we can't check anything else. @@ -224,9 +225,8 @@ namespace __gnu_debug __dist = std::make_pair(__rhs.base() - this->base(), __dp_exact); // If range is not empty first iterator must be dereferenceable. - if (__dist.first > 0) - return this->_M_dereferenceable(); - return __dist.first == 0; + return __dist.first == 0 + || (__dist.first > 0 && this->_M_dereferenceable()); } } // namespace __gnu_debug @@ -244,7 +244,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, __dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_equality) return std::__copy_move_a<_IsMove>(__first.base(), __last.base(), @@ -261,7 +261,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_II>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, __dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_sign && __result._M_can_advance(__dist.first, true)) @@ -283,7 +283,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, __dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_equality) { @@ -311,7 +311,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_Ite>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, -__dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, -1); if (__dist.second > ::__gnu_debug::__dp_equality) return std::__copy_move_backward_a<_IsMove>( @@ -328,7 +328,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_II>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, -__dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, -1); if (__dist.second > ::__gnu_debug::__dp_sign && __result._M_can_advance(-__dist.first, true)) @@ -351,7 +351,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_IIte>::__type __dist; __glibcxx_check_valid_range2(__first, __last, __dist); - __glibcxx_check_can_increment(__result, -__dist.first); + __glibcxx_check_can_increment_dist(__result, __dist, -1); if (__dist.second > ::__gnu_debug::__dp_equality) { @@ -416,7 +416,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; __glibcxx_check_valid_range2(__first1, __last1, __dist); - __glibcxx_check_can_increment(__first2, __dist.first); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_equality) return std::__equal_aux(__first1.base(), __last1.base(), __first2); @@ -431,7 +431,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; __glibcxx_check_valid_range2(__first1, __last1, __dist); - __glibcxx_check_can_increment(__first2, __dist.first); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_sign && __first2._M_can_advance(__dist.first, true)) @@ -450,7 +450,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { typename ::__gnu_debug::_Distance_traits<_II1>::__type __dist; __glibcxx_check_valid_range2(__first1, __last1, __dist); - __glibcxx_check_can_increment(__first2, __dist.first); + __glibcxx_check_can_increment_dist(__first2, __dist, 1); if (__dist.second > ::__gnu_debug::__dp_equality) { diff --git a/libstdc++-v3/include/debug/stl_iterator.h b/libstdc++-v3/include/debug/stl_iterator.h index 6044f3588d9..02adb6e3c06 100644 --- a/libstdc++-v3/include/debug/stl_iterator.h +++ b/libstdc++-v3/include/debug/stl_iterator.h @@ -52,6 +52,13 @@ namespace __gnu_debug __can_advance(const std::reverse_iterator<_Iterator>& __it, _Size __n) { return __can_advance(__it.base(), -__n); } + template + inline bool + __can_advance(const std::reverse_iterator<_Iterator>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __can_advance(__it.base(), __dist, -__way); } + template inline std::reverse_iterator<_Iterator> __base(const std::reverse_iterator<_Safe_iterator< @@ -101,6 +108,13 @@ namespace __gnu_debug __can_advance(const std::move_iterator<_Iterator>& __it, _Size __n) { return __can_advance(__it.base(), __n); } + template + inline bool + __can_advance(const std::move_iterator<_Iterator>& __it, + const std::pair<_Diff, _Distance_precision>& __dist, + int __way) + { return __can_advance(__it.base(), __dist, __way); } + template inline auto __unsafe(const std::move_iterator<_Iterator>& __it) diff --git a/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc new file mode 100644 index 00000000000..041d222d079 --- /dev/null +++ b/libstdc++-v3/testsuite/25_algorithms/copy/debug/99402.cc @@ -0,0 +1,35 @@ +// Copyright (C) 2021 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 +// . + +// { dg-options "-D_GLIBCXX_DEBUG" } +// { dg-do run } + +#include +#include +#include + +// PR libstdc++/99402 + +using namespace std; + +int main() +{ + // any container with non-random access iterators: + const set source = { 0, 1 }; + vector dest(1); + copy(source.begin(), ++source.begin(), dest.begin()); +} commit 19fc127321c7fe3962bd8b6c0064b224ab14aec7 Author: Iain Buclaw Date: Mon Apr 19 18:45:32 2021 +0200 d: Fix ICE in when formating a string with '%' or '`' characters (PR98457) The percentage character was being confused for a format specifier in pp_format(), whilst the backtick character was confused for the beginning of a quoted string in expand_d_format(). Both are now properly escaped to avoid the ICE. gcc/d/ChangeLog: PR d/98457 * d-diagnostic.cc (expand_d_format): Handle escaped backticks. (escape_d_format): New funtion. (verror): Call escape_d_format on prefixing strings. (vdeprecation): Likewise. gcc/testsuite/ChangeLog: PR d/98457 * gdc.dg/pr98457.d: New test. (cherry picked from commit dc7d1c74ffb1cc85e67984632f581d526c783770) diff --git a/gcc/d/d-diagnostic.cc b/gcc/d/d-diagnostic.cc index 6af35f71c31..dbe6bc1bb7b 100644 --- a/gcc/d/d-diagnostic.cc +++ b/gcc/d/d-diagnostic.cc @@ -48,7 +48,7 @@ expand_d_format (const char *format) for (const char *p = format; *p;) { - while (*p != '\0' && *p != '%' && *p != '`') + while (*p != '\0' && *p != '\\' && *p != '%' && *p != '`') { buf.writeByte (*p); p++; @@ -57,6 +57,21 @@ expand_d_format (const char *format) if (*p == '\0') break; + if (*p == '\\') + { + if (p[1] == '`') + { + /* Escaped backtick, don't expand it as a quoted string. */ + buf.writeByte ('`'); + p++;; + } + else + buf.writeByte (*p); + + p++; + continue; + } + if (*p == '`') { /* Text enclosed by `...` are translated as a quoted string. */ @@ -113,6 +128,43 @@ expand_d_format (const char *format) return buf.extractString (); } +/* Rewrite the format string FORMAT to deal with any characters that require + escaping before expand_d_format expands it. */ + +static char * +escape_d_format (const char *format) +{ + obstack buf; + + gcc_obstack_init (&buf); + + for (const char *p = format; *p; p++) + { + switch (*p) + { + case '%': + /* Escape `%' characters so that pp_format does not confuse them + for actual format specifiers. */ + obstack_1grow (&buf, '%'); + break; + + case '`': + /* Escape '`' characters so that expand_d_format does not confuse them + for a quoted string. */ + obstack_1grow (&buf, '\\'); + break; + + default: + break; + } + + obstack_1grow (&buf, *p); + } + + obstack_1grow (&buf, '\0'); + return (char *) obstack_finish (&buf); +} + /* Helper routine for all error routines. Reports a diagnostic specified by KIND at the explicit location LOC. The message FORMAT comes from the dmd front-end, which does not get translated by the gcc diagnostic routines. */ @@ -177,9 +229,10 @@ verror (const Loc& loc, const char *format, va_list ap, /* Build string and emit. */ if (prefix2 != NULL) - xformat = xasprintf ("%s %s %s", prefix1, prefix2, format); + xformat = xasprintf ("%s %s %s", escape_d_format (prefix1), + escape_d_format (prefix2), format); else if (prefix1 != NULL) - xformat = xasprintf ("%s %s", prefix1, format); + xformat = xasprintf ("%s %s", escape_d_format (prefix1), format); else xformat = xasprintf ("%s", format); @@ -287,9 +340,10 @@ vdeprecation (const Loc& loc, const char *format, va_list ap, /* Build string and emit. */ if (prefix2 != NULL) - xformat = xasprintf ("%s %s %s", prefix1, prefix2, format); + xformat = xasprintf ("%s %s %s", escape_d_format (prefix1), + escape_d_format (prefix2), format); else if (prefix1 != NULL) - xformat = xasprintf ("%s %s", prefix1, format); + xformat = xasprintf ("%s %s", escape_d_format (prefix1), format); else xformat = xasprintf ("%s", format); diff --git a/gcc/testsuite/gdc.dg/pr98457.d b/gcc/testsuite/gdc.dg/pr98457.d new file mode 100644 index 00000000000..bc0d8af5d4a --- /dev/null +++ b/gcc/testsuite/gdc.dg/pr98457.d @@ -0,0 +1,9 @@ +// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98457 +// { dg-do compile } + +void main() +{ + writef!"%s"; // { dg-error "template instance writef!\"%s\" template .writef. is not defined" } + writef!"`%s"; // { dg-error "template instance writef!\"`%s\" template .writef. is not defined" } + writef!"%%s`"; // { dg-error "template instance writef!\"%%s`\" template .writef. is not defined" } +} commit 9c2c106369e4035351eb2325a05dc2fc929a22db Author: GCC Administrator Date: Tue Apr 20 00:17:16 2021 +0000 Daily bump. diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 15d41f05ec9..e71bf05954f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,19 @@ +2021-04-19 Tobias Burnus + + Backported from master: + 2020-11-27 Tobias Burnus + + PR c/97880 + * omp-expand.c (expand_oacc_collapse_init, expand_oacc_collapse_vars): + Use now passed diff_type. + (expand_oacc_for): Take largest type for diff_type, taking tiling + and collapsing into account. + +2021-04-19 Eric Botcazou + + * config/i386/winnt.c (i386_pe_seh_cold_init): Properly deal with + frames larger than the SEH maximum frame size. + 2021-04-18 Hafiz Abid Qadeer Backported from master: diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index fac6a1c7805..b392715811c 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210419 +20210420 diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 8bc729ae32d..afe5976027b 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,14 @@ +2021-04-19 Iain Buclaw + + Backported from master: + 2021-04-19 Iain Buclaw + + PR d/98457 + * d-diagnostic.cc (expand_d_format): Handle escaped backticks. + (escape_d_format): New funtion. + (verror): Call escape_d_format on prefixing strings. + (vdeprecation): Likewise. + 2021-04-08 Release Manager * GCC 10.3.0 released. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 57c688431b6..ba467fe2982 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,23 @@ +2021-04-19 Iain Buclaw + + Backported from master: + 2021-04-19 Iain Buclaw + + PR d/98457 + * gdc.dg/pr98457.d: New test. + +2021-04-19 Tobias Burnus + + Backported from master: + 2020-11-27 Tobias Burnus + + PR c/97880 + * gcc.dg/goacc/tile-1.c: New test. + +2021-04-19 Eric Botcazou + + * gnat.dg/opt92.adb: New test. + 2021-04-18 Harald Anlauf Backported from master: diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 11d6d0e6186..c841cbab075 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,43 @@ +2021-04-19 François Dumont + + PR libstdc++/99402 + * include/debug/helper_functions.h (__can_advance(_InputIterator, + const std::pair<_Diff, _Distance_precision>&, int)): New. + (__can_advance(const _Safe_iterator<>&, + const std::pair<_Diff, _Distance_precision>&, int)): New. + * include/debug/macros.h (__glibcxx_check_can_increment_dist): New, + use latter. + (__glibcxx_check_can_increment_range): Adapt to use latter. + (__glibcxx_check_can_decrement_range): Likewise. + * include/debug/safe_iterator.h + (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, + int)): New. + (__can_advance(const _Safe_iterator<>&, + const std::pair<_Diff, _Distance_precision>&, int)): New. + * include/debug/safe_iterator.tcc + (_Safe_iterator<>::_M_can_advance(const std::pair<_Diff, _Distance_precision>&, + int)): New. + (_Safe_iterator<>::_M_valid_range(const _Safe_iterator<>&, + std::pair&, bool)): Adapt for + __dp_sign_max_size. + (__copy_move_a): Adapt to use __glibcxx_check_can_increment_dist. + (__copy_move_backward_a): Likewise. + (__equal_aux): Likewise. + * include/debug/stl_iterator.h (__can_advance(const std::reverse_iterator<>&, + const std::pair<_Diff, _Distance_precision>&, int)): New. + (__can_advance(const std::move_iterator<>&, + const std::pair<_Diff, _Distance_precision>&, int)): New. + * testsuite/25_algorithms/copy/debug/99402.cc: New test. + +2021-04-19 Jonathan Wakely + + Backported from master: + 2020-10-26 Jonathan Wakely + + PR libstdc++/97570 + * libsupc++/new_opa.cc: Declare size_t in global namespace. + Remove unused header. + 2021-04-13 Jonathan Wakely Backported from master: commit 8642b73a0f0df1f8e1e2d2102d67a76f8ed0a255 Author: Jakub Jelinek Date: Sat Apr 3 10:05:32 2021 +0200 rs6000: Fix up libgcc ABI when built with --with-long-double-format=ieee [PR97653] __floatunditf and __fixtfdi and a couple of other libgcc{.a,_s.so} entrypoints for backwards compatibility should mean IBM double double handling (i.e. IFmode), gcc emits such calls for that format and form IEEE long double emits *kf* instead. When gcc is configured without --with-long-double-format=ieee , everything is fine, but when it is not, we need to compile those libgcc sources with -mno-gnu-attribute -mabi=ibmlongdouble. The following snippet in libgcc/config/rs6000/t-linux was attempting to ensure that, and for some routines it works fine (e.g. for _powitf2). But, due to 4 different types of bugs it doesn't work for most of those functions, which means that in --with-long-double-format=ieee configured gcc those *tf* entrypoints instead handle the long double arguments as if they were KFmode. The bugs are: 1) the first few objs properly use $(objext) as suffix, but several other contain a typo and use $(object) instead, which is a variable that isn't set to anything, so we don't add .o etc. extensions 2) while unsigned fix are properly called _fixuns*, unsigned float are called _floatun* (without s), but the var was using there the extra s and so didn't match 3) the variable didn't cover any of the TF <-> TI conversions, only TF <-> DI conversions 4) nothing in libgcc_s.so was handled, as those object files are called *_s.o rather than *.o and IBM128_SHARED_OBJS used wrong syntax of the GNU make substitution reference, which should be $(var:a=b) standing for $(patsubst a,b,$(var)) but it used $(var:a:b) instead 2021-04-03 Jakub Jelinek PR target/97653 * config/rs6000/t-linux (IBM128_STATIC_OBJS): Fix spelling, use $(objext) instead of $(object). Use _floatunditf instead of _floatunsditf. Add tf <-> ti conversion objects. (IBM128_SHARED_OBJS): Use proper substitution reference syntax. (cherry picked from commit cda41ce0e8414aec59e6b9fbe645d96e6e8193e2) diff --git a/libgcc/config/rs6000/t-linux b/libgcc/config/rs6000/t-linux index 72e9c2770a6..500210ddaf2 100644 --- a/libgcc/config/rs6000/t-linux +++ b/libgcc/config/rs6000/t-linux @@ -11,10 +11,12 @@ HOST_LIBGCC2_CFLAGS += -mno-minimal-toc # the IBM extended double format. Also turn off gnu attributes on the static # modules. IBM128_STATIC_OBJS = ibm-ldouble$(objext) _powitf2$(objext) \ - ppc64-fp$(objext) _divtc3$(object) _multc3$(object) \ - _fixtfdi$(object) _fixunstfdi$(object) \ - _floatditf$(objext) _floatunsditf$(objext) -IBM128_SHARED_OBJS = $(IBM128_STATIC_OBJS:$(objext):_s$(objext)) + ppc64-fp$(objext) _divtc3$(objext) _multc3$(objext) \ + _fixtfdi$(objext) _fixunstfdi$(objext) \ + _floatditf$(objext) _floatunditf$(objext) \ + _fixtfti$(objext) _fixunstfti$(objext) \ + _floattitf$(objext) _floatuntitf$(objext) +IBM128_SHARED_OBJS = $(IBM128_STATIC_OBJS:$(objext)=_s$(objext)) IBM128_OBJS = $(IBM128_STATIC_OBJS) $(IBM128_SHARED_OBJS) IBM128_CFLAGS = -Wno-psabi -mabi=ibmlongdouble -mno-gnu-attribute commit 7a2f91d413eb7a3eb0ba52c7ac9618a35addd12a Author: Jakub Jelinek Date: Sat Apr 3 10:07:09 2021 +0200 dse: Fix up hard reg conflict checking in replace_read [PR99863] Since PR37922 fix RTL DSE has hard register conflict checking in replace_read, so that if the replacement sequence sets (or typically just clobbers) some hard register (usually condition codes) we verify that hard register is not live. Unfortunately, it compares the hard reg set clobbered/set by the sequence (regs_set) against the currently live hard register set, but it then emits the insn sequence not at the current insn position, but before store_insn->insn. So, we should not compare against the current live hard register set, but against the hard register live set at the point of the store insn. Fortunately, we already have that remembered in store_insn->fixed_regs_live. In addition to bootstrapping/regtesting this patch on x86_64-linux and i686-linux, I've also added statistics gathering and it seems the only place where we end up rejecting the replace_read is the newly added testcase (the PR37922 is no longer effective at that) and fixed_regs_live has been always non-NULL at the if (store_insn->fixed_regs_live) spot. Rather than having there an assert, I chose to just keep regs_set as is, which means in that hypothetical case where fixed_regs_live wouldn't be computed for some store we'd still accept sequences that don't clobber/set any hard registers and just punt on those that clobber/set those. 2021-04-03 Jakub Jelinek PR rtl-optimization/99863 * dse.c (replace_read): Drop regs_live argument. Instead of regs_live, use store_insn->fixed_regs_live if non-NULL, otherwise punt if insns sequence clobbers or sets any hard registers. * gcc.target/i386/pr99863.c: New test. (cherry picked from commit 9c7473688e78dc41fd4312a983453df195dd7786) diff --git a/gcc/dse.c b/gcc/dse.c index c8dcf46ed29..68ab4383d50 100644 --- a/gcc/dse.c +++ b/gcc/dse.c @@ -1950,8 +1950,7 @@ get_stored_val (store_info *store_info, machine_mode read_mode, static bool replace_read (store_info *store_info, insn_info_t store_insn, - read_info_t read_info, insn_info_t read_insn, rtx *loc, - bitmap regs_live) + read_info_t read_info, insn_info_t read_insn, rtx *loc) { machine_mode store_mode = GET_MODE (store_info->mem); machine_mode read_mode = GET_MODE (read_info->mem); @@ -2020,7 +2019,8 @@ replace_read (store_info *store_info, insn_info_t store_insn, note_stores (this_insn, look_for_hardregs, regs_set); } - bitmap_and_into (regs_set, regs_live); + if (store_insn->fixed_regs_live) + bitmap_and_into (regs_set, store_insn->fixed_regs_live); if (!bitmap_empty_p (regs_set)) { if (dump_file && (dump_flags & TDF_DETAILS)) @@ -2261,7 +2261,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) offset - store_info->offset, width) && replace_read (store_info, i_ptr, read_info, - insn_info, loc, bb_info->regs_live)) + insn_info, loc)) return; /* The bases are the same, just see if the offsets @@ -2327,8 +2327,7 @@ check_mem_read_rtx (rtx *loc, bb_info_t bb_info) store_info->width) && all_positions_needed_p (store_info, offset - store_info->offset, width) - && replace_read (store_info, i_ptr, read_info, insn_info, loc, - bb_info->regs_live)) + && replace_read (store_info, i_ptr, read_info, insn_info, loc)) return; remove = canon_true_dependence (store_info->mem, diff --git a/gcc/testsuite/gcc.target/i386/pr99863.c b/gcc/testsuite/gcc.target/i386/pr99863.c new file mode 100644 index 00000000000..3d9d405391e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99863.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/99863 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-forwprop -mno-sse2 -Wno-psabi" } */ + +typedef unsigned char __attribute__((__vector_size__ (8))) A; +typedef unsigned char __attribute__((__vector_size__ (32))) B; +typedef unsigned char __attribute__((__vector_size__ (64))) C; +typedef unsigned int __attribute__((__vector_size__ (32))) D; +typedef unsigned int __attribute__((__vector_size__ (64))) E; +typedef unsigned long long F; + +D a; +A b; + +A +foo (E x, F y) +{ + D c = (y <= 0) * a; + x *= (0 < y); + C d = (C) x; + B e = ((union { C a; B b[2];}) d).b[0] + (B) c; + A f = ((union { B a; A b[4];}) e).b[0] + (A) b; + return f; +} + +int +main () +{ + F x = (F) foo ((E) { 3 }, 5); + if (x != 3) + __builtin_abort (); + return 0; +} commit e961da38630c892dfc0723e0726b6a0b0833e951 Author: Jakub Jelinek Date: Thu Apr 8 17:15:39 2021 +0200 c++: Don't cache constexpr functions which are passed pointers to heap or static vars being constructed [PR99859] When cxx_bind_parameters_in_call is called e.g. on a method on an automatic variable, we evaluate the argument and because ADDR_EXPR of an automatic decl is not TREE_CONSTANT, we set *non_constant_args and don't cache it. But when it is called on an object located on the heap (allocated using C++20 constexpr new) where we represent it as TREE_STATIC artificial var, or when it is called on a static var that is currently being constructed, such ADDR_EXPRs are TREE_CONSTANT and we happily cache such calls, but they can in those cases have side-effects in the heap or static var objects and so caching them means such side-effects will happen only once and not as many times as that method or function is called. Furthermore, as Patrick mentioned in the PR, the argument doesn't need to be just ADDR_EXPR of the heap or static var or its components, but it could be a CONSTRUCTOR that has the ADDR_EXPR embedded anywhere. And the incorrectly cached function doesn't need to modify the pointed vars or their components, but some caller could be changing them in between the call that was cached and the call that used the cached result. The following patch fixes it by setting *non_constant_args also when the argument contains somewhere such an ADDR_EXPR, either of a heap artificial var or component thereof, or of a static var currently being constructed (where for that it uses the same check as cxx_eval_store_expression, ctx->global->values.get (...); addresses of other static variables would be rejected by cxx_eval_store_expression and therefore it is ok to cache such calls). 2021-04-08 Jakub Jelinek PR c++/99859 * constexpr.c (addr_of_non_const_var): New function. (cxx_bind_parameters_in_call): Set *non_constant_args to true even if cp_walk_tree on arg with addr_of_non_const_var callback returns true. * g++.dg/cpp1y/constexpr-99859-1.C: New test. * g++.dg/cpp1y/constexpr-99859-2.C: New test. * g++.dg/cpp2a/constexpr-new18.C: New test. * g++.dg/cpp2a/constexpr-new19.C: New test. (cherry picked from commit 559d2f1e0eafd96c19dc5324db1a466286c0e7fc) diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 3611a826013..ed49ecc3535 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -1495,6 +1495,30 @@ free_constructor (tree t) } } +/* Helper function of cxx_bind_parameters_in_call. Return non-NULL + if *TP is address of a static variable (or part of it) currently being + constructed or of a heap artificial variable. */ + +static tree +addr_of_non_const_var (tree *tp, int *walk_subtrees, void *data) +{ + if (TREE_CODE (*tp) == ADDR_EXPR) + if (tree var = get_base_address (TREE_OPERAND (*tp, 0))) + if (VAR_P (var) && TREE_STATIC (var)) + { + if (DECL_NAME (var) == heap_uninit_identifier + || DECL_NAME (var) == heap_identifier) + return var; + + constexpr_global_ctx *global = (constexpr_global_ctx *) data; + if (global->values.get (var)) + return var; + } + if (TYPE_P (*tp)) + *walk_subtrees = false; + return NULL_TREE; +} + /* Subroutine of cxx_eval_call_expression. We are processing a call expression (either CALL_EXPR or AGGR_INIT_EXPR) in the context of CTX. Evaluate @@ -1549,6 +1573,16 @@ cxx_bind_parameters_in_call (const constexpr_ctx *ctx, tree t, arg = adjust_temp_type (type, arg); if (!TREE_CONSTANT (arg)) *non_constant_args = true; + /* If arg is or contains address of a heap artificial variable or + of a static variable being constructed, avoid caching the + function call, as those variables might be modified by the + function, or might be modified by the callers in between + the cached function and just read by the function. */ + else if (!*non_constant_args + && cp_walk_tree (&arg, addr_of_non_const_var, ctx->global, + NULL)) + *non_constant_args = true; + /* For virtual calls, adjust the this argument, so that it is the object on which the method is called, rather than one of its bases. */ diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C new file mode 100644 index 00000000000..dea5a5b56f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-1.C @@ -0,0 +1,24 @@ +// PR c++/99859 +// { dg-do compile { target c++14 } } + +constexpr int +foo (int *x) +{ + return ++*x; +} + +struct S { constexpr S () : a(0) { foo (&a); foo (&a); } int a; }; +constexpr S s = S (); +static_assert (s.a == 2, ""); + +struct R { int *p; }; + +constexpr int +bar (R x) +{ + return ++*x.p; +} + +struct T { int a = 0; constexpr T () { bar (R{&a}); bar (R{&a}); } }; +constexpr T t = T (); +static_assert (t.a == 2, ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C new file mode 100644 index 00000000000..a249f474666 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-99859-2.C @@ -0,0 +1,12 @@ +// PR c++/99859 +// { dg-do compile { target c++14 } } + +struct A +{ + int i; + constexpr int f() { return i; } + constexpr A() : i(0) { i = f(); i = 1; i = f(); } +}; + +constexpr A a = A(); +static_assert (a.i == 1, ""); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C new file mode 100644 index 00000000000..24b298aafd4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new18.C @@ -0,0 +1,45 @@ +// PR c++/99859 +// { dg-do compile { target c++20 } } + +template +struct intrusive_ptr +{ + T *ptr = nullptr; + constexpr explicit intrusive_ptr(T* p) : ptr(p) { + ++ptr->count_; + } + constexpr ~intrusive_ptr() { + if (ptr->dec() == 0) + delete ptr; + } + constexpr intrusive_ptr(intrusive_ptr const& a) : ptr(a.ptr) { + ++ptr->count_; + } +}; + +struct Foo { + int count_ = 0; + constexpr int dec() { + return --count_; + } +}; + +constexpr bool baz() { + Foo f { 4 }; + intrusive_ptr a(&f); + return true; +} +constexpr bool x = baz(); + +constexpr void bar(intrusive_ptr a) +{ + if (a.ptr->count_ != 2) throw 1; +} + +constexpr bool foo() { + intrusive_ptr a(new Foo()); + bar(a); + return true; +} + +static_assert(foo()); diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C new file mode 100644 index 00000000000..7a73deed693 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-new19.C @@ -0,0 +1,43 @@ +// PR c++/99859 +// { dg-do compile { target c++20 } } + +constexpr void +foo (int *x) +{ + ++*x; +} + +constexpr int +bar () +{ + int *x = new int (0); + foo (x); + foo (x); + int y = *x; + delete x; + return y; +} + +static_assert (bar () == 2); + +struct R { int a, *b; }; + +constexpr void +baz (R x) +{ + ++*x.b; +} + +constexpr int +qux () +{ + int *x = new int (0); + R r{1, x}; + baz (r); + baz (r); + int y = *x; + delete x; + return y; +} + +static_assert (qux () == 2); commit e68ac8c2b46997af1464f2549ac520a192c928b1 Author: Jakub Jelinek Date: Sat Apr 10 12:46:09 2021 +0200 rtlanal: Another fix for VOIDmode MEMs [PR98601] This is a sequel to the PR85022 changes, inline-asm can (unfortunately) introduce VOIDmode MEMs and in PR85022 they have been changed so that we don't pretend we know their size (as opposed to assuming they have zero size). This time we ICE in rtx_addr_can_trap_p_1 because it assumes that all memory but BLKmode has known size. The patch just treats VOIDmode MEMs like BLKmode in that regard. And, the STRICT_ALIGNMENT change is needed because VOIDmode has GET_MODE_SIZE of 0 and we don't want to check if something is a multiple of 0. 2021-04-10 Jakub Jelinek PR rtl-optimization/98601 * rtlanal.c (rtx_addr_can_trap_p_1): Allow in assert unknown size not just for BLKmode, but also for VOIDmode. For STRICT_ALIGNMENT unaligned_mems handle VOIDmode like BLKmode. * gcc.dg/torture/pr98601.c: New test. (cherry picked from commit 7a493fcd27d6a1af896c4f5ef4ab1e0afe8a839d) diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c index 0ebde7622db..e65d06d5bca 100644 --- a/gcc/rtlanal.c +++ b/gcc/rtlanal.c @@ -463,12 +463,17 @@ rtx_addr_can_trap_p_1 (const_rtx x, poly_int64 offset, poly_int64 size, machine_mode mode, bool unaligned_mems) { enum rtx_code code = GET_CODE (x); - gcc_checking_assert (mode == BLKmode || known_size_p (size)); + gcc_checking_assert (mode == BLKmode + || mode == VOIDmode + || known_size_p (size)); poly_int64 const_x1; /* The offset must be a multiple of the mode size if we are considering unaligned memory references on strict alignment machines. */ - if (STRICT_ALIGNMENT && unaligned_mems && mode != BLKmode) + if (STRICT_ALIGNMENT + && unaligned_mems + && mode != BLKmode + && mode != VOIDmode) { poly_int64 actual_offset = offset; diff --git a/gcc/testsuite/gcc.dg/torture/pr98601.c b/gcc/testsuite/gcc.dg/torture/pr98601.c new file mode 100644 index 00000000000..ee9d076c02d --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr98601.c @@ -0,0 +1,14 @@ +/* PR rtl-optimization/98601 */ +/* { dg-do compile } */ + +void +foo (void *p) +{ + asm ("" : "=m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */ +} + +void +bar (void *p) +{ + asm volatile ("" : : "m" (*p)); /* { dg-warning "dereferencing 'void \\*' pointer" } */ +} commit 2e57bc7eedb084869d17fe07b538d907b8fee819 Author: Jakub Jelinek Date: Sat Apr 10 12:49:01 2021 +0200 expand: Fix up LTO ICE with COMPOUND_LITERAL_EXPR [PR99849] The gimplifier optimizes away COMPOUND_LITERAL_EXPRs, but they can remain in the form of ADDR_EXPR of COMPOUND_LITERAL_EXPRs in static initializers. By the TREE_STATIC check I meant to check that the underlying decl of the compound literal is a global rather than automatic variable which obviously can't be referenced in static initializers, but unfortunately with LTO it might end up in another partition and thus be DECL_EXTERNAL instead. 2021-04-10 Jakub Jelinek PR lto/99849 * expr.c (expand_expr_addr_expr_1): Test is_global_var rather than just TREE_STATIC on COMPOUND_LITERAL_EXPR_DECLs. * gcc.dg/lto/pr99849_0.c: New test. (cherry picked from commit 22aede7a1228617661105048a91fddd8797e141b) diff --git a/gcc/expr.c b/gcc/expr.c index 991b26f3341..c4bffd0f199 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8050,7 +8050,7 @@ expand_expr_addr_expr_1 (tree exp, rtx target, scalar_int_mode tmode, array with address of COMPOUND_LITERAL_EXPR in DECL_INITIAL; the initializers aren't gimplified. */ if (COMPOUND_LITERAL_EXPR_DECL (exp) - && TREE_STATIC (COMPOUND_LITERAL_EXPR_DECL (exp))) + && is_global_var (COMPOUND_LITERAL_EXPR_DECL (exp))) return expand_expr_addr_expr_1 (COMPOUND_LITERAL_EXPR_DECL (exp), target, tmode, modifier, as); /* FALLTHRU */ diff --git a/gcc/testsuite/gcc.dg/lto/pr99849_0.c b/gcc/testsuite/gcc.dg/lto/pr99849_0.c new file mode 100644 index 00000000000..d489cee0f52 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr99849_0.c @@ -0,0 +1,23 @@ +/* PR lto/99849 */ +/* { dg-lto-do link } */ +/* { dg-require-effective-target fpic } */ +/* { dg-require-effective-target shared } */ +/* { dg-extra-ld-options { -shared } } */ +/* { dg-lto-options { { -flto -flto-partition=1to1 -O2 -Wno-incompatible-pointer-types -Wno-discarded-qualifiers -fPIC } } } */ + +struct { struct A *a; } *b; +struct B { int *b; }; +struct C { int *c; }; +const struct D { struct C d; } d; +struct A { struct { struct C e; }; }; +struct E { void *e; } e = { &( &(const struct D) { (void *) &d })->d }; +struct C f = { &( &(const struct D) { (void *) &d })->d }; +struct A g[] = { &e, &f }; +void foo () { b->a = g; } +struct E h = { foo }; +void bar (); +int baz () { bar (h); } +struct B i = { (int *) baz }; +void qux (); +void corge () { qux (i); } +void *j __attribute__((__used__)) = corge; commit 91e076f3a66c1c9f6aa51e9d53d07803606e3bf1 Author: Jakub Jelinek Date: Sat Apr 10 17:01:54 2021 +0200 c: Avoid clobbering TREE_TYPE (error_mark_node) [PR99990] The following testcase ICEs during error recovery, because finish_decl overwrites TREE_TYPE (error_mark_node), which better should stay always to be error_mark_node. 2021-04-10 Jakub Jelinek PR c/99990 * c-decl.c (finish_decl): Don't overwrite TREE_TYPE of error_mark_node. * gcc.dg/pr99990.c: New test. (cherry picked from commit 9f7d77bd6d65aa1cf2e195d3776052705c6e636b) diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index b3e05be0af8..8e24b522ee4 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -5320,7 +5320,7 @@ finish_decl (tree decl, location_t init_loc, tree init, gcc_unreachable (); } - if (DECL_INITIAL (decl)) + if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node) TREE_TYPE (DECL_INITIAL (decl)) = type; relayout_decl (decl); diff --git a/gcc/testsuite/gcc.dg/pr99990.c b/gcc/testsuite/gcc.dg/pr99990.c new file mode 100644 index 00000000000..6878b00ce0d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99990.c @@ -0,0 +1,12 @@ +/* PR c/99990 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#include + +void +foo () +{ + va_arg (0, long); /* { dg-error "first argument to 'va_arg' not of type 'va_list'" } */ + void *b[] = 0; /* { dg-error "invalid initializer" } */ +} commit 4ac7483ede91fef7cfd548ff6e30e46eeb9d95ae Author: Jakub Jelinek Date: Tue Apr 13 01:00:48 2021 +0200 combine: Don't fold away side-effects in simplify_and_const_int_1 [PR99830] Here is an alternate patch for the PR99830 bug. As discussed on IRC and in the PR, the reason why a (clobber:TI (const_int 0)) has been propagated into the debug insns is that it got optimized away during simplification from the i3 instruction pattern. And that happened because simplify_and_const_int_1 (SImode, varop, 255) with varop of (ashift:SI (subreg:SI (and:TI (clobber:TI (const_int 0 [0])) (const_int 255 [0xff])) 0) (const_int 16 [0x10])) was called and through nonzero_bits determined that (whatever << 16) & 255 is const0_rtx. It is, but if there are side-effects in varop and such clobbers are considered as such, we shouldn't optimize those away. 2021-04-13 Jakub Jelinek PR debug/99830 * combine.c (simplify_and_const_int_1): Don't optimize varop away if it has side-effects. * gcc.dg/pr99830.c: New test. (cherry picked from commit 9c1c8ad8339d551ac91a7af5614f29b9a687189a) diff --git a/gcc/combine.c b/gcc/combine.c index 35505cc5311..d16fb82ce74 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -10170,7 +10170,7 @@ simplify_and_const_int_1 (scalar_int_mode mode, rtx varop, constop &= nonzero; /* If we don't have any bits left, return zero. */ - if (constop == 0) + if (constop == 0 && !side_effects_p (varop)) return const0_rtx; /* If VAROP is a NEG of something known to be zero or 1 and CONSTOP is diff --git a/gcc/testsuite/gcc.dg/pr99830.c b/gcc/testsuite/gcc.dg/pr99830.c new file mode 100644 index 00000000000..75226f5c3a9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr99830.c @@ -0,0 +1,10 @@ +/* PR debug/99830 */ +/* { dg-do compile { target int128 } } */ +/* { dg-options "-O2 -fno-expensive-optimizations -fno-split-wide-types -g" } */ + +int foo (long a, __int128 b, short c, int d, unsigned e, __int128 f) +{ + __builtin_memmove (2 + (char *) &f, foo, 1); + c >>= (char) f; + return c; +} commit c965254e5af9dc68444e0289250c393ae0cd6131 Author: Jakub Jelinek Date: Tue Apr 13 01:01:45 2021 +0200 combine: Fix up expand_compound_operation [PR99905] The following testcase is miscompiled on x86_64-linux. expand_compound_operation is called on (zero_extract:DI (mem/c:TI (reg/f:DI 16 argp) [3 i+0 S16 A128]) (const_int 16 [0x10]) (const_int 63 [0x3f])) so mode is DImode, inner_mode is TImode, pos 63, len 16 and modewidth 64. A couple of lines above the problematic spot we have: if (modewidth >= pos + len) { tem = gen_lowpart (mode, XEXP (x, 0)); where the code uses gen_lowpart and then shift left/right to extract it in mode. But the guarding condition is false - 64 >= 63 + 16 and so we enter the next condition, where the code shifts XEXP (x, 0) right by pos and then adds AND. It does so incorrectly though. Given the modewidth < pos + len, inner_mode must be necessarily larger than mode and XEXP (x, 0) has the innermode, but it was calling simplify_shift_const with mode rather than inner_mode, which meant inconsistent arguments to simplify_shift_const and in this case made a DImode MEM shift out of it. The following patch fixes it, by doing the shift in inner_mode properly and then after the shift doing the lowpart subreg and masking already in mode. 2021-04-13 Jakub Jelinek PR rtl-optimization/99905 * combine.c (expand_compound_operation): If pos + len > modewidth, perform the right shift by pos in inner_mode and then convert to mode, instead of trying to simplify a shift of rtx with inner_mode by pos as if it was a shift in mode. * gcc.target/i386/pr99905.c: New test. (cherry picked from commit ffc4155b6e45b8ab71d49a4b584f7cacb693e6b9) diff --git a/gcc/combine.c b/gcc/combine.c index d16fb82ce74..bc3f5166669 100644 --- a/gcc/combine.c +++ b/gcc/combine.c @@ -7444,11 +7444,15 @@ expand_compound_operation (rtx x) mode, tem, modewidth - len); } else if (unsignedp && len < HOST_BITS_PER_WIDE_INT) - tem = simplify_and_const_int (NULL_RTX, mode, - simplify_shift_const (NULL_RTX, LSHIFTRT, - mode, XEXP (x, 0), - pos), - (HOST_WIDE_INT_1U << len) - 1); + { + tem = simplify_shift_const (NULL_RTX, LSHIFTRT, inner_mode, + XEXP (x, 0), pos); + tem = gen_lowpart (mode, tem); + if (!tem || GET_CODE (tem) == CLOBBER) + return x; + tem = simplify_and_const_int (NULL_RTX, mode, tem, + (HOST_WIDE_INT_1U << len) - 1); + } else /* Any other cases we can't handle. */ return x; diff --git a/gcc/testsuite/gcc.target/i386/pr99905.c b/gcc/testsuite/gcc.target/i386/pr99905.c new file mode 100644 index 00000000000..6d1b2305a76 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr99905.c @@ -0,0 +1,33 @@ +/* PR rtl-optimization/99905 */ +/* { dg-do run { target int128 } } */ +/* { dg-options "-Os -mno-mmx -mno-sse" } */ + +typedef unsigned char U; +typedef unsigned char __attribute__((__vector_size__ (8))) A; +typedef unsigned char __attribute__((__vector_size__ (16))) B; +typedef unsigned char __attribute__((__vector_size__ (32))) C; +typedef unsigned int __attribute__((__vector_size__ (8))) D; +typedef unsigned long long __attribute__((__vector_size__ (8))) E; +typedef unsigned __int128 I; +typedef unsigned long long L; + +D gv; +I gi; + +L __attribute__((__noipa__)) +foo (int ua, int ub, int uc, int ud, E ue, I i) +{ + D d = (U) __builtin_bswap16 (i >> 63) + gv; + B y = ((union { C a; B b[2];}) (C){ }).b[0] + (B) gi; + A z = ((union { B a; A b[2];}) y).b[0] + (A) d; + return (L)z; +} + +int +main () +{ + L x = foo (0, 0, 0, 0, (E) { }, (I) 0x100 << 63); + if (x != 0x100000001) + __builtin_abort (); + return 0; +} commit 06d50ebc9fb2761ed2bdda5e76adb4d47a8ca983 Author: Jakub Jelinek Date: Fri Apr 16 09:32:44 2021 +0200 c++: Fix up handling of structured bindings in extract_locals_r [PR99833] The following testcase ICEs in tsubst_decomp_names because the assumptions that the structured binding artificial var is followed in DECL_CHAIN by the corresponding structured binding vars is violated. I've tracked it to extract_locals* which is done for the constexpr IF_STMT. extract_locals_r when it sees a DECL_EXPR adds that decl into a hash set so that such decls aren't returned from extract_locals*, but in the case of a structured binding that just means the artificial var and not the vars corresponding to structured binding identifiers. The following patch fixes it by pushing not just the artificial var for structured bindings but also the other vars. 2021-04-16 Jakub Jelinek PR c++/99833 * pt.c (extract_locals_r): When handling DECL_EXPR of a structured binding, add to data.internal also all corresponding structured binding decls. * g++.dg/cpp1z/pr99833.C: New test. * g++.dg/cpp2a/pr99833.C: New test. (cherry picked from commit 20eb7a1891cfd7fa85295a236cebe0322d041edd) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index c1752fd1894..1e2dc46641f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -12691,7 +12691,27 @@ extract_locals_r (tree *tp, int */*walk_subtrees*/, void *data_) tp = &TYPE_NAME (*tp); if (TREE_CODE (*tp) == DECL_EXPR) - data.internal.add (DECL_EXPR_DECL (*tp)); + { + tree decl = DECL_EXPR_DECL (*tp); + data.internal.add (decl); + if (VAR_P (decl) + && DECL_DECOMPOSITION_P (decl) + && TREE_TYPE (decl) != error_mark_node) + { + gcc_assert (DECL_NAME (decl) == NULL_TREE); + for (tree decl2 = DECL_CHAIN (decl); + decl2 + && VAR_P (decl2) + && DECL_DECOMPOSITION_P (decl2) + && DECL_NAME (decl2) + && TREE_TYPE (decl2) != error_mark_node; + decl2 = DECL_CHAIN (decl2)) + { + gcc_assert (DECL_DECOMP_BASE (decl2) == decl); + data.internal.add (decl2); + } + } + } else if (tree spec = retrieve_local_specialization (*tp)) { if (data.internal.contains (*tp)) diff --git a/gcc/testsuite/g++.dg/cpp1z/pr99833.C b/gcc/testsuite/g++.dg/cpp1z/pr99833.C new file mode 100644 index 00000000000..f7c995887f8 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/pr99833.C @@ -0,0 +1,11 @@ +// PR c++/99833 +// { dg-do compile { target c++17 } } + +struct S { int a, b; }; +template +void +foo () +{ + [](auto d) { if constexpr (auto [a, b]{d}; sizeof (a) > 0) a++; } (S{}); +} +template void foo (); diff --git a/gcc/testsuite/g++.dg/cpp2a/pr99833.C b/gcc/testsuite/g++.dg/cpp2a/pr99833.C new file mode 100644 index 00000000000..33230535e10 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/pr99833.C @@ -0,0 +1,18 @@ +// PR c++/99833 +// { dg-do compile { target c++20 } } + +#include + +auto f(auto&& x) +{ + [&](auto...) { + auto y = std::tuple{ "what's happening here?", x }; + if constexpr (auto [_, z] = y; requires { z; }) + return; + }(); +} + +int main() +{ + f(42); +} commit 1730b5d6793127b1a47970f44d60da8082bab514 Author: Jakub Jelinek Date: Fri Apr 16 11:44:04 2021 +0200 vectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767] The following testcase ICEs because disabling of DCE means there are dead stmts in the loop (though, in theory they could become dead only shortly before if-conv through some optimization), ifcvt which goes through all stmts in the loop if-converts them into .COND_DIV etc. internal fn calls in the copy of the loop meant for vectorization only, the loop is successfully vectorized but the particular .COND_* call is not because it isn't a live statement and the scalar .COND_* remains in the IL until expansion where it ICEs because these ifns only support vectors and not scalars. These ifns are similar to .MASK_{LOAD,STORE} in this behavior. One possible fix could be to expand scalar versions of them during expansion, basically undoing what if-conv did to create them, i.e. expand them as the lhs = else; if (mask) { lhs = statement; } or so. For .MASK_LOAD we have code to replace them in vect_transform_loop already though (not needed for .MASK_STORE, as stores should be always live and thus always vectorized), so this patch instead replaces .COND_* similarly to .MASK_LOAD in that loop, with the small difference that lhs = .MASK_LOAD (...); is replaced by lhs = 0; while lhs = .COND_* (..., else_arg); is replaced by lhs = else_arg. The statement must be dead, otherwise it would be vectorized, so I think it is not a big deal we don't turn it back into multiple basic blocks etc. (and it might be not possible to do that at that point). 2021-04-16 Jakub Jelinek PR target/99767 * tree-vect-loop.c (vect_transform_loop): Don't remove just dead scalar .MASK_LOAD calls, but also dead .COND_* calls - replace them by their last argument. * gcc.target/aarch64/pr99767.c: New test. (cherry picked from commit b44ab138b7d4aaa5a9ee7956121ffc94777f6a42) diff --git a/gcc/testsuite/gcc.target/aarch64/pr99767.c b/gcc/testsuite/gcc.target/aarch64/pr99767.c new file mode 100644 index 00000000000..5bbfcbdcd69 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr99767.c @@ -0,0 +1,16 @@ +/* PR target/99767 */ +/* { dg-do compile } */ +/* { dg-options " -O1 -fopenmp-simd -fno-tree-dce -march=armv8-a+sve" } */ + +int a[1024], b[1024]; + +void +foo (void) +{ + #pragma omp simd + for (int i = 0; i < 1024; i++) + if (b[i] > 23) { + a[i] = b[i] + 1; + int v = 1 / 0; /* { dg-warning "division by zero" } */ + } +} diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 899b5608745..60d7b74a57e 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -8936,7 +8936,10 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) !gsi_end_p (gsi); gsi_next (&gsi)) { gcall *call = dyn_cast (gsi_stmt (gsi)); - if (call && gimple_call_internal_p (call, IFN_MASK_LOAD)) + if (!call || !gimple_call_internal_p (call)) + continue; + internal_fn ifn = gimple_call_internal_fn (call); + if (ifn == IFN_MASK_LOAD) { tree lhs = gimple_get_lhs (call); if (!VECTOR_TYPE_P (TREE_TYPE (lhs))) @@ -8946,6 +8949,17 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) gsi_replace (&gsi, new_stmt, true); } } + else if (conditional_internal_fn_code (ifn) != ERROR_MARK) + { + tree lhs = gimple_get_lhs (call); + if (!VECTOR_TYPE_P (TREE_TYPE (lhs))) + { + tree else_arg + = gimple_call_arg (call, gimple_call_num_args (call) - 1); + gimple *new_stmt = gimple_build_assign (lhs, else_arg); + gsi_replace (&gsi, new_stmt, true); + } + } } } /* BBs in loop */ commit 31447dcaf15c37e5b9c42b2984f4c8b649fe9b74 Author: Jakub Jelinek Date: Fri Apr 16 17:37:07 2021 +0200 c++: Fix empty base stores in cxx_eval_store_expression [PR100111] In r11-6895 handling of empty bases has been fixed such that non-lval stores of empty classes are not added when the type of *valp doesn't match the type of the initializer, but as this testcase shows it is done only when *valp is non-NULL. If it is NULL, we still shouldn't add empty class constructors if the type of the constructor elt *valp points to doesn't match. 2021-04-16 Jakub Jelinek PR c++/100111 * constexpr.c (cxx_eval_store_expression): Don't add CONSTRUCTORs for empty classes into *valp when types don't match even when *valp is NULL. * g++.dg/cpp0x/constexpr-100111.C: New test. (cherry picked from commit 35e8b38a91d9fb49a4759649576f15e76c129d99) diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index ed49ecc3535..d6fda8b96ee 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -5146,6 +5146,14 @@ cxx_eval_store_expression (const constexpr_ctx *ctx, tree t, CONSTRUCTOR_NO_CLEARING (*valp) = CONSTRUCTOR_NO_CLEARING (init); } + else if (TREE_CODE (init) == CONSTRUCTOR + && !same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (init), + type)) + { + /* See above on initialization of empty bases. */ + gcc_assert (is_empty_class (TREE_TYPE (init)) && !lval); + return init; + } else *valp = init; diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C new file mode 100644 index 00000000000..446d21d03c5 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-100111.C @@ -0,0 +1,7 @@ +// PR c++/100111 +// { dg-do compile { target c++11 } } +// { dg-options "-fno-elide-constructors" } + +struct A {}; +struct B : A { int b; constexpr B (A x) : A(x), b() {} }; +struct C { B c; constexpr C () : c({}) {} } d; commit a11f31102706e33f66b60367d6863613ab3bd051 Author: Jakub Jelinek Date: Fri Apr 16 18:32:27 2021 +0200 intl: Add --enable-host-shared support [PR100096] As mentioned in the PR, building gcc with jit enabled and --enable-host-shared doesn't work on NetBSD/i?86, as libgccjit.so.0 has text relocations. The r0-125846-g459260ecf8b420b029601a664cdb21c185268ecb changes added --enable-host-shared support to various libraries, but didn't add it to intl/ subdirectory; on Linux it isn't really needed, because all: all-no all-no: #nothing but on other OSes intl/libintl.a is built. The following patch makes sure it is built with -fPIC when --enable-host-shared is used. 2021-04-16 Jakub Jelinek PR jit/100096 * configure.ac: Add --enable-host-shared support. * Makefile.in: Update copyright. Add @PICFLAG@ to CFLAGS. * configure: Regenerated. (cherry picked from commit 4a1493f0603262a7dc1114d9827353e9810e63dc) diff --git a/intl/Makefile.in b/intl/Makefile.in index 356c8ab9b65..ec8c648b7a9 100644 --- a/intl/Makefile.in +++ b/intl/Makefile.in @@ -1,5 +1,5 @@ # Makefile for directory with message catalog handling library of GNU gettext -# Copyright (C) 1995-1998, 2000-2003 Free Software Foundation, Inc. +# Copyright (C) 1995-2021 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU Library General Public License as published @@ -45,7 +45,7 @@ RANLIB = @RANLIB@ YACC = @INTLBISON@ -y -d YFLAGS = --name-prefix=__gettext CPPFLAGS = @CPPFLAGS@ -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ @PICFLAG@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ DEFS = -DHAVE_CONFIG_H diff --git a/intl/configure b/intl/configure index d69767b7d21..1e100395369 100755 --- a/intl/configure +++ b/intl/configure @@ -622,6 +622,7 @@ ac_unique_file="gettext.c" ac_header_list= ac_subst_vars='LTLIBOBJS LIBOBJS +PICFLAG BISON3_NO BISON3_YES INCINTL @@ -726,6 +727,7 @@ with_included_gettext with_libintl_prefix with_libintl_type enable_maintainer_mode +enable_host_shared ' ac_precious_vars='build_alias host_alias @@ -1350,6 +1352,7 @@ Optional Features: --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --enable-maintainer-mode enable rules only needed by maintainers + --enable-host-shared build host code as shared libraries Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -6815,6 +6818,15 @@ fi +# Check whether --enable-host-shared was given. +if test "${enable_host_shared+set}" = set; then : + enableval=$enable_host_shared; PICFLAG=-fPIC +else + PICFLAG= +fi + + + ac_config_files="$ac_config_files Makefile config.intl" cat >confcache <<\_ACEOF diff --git a/intl/configure.ac b/intl/configure.ac index 6363e55e68a..72b145958cf 100644 --- a/intl/configure.ac +++ b/intl/configure.ac @@ -69,5 +69,11 @@ fi AC_SUBST(BISON3_YES) AC_SUBST(BISON3_NO) +AC_ARG_ENABLE(host-shared, +[AS_HELP_STRING([--enable-host-shared], + [build host code as shared libraries])], +[PICFLAG=-fPIC], [PICFLAG=]) +AC_SUBST(PICFLAG) + AC_CONFIG_FILES(Makefile config.intl) AC_OUTPUT commit 950bac27d63c1c2ac3a6ed867692d6a13f21feb3 Author: Jakub Jelinek Date: Sat Apr 17 11:27:14 2021 +0200 sanitizer: Fix asan against glibc 2.34 [PR100114] As mentioned in the PR, SIGSTKSZ is no longer a compile time constant in glibc 2.34 and later, so static const uptr kAltStackSize = SIGSTKSZ * 4; needs dynamic initialization, but is used by a function called indirectly from .preinit_array and therefore before the variable is constructed. This results in using 0 size instead and all asan instrumented programs die with: ==91==ERROR: AddressSanitizer failed to allocate 0x0 (0) bytes of SetAlternateSignalStack (error code: 22) Here is a cherry-pick from upstream to fix this. 2021-04-17 Jakub Jelinek PR sanitizer/100114 * sanitizer_common/sanitizer_posix_libcdep.cpp: Cherry-pick llvm-project revisions 82150606fb11d28813ae6da1101f5bda638165fe and b93629dd335ffee2fc4b9b619bf86c3f9e6b0023. (cherry picked from commit d9f462fb372fb02da032cefd6b091d7582c425ae) diff --git a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp index 304b3a01a08..ac88fbe074e 100644 --- a/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp +++ b/libsanitizer/sanitizer_common/sanitizer_posix_libcdep.cpp @@ -169,7 +169,11 @@ bool SupportsColoredOutput(fd_t fd) { #if !SANITIZER_GO // TODO(glider): different tools may require different altstack size. -static const uptr kAltStackSize = SIGSTKSZ * 4; // SIGSTKSZ is not enough. +static uptr GetAltStackSize() { + // SIGSTKSZ is not enough. + static const uptr kAltStackSize = SIGSTKSZ * 4; + return kAltStackSize; +} void SetAlternateSignalStack() { stack_t altstack, oldstack; @@ -180,10 +184,9 @@ void SetAlternateSignalStack() { // TODO(glider): the mapped stack should have the MAP_STACK flag in the // future. It is not required by man 2 sigaltstack now (they're using // malloc()). - void* base = MmapOrDie(kAltStackSize, __func__); - altstack.ss_sp = (char*) base; + altstack.ss_size = GetAltStackSize(); + altstack.ss_sp = (char *)MmapOrDie(altstack.ss_size, __func__); altstack.ss_flags = 0; - altstack.ss_size = kAltStackSize; CHECK_EQ(0, sigaltstack(&altstack, nullptr)); } @@ -191,7 +194,7 @@ void UnsetAlternateSignalStack() { stack_t altstack, oldstack; altstack.ss_sp = nullptr; altstack.ss_flags = SS_DISABLE; - altstack.ss_size = kAltStackSize; // Some sane value required on Darwin. + altstack.ss_size = GetAltStackSize(); // Some sane value required on Darwin. CHECK_EQ(0, sigaltstack(&altstack, &oldstack)); UnmapOrDie(oldstack.ss_sp, oldstack.ss_size); } commit 904cbf6ae2a1e45b3a272365cca19f9dd9a27fa2 Author: Patrick Palka Date: Tue Apr 20 12:06:24 2021 -0400 c++: Fix deduction with reference NTTP [PR83476] In the testcase ref11.C below, during deduction for the call f(a), uses_deducible_template_parms returns false for the dependent specialization A because the generic template argument V here is wrapped in an implicit INDIRECT_REF (formed from template_parm_to_arg). Since uses_deducible_template_parms returns false, unify_one_argument exits early without ever attempting to deduce 'n' for 'V'. This patch fixes this by making deducible_expression look through such implicit INDIRECT_REFs. gcc/cp/ChangeLog: PR c++/83476 PR c++/99885 * pt.c (deducible_expression): Look through implicit INDIRECT_REFs as well. gcc/testsuite/ChangeLog: PR c++/83476 PR c++/99885 * g++.dg/cpp1z/class-deduction85.C: New test. * g++.dg/template/ref11.C: New test. (cherry picked from commit 2ccc05a5141506fde0e20dec702c717fd67bf6ee) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 1e2dc46641f..e7f685d796e 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -21699,8 +21699,10 @@ static bool uses_deducible_template_parms (tree type); static bool deducible_expression (tree expr) { - /* Strip implicit conversions. */ - while (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == VIEW_CONVERT_EXPR) + /* Strip implicit conversions and implicit INDIRECT_REFs. */ + while (CONVERT_EXPR_P (expr) + || TREE_CODE (expr) == VIEW_CONVERT_EXPR + || REFERENCE_REF_P (expr)) expr = TREE_OPERAND (expr, 0); return (TREE_CODE (expr) == TEMPLATE_PARM_INDEX); } diff --git a/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C new file mode 100644 index 00000000000..0b22f8eb982 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1z/class-deduction85.C @@ -0,0 +1,16 @@ +// PR c++/99885 +// { dg-do compile { target c++17 } } + +template +struct Foo {}; + +template +struct Bar { + constexpr auto foo() const -> Foo { + return {}; + } +}; + +constexpr int a = 1; +constexpr Bar bar; +Foo foo = bar.foo(); // <-- CTAD failure diff --git a/gcc/testsuite/g++.dg/template/ref11.C b/gcc/testsuite/g++.dg/template/ref11.C new file mode 100644 index 00000000000..c43c67edf70 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/ref11.C @@ -0,0 +1,9 @@ +// PR c++/83476 + +int n; +template struct A {}; +template void f(A); +int main() { + A a; + f(a); +} commit 2400f81c2c2489f4b6fbb245ef946a39be40defd Author: Patrick Palka Date: Tue Apr 20 12:06:27 2021 -0400 c++: Fix tsubsting CLASS_PLACEHOLDER_TEMPLATE [PR95434] Here, during partial instantiation of the generic lambda, we do tsubst_copy on the CLASS_PLACEHOLDER_TEMPLATE for U{0} which yields a (level-lowered) TEMPLATE_TEMPLATE_PARM rather than the corresponding TEMPLATE_DECL. This later confuses do_class_deduction which expects that a CLASS_PLACEHOLDER_TEMPLATE is always a TEMPLATE_DECL. gcc/cp/ChangeLog: PR c++/95434 * pt.c (tsubst) : If tsubsting CLASS_PLACEHOLDER_TEMPLATE yields a TEMPLATE_TEMPLATE_PARM, adjust to its TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL. gcc/testsuite/ChangeLog: PR c++/95434 * g++.dg/cpp2a/lambda-generic9.C: New test. (cherry picked from commit cafcfcb5840b62d9fc80c12192189351e995a4f2) diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index e7f685d796e..0b2cd0b0a13 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -15515,6 +15515,8 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) else if (tree pl = CLASS_PLACEHOLDER_TEMPLATE (t)) { pl = tsubst_copy (pl, args, complain, in_decl); + if (TREE_CODE (pl) == TEMPLATE_TEMPLATE_PARM) + pl = TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL (pl); CLASS_PLACEHOLDER_TEMPLATE (r) = pl; } } diff --git a/gcc/testsuite/g++.dg/cpp2a/lambda-generic9.C b/gcc/testsuite/g++.dg/cpp2a/lambda-generic9.C new file mode 100644 index 00000000000..043301ba015 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp2a/lambda-generic9.C @@ -0,0 +1,9 @@ +// PR c++/95434 +// { dg-do compile { target c++20 } } + +template +void f() { + []