public inbox for libstdc++-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r13-3553] libstdc++: Make placeholders inline when inline variables are available
Date: Fri, 28 Oct 2022 23:56:03 +0000 (GMT)	[thread overview]
Message-ID: <20221028235603.B6C4A385829F@sourceware.org> (raw)

https://gcc.gnu.org/g:b80f25a3360b6850662eaea2039b255fbfbeea31

commit r13-3553-gb80f25a3360b6850662eaea2039b255fbfbeea31
Author: Arsen Arsenović <arsen@aarsen.me>
Date:   Thu Oct 20 16:58:53 2022 +0200

    libstdc++: Make placeholders inline when inline variables are available
    
    This slightly lowers the dependency of generated code on libstdc++.so.
    
    libstdc++-v3/ChangeLog:
    
            * include/std/functional: Make placeholders inline, if possible.

Diff:
---
 libstdc++-v3/include/std/functional | 66 +++++++++++++++++++++----------------
 1 file changed, 37 insertions(+), 29 deletions(-)

diff --git a/libstdc++-v3/include/std/functional b/libstdc++-v3/include/std/functional
index d22acaa3cb8..b396e8dbbdc 100644
--- a/libstdc++-v3/include/std/functional
+++ b/libstdc++-v3/include/std/functional
@@ -285,35 +285,43 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
    * simplify this with variadic templates, because we're introducing
    * unique names for each.
    */
-    extern const _Placeholder<1> _1;
-    extern const _Placeholder<2> _2;
-    extern const _Placeholder<3> _3;
-    extern const _Placeholder<4> _4;
-    extern const _Placeholder<5> _5;
-    extern const _Placeholder<6> _6;
-    extern const _Placeholder<7> _7;
-    extern const _Placeholder<8> _8;
-    extern const _Placeholder<9> _9;
-    extern const _Placeholder<10> _10;
-    extern const _Placeholder<11> _11;
-    extern const _Placeholder<12> _12;
-    extern const _Placeholder<13> _13;
-    extern const _Placeholder<14> _14;
-    extern const _Placeholder<15> _15;
-    extern const _Placeholder<16> _16;
-    extern const _Placeholder<17> _17;
-    extern const _Placeholder<18> _18;
-    extern const _Placeholder<19> _19;
-    extern const _Placeholder<20> _20;
-    extern const _Placeholder<21> _21;
-    extern const _Placeholder<22> _22;
-    extern const _Placeholder<23> _23;
-    extern const _Placeholder<24> _24;
-    extern const _Placeholder<25> _25;
-    extern const _Placeholder<26> _26;
-    extern const _Placeholder<27> _27;
-    extern const _Placeholder<28> _28;
-    extern const _Placeholder<29> _29;
+#if __cpp_inline_variables
+#  define _GLIBCXX_PLACEHOLDER inline
+#else
+#  define _GLIBCXX_PLACEHOLDER extern
+#endif
+
+    _GLIBCXX_PLACEHOLDER const _Placeholder<1> _1;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<2> _2;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<3> _3;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<4> _4;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<5> _5;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<6> _6;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<7> _7;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<8> _8;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<9> _9;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<10> _10;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<11> _11;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<12> _12;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<13> _13;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<14> _14;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<15> _15;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<16> _16;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<17> _17;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<18> _18;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<19> _19;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<20> _20;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<21> _21;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<22> _22;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<23> _23;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<24> _24;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<25> _25;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<26> _26;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<27> _27;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<28> _28;
+    _GLIBCXX_PLACEHOLDER const _Placeholder<29> _29;
+
+#undef _GLIBCXX_PLACEHOLDER
   }
 
   /**

                 reply	other threads:[~2022-10-28 23:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221028235603.B6C4A385829F@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@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).