From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp004.apm-internet.net (smtp004.apm-internet.net [85.119.248.204]) by sourceware.org (Postfix) with ESMTPS id D0C263858D34 for ; Wed, 6 Mar 2024 14:35:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D0C263858D34 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=sandoe.co.uk ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D0C263858D34 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=85.119.248.204 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709735713; cv=none; b=rcSXG+WVVrj4pYSQOvzqImmOx7mMk86ZmZM6EByxmn/rsXOyrO3fcFAG4bVWs4i1FxaqVizw5dI8jodi/kCEiDNGsn4/vGFFCeGwSPzUFkUw5fKGVyt8Bnd/VFkDwhah/Ov+ZJ/gerCDvIRksK2jQNjACP/RP39S3RHZ9gLEhS8= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1709735713; c=relaxed/simple; bh=MEqZZPbuuW+VUy4Gp/xKgXCxUr26Vffcp0wdaV2S7xk=; h=Mime-Version:Subject:From:Date:Message-Id:To; b=g++2rJLfL8+mnWCYF2A0HBzmINA7JzEUwiTVRSupTmLfTIywtiygOrrVGzX0zAHqiOoyqhBP3Ou50Kri+Kq3ExwVHGWYDKmGrYnou2olQ6mbzPPD3S4B6FL5yskyaekmYKQbu9jWQVOy+iTutQdLkfxx/Iyf0LJsX0S7NN0tP9s= ARC-Authentication-Results: i=1; server2.sourceware.org Received: (qmail 35487 invoked from network); 6 Mar 2024 14:35:05 -0000 X-APM-Out-ID: 17097357053547 X-APM-Authkey: 257869/1(257869/1) 7 Received: from unknown (HELO smtpclient.apple) (81.138.1.83) by smtp004.apm-internet.net with SMTP; 6 Mar 2024 14:35:05 -0000 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.8\)) Subject: Re: [PATCH] Include safe-ctype.h after C++ standard headers, to avoid over-poisoning From: Iain Sandoe In-Reply-To: <878r2v1n5o.fsf@gentoo.org> Date: Wed, 6 Mar 2024 14:35:10 +0000 Cc: FX Coudert , GCC Patches , dimitry@andric.com Content-Transfer-Encoding: quoted-printable Message-Id: <06E40B8A-8716-4521-BF5D-F3858174268A@sandoe.co.uk> References: <878r2v1n5o.fsf@gentoo.org> To: Sam James X-Mailer: Apple Mail (2.3696.120.41.1.8) X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,KAM_COUK,KAM_DMARC_STATUS,KAM_SHORT,SPF_HELO_NONE,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 6 Mar 2024, at 13:54, Sam James wrote: >=20 > FX Coudert writes: >=20 >> I would like to patch this patch from September 2023: >> https://gcc.gnu.org/pipermail/gcc-patches/2023-September/631611.html >>=20 >> This bug is now hitting macOS in the latest version of Xcode (it was = originally seen on freebsd). >> I confirm that the patch is restoring bootstrap on = x86_64-apple-darwin23 >=20 > Iain hit an issue with it and I never got a chance to look into how to > fix it. Hmm I recall trying it and finding a problem - was there some different = fix applied in the end? Iain >=20 >>=20 >> OK to push? >> FX >>=20 >>=20 >>=20 >>=20 >>=20 >>> Ref: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D111632 >>>=20 >>> When building gcc's C++ sources against recent libc++, the poisoning = of >>> the ctype macros due to including safe-ctype.h before including C++ >>> standard headers such as , , etc, causes many compilation >>> errors, similar to: >>>=20 >>> In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23: >>> In file included from /home/dim/src/gcc/master/gcc/system.h:233: >>> In file included from /usr/include/c++/v1/vector:321: >>> In file included from >>> /usr/include/c++/v1/__format/formatter_bool.h:20: >>> In file included from >>> /usr/include/c++/v1/__format/formatter_integral.h:32: >>> In file included from /usr/include/c++/v1/locale:202: >>> /usr/include/c++/v1/__locale:546:5: error: '__abi_tag__' attribute >>> only applies to structs, variables, functions, and namespaces >>> 546 | _LIBCPP_INLINE_VISIBILITY >>> | ^ >>> /usr/include/c++/v1/__config:813:37: note: expanded from macro >>> '_LIBCPP_INLINE_VISIBILITY' >>> 813 | # define _LIBCPP_INLINE_VISIBILITY _LIBCPP_HIDE_FROM_ABI >>> | ^ >>> /usr/include/c++/v1/__config:792:26: note: expanded from macro >>> '_LIBCPP_HIDE_FROM_ABI' >>> 792 | >>> __attribute__((__abi_tag__(_LIBCPP_TOSTRING( >>> _LIBCPP_VERSIONED_IDENTIFIER)))) >>> | ^ >>> In file included from /home/dim/src/gcc/master/gcc/gensupport.cc:23: >>> In file included from /home/dim/src/gcc/master/gcc/system.h:233: >>> In file included from /usr/include/c++/v1/vector:321: >>> In file included from >>> /usr/include/c++/v1/__format/formatter_bool.h:20: >>> In file included from >>> /usr/include/c++/v1/__format/formatter_integral.h:32: >>> In file included from /usr/include/c++/v1/locale:202: >>> /usr/include/c++/v1/__locale:547:37: error: expected ';' at end of >>> declaration list >>> 547 | char_type toupper(char_type __c) const >>> | ^ >>> /usr/include/c++/v1/__locale:553:48: error: too many arguments >>> provided to function-like macro invocation >>> 553 | const char_type* toupper(char_type* __low, const >>> char_type* __high) const >>> | ^ >>> /home/dim/src/gcc/master/gcc/../include/safe-ctype.h:146:9: note: >>> macro 'toupper' defined here >>> 146 | #define toupper(c) do_not_use_toupper_with_safe_ctype >>> | ^ >>>=20 >>> This is because libc++ uses different transitive includes than >>> libstdc++, and some of those transitive includes pull in various = ctype >>> declarations (typically via ). >>>=20 >>> There was already a special case for including before >>> safe-ctype.h, so move the rest of the C++ standard header includes = to >>> the same location, to fix the problem. >>>=20