From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by sourceware.org (Postfix) with ESMTPS id 587D23858435 for ; Sat, 28 Aug 2021 11:24:49 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 587D23858435 Received: by mail-wr1-x429.google.com with SMTP id n5so14450930wro.12 for ; Sat, 28 Aug 2021 04:24:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=CgrcYb6P+M6+9/hkaNRZUcdJhQFxUK+m1/XCmXRCKqc=; b=IHTjaM6FGKLw7/svbZUIfo+JNdt+crJjLtOMQB8EIMb67JbBmk1xgJxltxBKRVNiMm VNtYhiGipmfawZwmLlOOA9Fzb6WnUSt31tJEPKzH43nWu2m5fHlFiZFaPUlcExiEhFRJ Q2dHIVGbMsDO4nY8I0pT9JuWBi3KZdP/8zUMvtTTzQTwo9n+qZGnhEDVC+m3RfynfzlD BiGwZRjKzI1MUwrEi1btecl6B3V0PH9fjXVU4QLn/Hu7MRX+veaAxaxGCb0BpB4WZtcS 6S+Pxb7Uup4IN7DZbrLnuF4mJA6NVHqZh8rNc2/rOT4DGxH007VKCpjfoObr11jdIw6a O0DQ== X-Gm-Message-State: AOAM531KfrCww93Y8FGFtZghqcxA0rzOjmcs9jgSI71jRi051EYTmi3T f4UuhOzjsadb9eRm3/I0FHbaJ9Mlib95uKIVxmiA3TxMfUE= X-Google-Smtp-Source: ABdhPJwZfT9iEkqZS+JaiX8A2zMUar1eVPT3INrJobuM45rEc0/AaofKvYcEoMl/UqLKAb1ZIszmhCBj6ZVNKnywWaQ= X-Received: by 2002:adf:e745:: with SMTP id c5mr15094281wrn.321.1630149888278; Sat, 28 Aug 2021 04:24:48 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Jonathan Wakely Date: Sat, 28 Aug 2021 12:24:37 +0100 Message-ID: Subject: Re: RFC: Drop C++98 support for versioned namespace (i.e. unstable ABI mode) To: "libstdc++" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 28 Aug 2021 11:24:50 -0000 On Sat, 28 Aug 2021 at 11:48, Jonathan Wakely wrote: > > Not something I plan to work on in the near future, but an idea worth sharing. > > Before anybody panics, this does not affect the default configuration. > C++98 will still be supported. I'm only talking about the unstable ABI > build mode chosen when installing GCC, by > --enable-symvers=gnu-versioned-namespace. If you don't know what that > is, this RFC isn't something you need to worry about. > > Currently there are some places where we can't define constructors, > assignment operators and destructors as defaulted, because it would > create an ABI incompatibility between C++98 (which can't use defaulted > members) and later standards. > > That means that even for the unstable ABI (versioned namespace) > configuration, we are constrained by backwards compatibility (but > compat with older standards, not older GCC releases). > > If we dropped C++98 support for the versioned namespace, it would open > up additional opportunities for improvements to the versioned > namespace mode. > > As a specific example, std::allocator currently has a user-provided, > non-trivial default constructor. We can't define it as =default > because that doesn't work in C++98, and would make it trivial in > C++11, but still user-provided (and non-trivial) in C++98. We can't > make that change for the ABI stable mode anyway, because it would be > incompatible with older GCC releases. But we could do it for the > versioned namespace if we stopped supporting C++98. Maybe a more compelling example is that we could use [[__no_unique_address__]] in _Rb_tree_compare to reduce the size of std::map and std::set by alignof(void*) for the common case, see PR 102015. We can't do that because std::set and std::map need to compile as C++98, and so can't use [[foo]] attributes, and there's no __attribute__((__no_unique_address__)) alternative. So there's an obvious improvement that would reduce object size from 48 bytes to 40 bytes, but we can't even do it for the ABI unstable mode because of C++98 support. I think anybody using the "I don't care about ABI compatibility, give me the most optimized libstdc++ possible" mode but also expecting C++98 support should reconsider their poor life choices.