public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-10116] libstdc++: Tweak source_location for clang trunk [PR105128]
@ 2022-07-07 23:32 Jonathan Wakely
  0 siblings, 0 replies; only message in thread
From: Jonathan Wakely @ 2022-07-07 23:32 UTC (permalink / raw)
  To: gcc-cvs, libstdc++-cvs

https://gcc.gnu.org/g:16946c7c823c2d6531ac272d31d68d95d9c30ddd

commit r11-10116-g16946c7c823c2d6531ac272d31d68d95d9c30ddd
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 2 12:49:38 2022 +0200

    libstdc++: Tweak source_location for clang trunk [PR105128]
    
    Apparently clang trunk implemented __builtin_source_location(), but the
    using __builtin_ret_type = decltype(__builtin_source_location());
    which has been added for it isn't enough, they also need the
    std::source_location::__impl class to be defined (but incomplete seems
    to be good enough) before the builtin is used.
    
    The following has been tested on godbolt with clang trunk (old version
    fails with
    error: 'std::source_location::__impl' was not found; it must be defined before '__builtin_source_location' is called
    and some follow-up errors), getting back to just void * instead of
    __builtin_ret_type and commenting out using doesn't work either and
    just struct __impl; before using __builtin_ret_type doesn't work too.
    
    2022-04-02  Jakub Jelinek  <jakub@redhat.com>
    
            PR libstdc++/105128
            * include/std/source_location (std::source_location::__impl): Move
            definition before using __builtin_ret_type.
    
    (cherry picked from commit 2a82301d409d3aa0e0b3b884e4c6daeaa0486d6b)

Diff:
---
 libstdc++-v3/include/std/source_location | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/libstdc++-v3/include/std/source_location b/libstdc++-v3/include/std/source_location
index 0a101c3df11..647ca0b9e3d 100644
--- a/libstdc++-v3/include/std/source_location
+++ b/libstdc++-v3/include/std/source_location
@@ -43,6 +43,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   {
   private:
     using uint_least32_t = __UINT_LEAST32_TYPE__;
+    struct __impl
+    {
+      const char* _M_file_name;
+      const char* _M_function_name;
+      unsigned _M_line;
+      unsigned _M_column;
+    };
     using __builtin_ret_type = decltype(__builtin_source_location());
 
   public:
@@ -76,14 +83,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     { return _M_impl ? _M_impl->_M_function_name : ""; }
 
   private:
-    struct __impl
-    {
-      const char* _M_file_name;
-      const char* _M_function_name;
-      unsigned _M_line;
-      unsigned _M_column;
-    };
-
     const __impl* _M_impl = nullptr;
   };


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

only message in thread, other threads:[~2022-07-07 23:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-07 23:32 [gcc r11-10116] libstdc++: Tweak source_location for clang trunk [PR105128] Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).