From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 465683858D37; Tue, 3 Jan 2023 16:41:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 465683858D37 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1672764063; bh=Vu58a87HcMZwqrB2A54U9DBlUc0pOzfmt6OB0S3urXg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Ou+FZyhD9q1qU+ni6r07UfBt0PPGKkmnOM1UeDmdztZ3W9fyQzMJV5ZklBbqqYAsK 0d9SKs9xxUMxdf7VY2CCG4LV6y1O1YuNgP19gP0rAf2o2LRCDcwLur9oOEl5EBZu9v Y5lNfdgLueDAm1WpZEIpgJRNgGEecKdb/AWFXDhw= From: "acoplan at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60512] would be useful if gcc implemented __has_feature similary to clang Date: Tue, 03 Jan 2023 16:41:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: acoplan at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: WORKSFORME X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D60512 Alex Coplan changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |acoplan at gcc dot gnu.org --- Comment #9 from Alex Coplan --- (In reply to Jonathan Wakely from comment #6) > (In reply to Manuel L=C3=B3pez-Ib=C3=A1=C3=B1ez from comment #5) > > AFAIU, it will be welcome if someone implements it. >=20 > I see no need to add __has_feature given that it contradicts the > recommendations of the C++ committee, and that GCC already defines the > recommended feature test macros that can be used without __has_feature. I think it's worth noting that __has_feature can be used to check for more = than just C++ language features. To quote the clang documentation (https://clang.llvm.org/docs/LanguageExtensions.html): > Another use of __has_feature is to check for compiler features not relate= d to the language standard, such as e.g. AddressSanitizer. LLVM users can check whether ASan is enabled using __has_feature(address_sanitizer). Similarly one can query e.g. __has_feature(thread_sanitizer). I think it would be good for the alignment between GCC and LLVM if GCC were= to implement this extension.=