delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2023/09/22/03:21:40

X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D11FF3857737
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1695367298;
bh=v3fC14d0FWd4r+WbgCqy2GSCJmUaBbI+HjK1CYWECG4=;
h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe:
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
From;
b=ei1mSCt6qTEOeXJuOLD9CynnPImSpXYpu7tnuXddomExh/D0TnplliuwPU6UHRaM1
5UEdW1QWhwDmOMzTtAVuhWnHWKl59WouYJYdxW1WXoDPapQt4efbqmqaYVwzw7bICL
V17pInHMzeuobeU97gs3+dk4If/TITbIAMsRryBs=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF9AA3857721
Subject: Re: std::runtime_error on std::locale("")
To: cygwin AT cygwin DOT com
References: <20230922011204 DOT bb166498090e6cbe163349f3 AT nifty DOT ne DOT jp>
<20230922012856 DOT 47872090281f2a303fd7b99f AT nifty DOT ne DOT jp>
<0fab8831-c206-14fe-4350-3092e62fca98 AT Shaw DOT ca>
<07777266-f285-be52-0bff-752419352e85 AT t-online DOT de>
<20230922130838 DOT ced40a712c8a4de95be6d5a4 AT nifty DOT ne DOT jp>
Message-ID: <c9d90b5c-5aad-97d1-8559-0a7686f29a7f@t-online.de>
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>
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
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Christian Franke via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Christian Franke <Christian DOT Franke AT t-online DOT de>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

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


-- 
Problem reports:      https://cygwin.com/problems.html
FAQ:                  https://cygwin.com/faq/
Documentation:        https://cygwin.com/docs.html
Unsubscribe info:     https://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019