DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 49VFZtPc3822861
Authentication-Results: delorie.com;
	dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=X7qQUi1B
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 365FF3857022
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1730388954;
	bh=odcX8Djx+ToT8vJTdEAg65VqgcfUJtANsuyqUWmE4IQ=;
	h=Subject:In-Reply-To:Date:Cc:References:To:List-Id:
	 List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe:
	 From:Reply-To:From;
	b=X7qQUi1BHdNkZafcAZ5+xO75vtO1FTunhuABxN6E39SXhdEjZiGAkIzz+sPokaeS3
	 RjVNmxYJ3w6VHksNJW4OXuJ5i0O2NYM4u8buLz0mMpB15KSLPMW9QaJxdNnPNN23OZ
	 /6ANG0kiK3IZ8xKatxLbBnFSg5Mcwn3q3t9Wr0gU=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 15CB3385843B
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 15CB3385843B
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730388903; cv=none;
 b=NRw6e0okwQjnQ4IpDucXM0X/jocSS1fhlHDIc28A5bD58R5kJw8J/RAzCVoMoXwKOmJeJDkkQHD1Ggatwq7S1TXgQ02kvxBsmra+nCHi9u3xjVMVzpSX7Naa8D0A5CgieGuYRNAy0QMRrRBzbFD3QZhNAdjYit2CnqUQVayWOV8=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
 t=1730388903; c=relaxed/simple;
 bh=SYaCpa+2Sgs1KFfVSc4eDESpKjowYPPlUxvHSPEcJUY=;
 h=DKIM-Signature:Mime-Version:Subject:From:Date:Message-Id:To;
 b=rPA9BJQxyNIUW7BQZScx/16AGBw2vAQFAEhopsWsz1dj2VCPDgiPtqk/GMdNZiUl5TgZ64pa9TLwoTDn9N1KwUvoQ2foJbsZFnspBJojWhG2UcMcXvQSmY/UVH30hljrV2GktrHI1sKiRM3tvzhlrgfshxIFx5AOzKgG5b5tYMg=
ARC-Authentication-Results: i=1; server2.sourceware.org
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1730388899; x=1730993699;
 h=to:references:message-id:content-transfer-encoding:cc:date
 :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Qg4IGCU95AocgaESb3yW5nNg7ZI2tr34OsbTQMD8LAg=;
 b=eo6INNv1qX8gBILptwu6R5T3PORWQ4sJYoght/aARajZ4hbdGUIMcH20NC30ablrxq
 mhhMUUDM4GaWqyU7ULQgoT7B191CKwS+Y8ZVnJbJn0FKdma86DDNZeMsVvbOUt3pufz0
 qFoYUKKWCMgjQsDWMId+zoIU796puQrf5ZHIFR4k5vnm9CYDk7NovPjG6vNh7CC/pXhJ
 jmQse5jvFenkIY0xOPaLLUQGzkMGjcPaif8i03OMKuQK233jGsKNnC9dCO6AhLqQiNjM
 WhFGJpqZ3QPws8WzojPxCk9KLYnHYp64bJ/hU4Ch2vstFqR80K7OQr72ABwDER7y5skB
 Tq/w==
X-Gm-Message-State: AOJu0Yzm6l/68Iu0lbay8nvjmltOEY4pf9NnsFqwxWLEHaZt8aVrh/h1
 qg02NByn1glzbmtJmx5v+5zNPwoO2ngntPX66Et+c7TJr1fHxf/X8o1/YalA93vNSQu/cucMFoC
 4NqOB9FVq9PirY8zdJiA0YPmpuD7GlLn1z2DHnImRe4miN+MBVHmsJsbnciyRkc83DFkGgGU5jV
 uQDaHeL4YmENMvlxF/bnK7TtO5P4XuiQYnWbTfLPymiI5eiA==
X-Google-Smtp-Source: AGHT+IEZSSceJuJMRvP1enSj76Pljcm1vRNZhycn4KyQ/199yfpdrHEh9AXoEhZ0991B09FoDP4viA==
X-Received: by 2002:a17:907:97ce:b0:a99:8a5c:a357 with SMTP id
 a640c23a62f3a-a9e657fd8c3mr34324566b.58.1730388898207; 
 Thu, 31 Oct 2024 08:34:58 -0700 (PDT)
Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.700.6.1.9\))
Subject: Re: g++ 12 -std=gnu++20
In-Reply-To: <575d416a-7ee0-4e85-82f2-d97b4cd511da@SystematicSW.ab.ca>
Date: Thu, 31 Oct 2024 16:34:57 +0100
Cc: Brian Inglis <Brian.Inglis@SystematicSW.ab.ca>
Message-Id: <E1BCA6B2-D979-4166-AA22-729D3B5EEFE0@unified-streaming.com>
References: <48e51b50-63db-4b14-b321-46942e40862e@SystematicSW.ab.ca>
 <3805509C-51BA-46F9-95A3-007CE99B014A@unified-streaming.com>
 <764d17ab-a660-4e89-8fd3-175e93f11507@gmail.com>
 <B7BA05FB-75CE-48DE-92ED-267540E59FD0@unified-streaming.com>
 <575d416a-7ee0-4e85-82f2-d97b4cd511da@SystematicSW.ab.ca>
To: cygwin@cygwin.com
X-Mailer: Apple Mail (2.3731.700.6.1.9)
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Dimitry Andric via Cygwin <cygwin@cygwin.com>
Reply-To: Dimitry Andric <dimitry@unified-streaming.com>
Content-Type: text/plain; charset="utf-8"
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 49VFZtPc3822861

On 31 Oct 2024, at 06:40, Brian Inglis via Cygwin <cygwin@cygwin.com> wrote:
> 
> On 2024-10-30 10:30, Dimitry Andric via Cygwin wrote:
>> On 30 Oct 2024, at 17:14, Csaba Ráduly via Cygwin wrote:
>>> On 30/10/2024 17:00, Dimitry Andric via Cygwin wrote:
>>>> #include<string>
>>>> #include<cassert>
>>>> 
>>>> constexpr bool foo()
>>>> {
>>>>   std::string str2{"abcwe"};
>>>>   return str2.size()==5;
>>>> }
>>>> 
>>>> static_assert(foo());
>>>> 
>>>> int main()
>>>> {
>>>>   assert(foo());
>>>> }
>>> 
>>> Seems like _GLIBCXX_USE_CXX11_ABI is not defined by default.
>> Indeed, /usr/lib/gcc/x86_64-pc-cygwin/12/include/c++/x86_64-pc-cygwin/bits/c++config.h shows:
>>    317  # define _GLIBCXX_USE_DUAL_ABI 1
>>    318
>>    319  #if ! _GLIBCXX_USE_DUAL_ABI
>>    320  // Ignore any pre-defined value of _GLIBCXX_USE_CXX11_ABI
>>    321  # undef _GLIBCXX_USE_CXX11_ABI
>>    322  #endif
>>    323
>>    324  #ifndef _GLIBCXX_USE_CXX11_ABI
>>    325  # define _GLIBCXX_USE_CXX11_ABI 0
>>    326  #endif
>>  Also, g++ -v shows --with-default-libstdcxx-abi=gcc4-compatible, so I guess this was deliberate on the part of the packagers. Probably for backwards compatibility reasons?
> 
> Okay, sorry, I typoed an extra _ before _GLIBCXX_NOEXCEPT!
> 
> Cygwin gcc/g++ 13.3 is available as a test package; only with .4/.5 are gcc version features and fixes considered stable.
> 
> The build is requesting -std=gnu++20, so why is 11 ABI relevant?
> 
> As I want to use the latest language, why is gcc 4 compatible ABI *default* relevant?
> 
> What can I do in the package build to get g++ to not use the default but whatever is required to support the latest language?
> 
> Where can I find docs on these symbols and their meanings, uses, and settings?

It is a historical artifact that has been dragged along for years. See https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html for more information.

During the gcc 5.1 release, changes were made to libstdc++ that made the ABI incompatible with previous releases, specifically for std::string. You can define _GLIBCXX_USE_CXX11_ABI to 1 to use the 'new' ABI, but then it becomes tricky to link your code to libraries compiled with older versions of libstdc++, or newer versions that define _GLIBCXX_USE_CXX11_ABI to 0.

I think most Linux distributions have switched fully to the new ABI by now, and dropped support for the old ABI, so they configure their gcc's with _GLIBCXX_USE_CXX11_ABI=1 by default.

-Dimitry


-- 
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

