From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: [committed 2/3] libstdc++: Remove incorrect static specifiers
Date: Sat, 23 May 2020 09:43:09 +0100 [thread overview]
Message-ID: <20200523084309.GS2678@redhat.com> (raw)
In-Reply-To: <20200523084043.GQ2678@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 639 bytes --]
These functions were originally static members of the path class, but
the 'static' specifiers were not removed when they were moved to
namespace scope. This causes ODR violations when the functions are
called from functions defined in the header, which is incompatible with
Nathan's modules branch. Change them to 'inline' instead.
* include/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Remove unintentional static specifiers.
* include/experimental/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Likewise.
Tested powerpc64le-linux, committed to master.
[-- Attachment #2: patch.txt --]
[-- Type: text/x-patch, Size: 3810 bytes --]
commit 00c8f2a5e3a21d93a03182cacbae4badc02a37f1
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Sat May 23 09:00:16 2020 +0100
libstdc++: Remove incorrect static specifiers
These functions were originally static members of the path class, but
the 'static' specifiers were not removed when they were moved to
namespace scope. This causes ODR violations when the functions are
called from functions defined in the header, which is incompatible with
Nathan's modules branch. Change them to 'inline' instead.
* include/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Remove unintentional static specifiers.
* include/experimental/bits/fs_path.h (__detail::_S_range_begin)
(__detail::_S_range_end): Likewise.
diff --git a/libstdc++-v3/include/bits/fs_path.h b/libstdc++-v3/include/bits/fs_path.h
index 5a998284a99..818b5918927 100644
--- a/libstdc++-v3/include/bits/fs_path.h
+++ b/libstdc++-v3/include/bits/fs_path.h
@@ -156,32 +156,32 @@ namespace __detail
using _Path2 = enable_if_t<__is_path_iter_src<_Tr>::value, path>;
template<typename _Source>
- static _Source
+ _Source
_S_range_begin(_Source __begin) { return __begin; }
struct __null_terminated { };
template<typename _Source>
- static __null_terminated
+ __null_terminated
_S_range_end(_Source) { return {}; }
template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
+ inline const _CharT*
_S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
+ inline const _CharT*
_S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data() + __str.size(); }
template<typename _CharT, typename _Traits>
- static const _CharT*
+ inline const _CharT*
_S_range_begin(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits>
- static const _CharT*
+ inline const _CharT*
_S_range_end(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data() + __str.size(); }
diff --git a/libstdc++-v3/include/experimental/bits/fs_path.h b/libstdc++-v3/include/experimental/bits/fs_path.h
index d7234c08a00..69b823a3466 100644
--- a/libstdc++-v3/include/experimental/bits/fs_path.h
+++ b/libstdc++-v3/include/experimental/bits/fs_path.h
@@ -137,33 +137,33 @@ namespace __detail
path>::type;
template<typename _Source>
- static _Source
+ inline _Source
_S_range_begin(_Source __begin) { return __begin; }
struct __null_terminated { };
template<typename _Source>
- static __null_terminated
+ inline __null_terminated
_S_range_end(_Source) { return {}; }
template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
+ inline const _CharT*
_S_range_begin(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits, typename _Alloc>
- static const _CharT*
+ inline const _CharT*
_S_range_end(const basic_string<_CharT, _Traits, _Alloc>& __str)
{ return __str.data() + __str.size(); }
#if __cplusplus >= 201402L
template<typename _CharT, typename _Traits>
- static const _CharT*
+ inline const _CharT*
_S_range_begin(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data(); }
template<typename _CharT, typename _Traits>
- static const _CharT*
+ inline const _CharT*
_S_range_end(const basic_string_view<_CharT, _Traits>& __str)
{ return __str.data() + __str.size(); }
#endif
next prev parent reply other threads:[~2020-05-23 8:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-23 8:40 [committed 0/3] libstdc++: Refactor filesystem::path string conversions Jonathan Wakely
2020-05-23 8:42 ` [committed 1/3] libstdc++: Simplify filesystem::path SFINAE constraints Jonathan Wakely
2020-05-23 8:43 ` Jonathan Wakely [this message]
2020-05-23 8:44 ` [committed 3/3] libstdc++: Refactor filesystem::path string conversions Jonathan Wakely
2020-06-01 23:14 ` Jonathan Wakely
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200523084309.GS2678@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).