From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout06.t-online.de (mailout06.t-online.de [194.25.134.19]) by sourceware.org (Postfix) with ESMTPS id CF9AA3857721 for ; Fri, 22 Sep 2023 07:21:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF9AA3857721 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=none smtp.mailfrom=t-online.de Received: from fwd74.aul.t-online.de (fwd74.aul.t-online.de [10.223.144.100]) by mailout06.t-online.de (Postfix) with SMTP id C95E616B58 for ; Fri, 22 Sep 2023 09:20:59 +0200 (CEST) Received: from [192.168.2.101] ([91.57.240.81]) by fwd74.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1qjaTA-0gyqxc0; Fri, 22 Sep 2023 09:20:56 +0200 Subject: Re: std::runtime_error on std::locale("") To: cygwin@cygwin.com References: <20230922011204.bb166498090e6cbe163349f3@nifty.ne.jp> <20230922012856.47872090281f2a303fd7b99f@nifty.ne.jp> <0fab8831-c206-14fe-4350-3092e62fca98@Shaw.ca> <07777266-f285-be52-0bff-752419352e85@t-online.de> <20230922130838.ced40a712c8a4de95be6d5a4@nifty.ne.jp> From: Christian Franke Message-ID: Date: Fri, 22 Sep 2023 09:20:54 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.16 MIME-Version: 1.0 In-Reply-To: <20230922130838.ced40a712c8a4de95be6d5a4@nifty.ne.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-TOI-EXPURGATEID: 150726::1695367256-CB7F4366-0AFA0BFC/0/0 CLEAN NORMAL X-TOI-MSGID: 9e093d31-34d6-4ed5-9eb1-253f9aa89e31 X-Spam-Status: No, score=1.5 required=5.0 tests=BAYES_00,FREEMAIL_FROM,KAM_DMARC_STATUS,KAM_LAZY_DOMAIN_SECURITY,KAM_SHORT,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Takashi Yano via Cygwin wrote: > On Thu, 21 Sep 2023 21:06:59 +0200 > Christian Franke wrote: >> ... >> According to libstdc++ source, the internal function >> locale::facet::_S_create_c_locale() calls some __newlocale() which >> apparently does not arrive at newlocale() from cygwin1.dll. But >> cygstdc++-6.dll imports newlocale() from cygwin1.dll. > Thanks for the pointer. I looked into the cygstdc++6.dll source code, > and noticed that the code you mentioned is for glibc. In glibc, > __newlocale() is defined and newlocale() is a weak alias for that. > > For generic libc (i.e. other than glibc), _S_create_c_locale() is > defined as: > > void > locale::facet::_S_create_c_locale(__c_locale& __cloc, const char* __s, > __c_locale) > { > // Currently, the generic model only supports the "C" locale. > // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html > __cloc = 0; > if (strcmp(__s, "C")) > __throw_runtime_error(__N("locale::facet::_S_create_c_locale " > "name not valid")); > } > > in /libstdc++-v3/config/locale/generic/c_locale.cc. Thanks for clarification. Same applies to MinGW-w64 runtime. The reason why cygstdc++-6.dll imports newlocale() and other *locale() from cygwin1.dll are only the C++17 std::from_chars() functions (src/c++17/floating_from_chars.cc). These switch temporarily to "C" locale. MinGW-w64 does not support these. -- Regards, Christian