From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 6185A3858C2C for ; Tue, 17 May 2022 21:33:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6185A3858C2C Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-127-9pHW4Z-SN82ly5tRPm_t4w-1; Tue, 17 May 2022 17:33:49 -0400 X-MC-Unique: 9pHW4Z-SN82ly5tRPm_t4w-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71D511C05EA6; Tue, 17 May 2022 21:33:49 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA7C7C15D7D; Tue, 17 May 2022 21:33:47 +0000 (UTC) From: Florian Weimer To: Adhemerval Zanella via Libc-alpha Cc: Joseph Myers , Adhemerval Zanella , Tom Honermann Subject: Re: [PATCH 2/3]: C++20 P0482R6 and C2X N2653: Implement mbrtoc8, c8rtomb, char8_t References: <57610f50-dd95-fd32-1102-5f1cda440891@honermann.net> <7c7e07a6-ebf0-71bc-cdc4-2f563b0e3b0f@linaro.org> Date: Tue, 17 May 2022 23:33:45 +0200 In-Reply-To: <7c7e07a6-ebf0-71bc-cdc4-2f563b0e3b0f@linaro.org> (Adhemerval Zanella via Libc-alpha's message of "Tue, 17 May 2022 15:17:52 -0300") Message-ID: <87h75ng7ye.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 17 May 2022 21:33:52 -0000 * Adhemerval Zanella via Libc-alpha: > On 17/05/2022 15:12, Joseph Myers wrote: >> On Tue, 17 May 2022, Adhemerval Zanella wrote: >>=20 >>>> +/* This is the private state used if PS is NULL. */ >>>> +static mbstate_t state; >>> >>> Although it was done for other convertion interfaces, I wonder if we sh= ould >>> keep supporting this mt-unsafe usage for newer ones. It was not clear = from=20 >>=20 >> In C23 it's implementation-defined whether the internal state for such= =20 >> functions has static or thread storage duration (see the general=20 >> introduction to the uchar.h functions). >>=20 > > Right, so glibc still need to support either mode. No, I think we can and should switch. Maybe with new symbol versions (but the same implementation) if we want to play it conservative. The intent in POSIX and C has been for a long time that thread-local state is permitted for these functions, only the wording did not technically allow it. The phrase was =E2=80=9Cnot required to avoid data races=E2=80=9D. The problem is that it's possible to tell the difference without data races (with external synchronization). Many libcs already use thread-local state for these functions, without any apparent ill effects. Thanks, Florian