From patchwork Thu Feb 1 15:36:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1894021 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=KCNq3lMX; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4TQkJ52s7rz23gD for ; Fri, 2 Feb 2024 03:04:52 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8842F384DEE4 for ; Thu, 1 Feb 2024 16:04:44 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 5F8663858C62 for ; Thu, 1 Feb 2024 16:04:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5F8663858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5F8663858C62 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706803451; cv=none; b=Qila8nDA51DOcEx9MLlsL62cIJ4ZQNKdJv5lrqTLupjFW0ti0US58T2wcfvV2T2gCHBgcmS8IHep1Uza3FcoYN/DH2sUvG+0W2t85E8JwVfErutL4LCPqbWsYpIlrsviVW75ANy7GrR8VbnsHgjAHQki82pYyqyERpd93jAvZHs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706803451; c=relaxed/simple; bh=/0Bh8c60iL/qm1Mac8EEW7Ad4tFtLtuBVLkXXclrddk=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=Cg9MvcO2UmB6EtHPbSlOQGnRj5nmbyJiZqJL/roqNqQd78lIo6jsMHsfMo9fE07i9n/PJWzFhGkZUiVmAP0u/nRPRJj9pIEd8LUHq5v5MUXYHvErtfsOZYCtlBxzAKAmo2gMJzdEkXr8Cbgc7wFkLTR6WuiJbJOXntdFa5VoUmw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1706803449; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=G/Yx5rOi/CWKpmzb3t1AIYiP95w37fjsjTcZ6d3Wcj0=; b=KCNq3lMX22tyDqOmU3JodpQpkyd299wKaDQy/2bn38oEd5NXAyTjpJxD6joMkQbkrXzHaw hsB17ih48vApbjDJGSC10N+Fl/7eWZ6/KetKTU05OeN4sZTGQ4tgZBBbdP1gkkUv/8HgNY sXvxR4zVN8sOrv4aw/KiGbcig7Q1oHg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-IvS8yR0MOuiKIyUYuXsIjw-1; Thu, 01 Feb 2024 11:04:05 -0500 X-MC-Unique: IvS8yR0MOuiKIyUYuXsIjw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7898F1C54031; Thu, 1 Feb 2024 16:04:05 +0000 (UTC) Received: from localhost (unknown [10.42.28.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 285411121306; Thu, 1 Feb 2024 16:04:05 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Cc: Hans-Peter Nilsson Subject: [PATCH 1/2] libstdc++: Replace padding bits with a bit-field in __format::_Spec Date: Thu, 1 Feb 2024 15:36:50 +0000 Message-ID: <20240201160400.2143624-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org I plan to push this to trunk soon. CC HP for visibility of the change affecting cris-elf. In practice it shouldn't make any difference to any sensible code. It only affects C++20 mode (and later), and only changes the size of std::formatter objects which are typically only created by the library headers themselves, and only on the stack (when using std::format and other new C++20 APIs related to it). -- >8 -- This ensures that the unused bits will be zero-initialized reliably, and so can be used later by assigning them values in formatter specializations. For example, formatters for std::chrono will need to use an extra bit for a boolean to optimize the conversions between locale encodings and UTF-8. This will result in an ABI change for targets that use 1-byte alignment for all integral types, e.g. cris-elf. We can't do that once C++20 support is non-experimental and ABI stable, so do it now before GCC 14 is released. libstdc++-v3/ChangeLog: * include/std/format (__format::_Spec::_M_reserved): Define a new bit-field member in place of padding bits. --- libstdc++-v3/include/std/format | 1 + 1 file changed, 1 insertion(+) diff --git a/libstdc++-v3/include/std/format b/libstdc++-v3/include/std/format index 0eca8b58bfa..6c958bc11a5 100644 --- a/libstdc++-v3/include/std/format +++ b/libstdc++-v3/include/std/format @@ -406,6 +406,7 @@ namespace __format _WidthPrec _M_width_kind : 2; _WidthPrec _M_prec_kind : 2; _Pres_type _M_type : 4; + unsigned long _M_reserved : 17; unsigned short _M_width; unsigned short _M_prec; char32_t _M_fill = ' ';