From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from esa2.mentor.iphmx.com (esa2.mentor.iphmx.com [68.232.141.98]) by sourceware.org (Postfix) with ESMTPS id BFA893858D32 for ; Mon, 12 Jun 2023 21:51:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org BFA893858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=codesourcery.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com X-IronPort-AV: E=Sophos;i="6.00,236,1681200000"; d="scan'208";a="9612584" Received: from orw-gwy-02-in.mentorg.com ([192.94.38.167]) by esa2.mentor.iphmx.com with ESMTP; 12 Jun 2023 13:51:06 -0800 IronPort-SDR: ygpVpjV1rNa5GYyjWQUv7ePfOYFveDxi9yVP7rokLGesYxaIli05CPrjj0BHVHI3v074badSqB egvy44cxunwGJB8PbhaJwyut9OCnW9Hp/nzMiNzbjQCaEPZYqDeqQnkrXWZ21TIZewIqltBP0C NTnYGoOWH8BEBxckIWOKJpk9ROp161K0120iI5X6sFn/xfspzNXBk/mSFWELhPUhS2xxWGMPTd PZhWxRDc0CADMtTmTvF7MA0yMDaEF0cCpwz2JAwBuxNM91GQ9YrstfhifEqDpszwb5TXpOPGKY jOs= Date: Mon, 12 Jun 2023 21:51:02 +0000 From: Joseph Myers To: Jakub Jelinek CC: Marek Polacek , Subject: Re: [RFC] Add stdckdint.h header for C23 In-Reply-To: Message-ID: <68578b43-939-1879-9676-2ea55249a2c5@codesourcery.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" X-Originating-IP: [137.202.0.90] X-ClientProxiedBy: svr-ies-mbx-14.mgc.mentorg.com (139.181.222.14) To svr-ies-mbx-10.mgc.mentorg.com (139.181.222.10) X-Spam-Status: No, score=-3105.9 required=5.0 tests=BAYES_00,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,KAM_NUMSUBJECT,SPF_HELO_PASS,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, 10 Jun 2023, Jakub Jelinek via Gcc-patches wrote: > I have looked at gnulib stdckdint.h and they are full of workarounds > for various compilers, EDG doesn't do this, clang <= 14 can't multiply > __int128, ..., so I think the header belongs into the compiler rather > than C library, because it would be a nightmare to maintain it there. While C2x only has type-generic macros in this header, there's a proposal N2868 (which didn't get consensus for C2x but may come back for a future standard version) for additional interfaces for structure types with a sticky overflow flag, including some functions that are expected to be defined with external linkage as usual for library functions. So if that gets adopted in future, we'd need to arrange to provide those library functions with external linkage - which is mostly not something we do in GCC, although there are a few atomic_* functions in libatomic in addition to the __atomic_* functions underlying type-generic macros. > What I'm struggling with is enforcing the weird restrictions > C23 imposes on these. It's not clear all those restrictions need to be enforced - this definitely seems like a case of undefined behavior to provide useful extension space, where for various of those restrictions there are unique sensible semantics to provide if the types in question are supported. -- Joseph S. Myers joseph@codesourcery.com