From patchwork Wed Oct 2 19:37:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 1992149 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=hoeEGj6R; 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 4XJlTJ66Jxz1xtY for ; Thu, 3 Oct 2024 05:37:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id AF1FE3858D35 for ; Wed, 2 Oct 2024 19:37:54 +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.129.124]) by sourceware.org (Postfix) with ESMTP id 584603858C50 for ; Wed, 2 Oct 2024 19:37:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 584603858C50 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 584603858C50 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727897852; cv=none; b=IX2NMOHe6i/UIFLLHhjazyDm//6vw5xWTUAB5fwnMwybb7qF+uY+oNZhxqkBB4LuO+Je66YYjqMfAxyVv4FNPCY1VIDedSUo5pSa01XCr7qRa3xziw/AIT7VMXRiUkvuXgObBUw5LfxWKzy/7FOEkJ7lwPTKsTSgAPUb9tqcRec= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727897852; c=relaxed/simple; bh=0zNswCOPdPoavmn5uACGYL7mGjNx2gR+zQuZu7H1/FY=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=u+1+cc0VE2hT3npQ+UrXZKVD9J8MZpx+bZEZYKhpHa7Acx60kCbQjZmyzNRRE4A1Bjcla4bPMCRFI4vmhyg2KqIV+nWzmnZfFfCuxonOkK2bgesZwsmXlZij9qoXE6qutBlksQpiZgWsYmYIz97+W5l+YRBELQggTdhgJyCpcjQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1727897851; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Rj12CcnMEa3L3NQRku0z/OP1QHpzxVAUDT9TE/7+SU8=; b=hoeEGj6Ru37D2uGKJFyjCYg4v708D0b7908jlsBul0l+3ewwcdDfhAATPolQGSLbqihboz GqX8eiiCYa4cqH8Ia9tEg6eNvAtYYJ0W1ispumskpEMAe0a13fP5GGUMB2HhKckAYBwMyo YUTheFbSGr7bYsFbBsptRC4NudbIMtM= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-45-AyhtfDP3MDCxUsvCphH-Vw-1; Wed, 02 Oct 2024 15:37:27 -0400 X-MC-Unique: AyhtfDP3MDCxUsvCphH-Vw-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id BD0E51955EAD; Wed, 2 Oct 2024 19:37:25 +0000 (UTC) Received: from localhost (unknown [10.42.28.136]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 39C7419560AD; Wed, 2 Oct 2024 19:37:25 +0000 (UTC) From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH] libstdc++: Tweak %c formatting for chrono types Date: Wed, 2 Oct 2024 20:37:06 +0100 Message-ID: <20241002193724.3359839-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.0 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_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=unavailable 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 Tested x86_64-linux. -- >8 -- libstdc++-v3/ChangeLog: * include/bits/chrono_io.h (__formatter_chrono::_M_c): Add [[unlikely]] attribute to condition for missing %c format in locale. Use %T instead of %H:%M:%S in fallback. --- libstdc++-v3/include/bits/chrono_io.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/bits/chrono_io.h b/libstdc++-v3/include/bits/chrono_io.h index a337007266e..652e88ffe3a 100644 --- a/libstdc++-v3/include/bits/chrono_io.h +++ b/libstdc++-v3/include/bits/chrono_io.h @@ -899,8 +899,8 @@ namespace __format const _CharT* __formats[2]; __tp._M_date_time_formats(__formats); const _CharT* __rep = __formats[__mod]; - if (!*__rep) - __rep = _GLIBCXX_WIDEN("%a %b %e %H:%M:%S %Y"); + if (!*__rep) [[unlikely]] + __rep = _GLIBCXX_WIDEN("%a %b %e %T %Y"); basic_string<_CharT> __fmt(_S_empty_spec); __fmt.insert(1u, 1u, _S_colon); __fmt.insert(2u, __rep);