public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60512] would be useful if gcc implemented __has_feature similarly to clang Date: Mon, 27 Nov 2023 10:46:26 +0000 [thread overview] Message-ID: <bug-60512-4-wXSE7W7dZp@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-60512-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60512 --- Comment #22 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Alex Coplan <acoplan@gcc.gnu.org>: https://gcc.gnu.org/g:06280a906cb3dc80cf5e07cf3335b758848d488d commit r14-5873-g06280a906cb3dc80cf5e07cf3335b758848d488d Author: Alex Coplan <alex.coplan@arm.com> Date: Fri Mar 17 16:30:51 2023 +0000 c-family: Implement __has_feature and __has_extension [PR60512] This patch implements clang's __has_feature and __has_extension in GCC. Currently the patch aims to implement all documented features (and some undocumented ones) following the documentation at https://clang.llvm.org/docs/LanguageExtensions.html with the exception of the legacy features for C++ type traits. These are omitted, since as the clang documentation notes, __has_builtin is the correct "modern" way to query for these (which GCC already implements). gcc/c-family/ChangeLog: PR c++/60512 * c-common.cc (struct hf_feature_info): New. (c_common_register_feature): New. (init_has_feature): New. (has_feature_p): New. * c-common.h (c_common_has_feature): New. (c_family_register_lang_features): New. (c_common_register_feature): New. (has_feature_p): New. * c-lex.cc (init_c_lex): Plumb through has_feature callback. (c_common_has_builtin): Generalize and move common part ... (c_common_lex_availability_macro): ... here. (c_common_has_feature): New. * c-ppoutput.cc (init_pp_output): Plumb through has_feature. gcc/c/ChangeLog: PR c++/60512 * c-lang.cc (c_family_register_lang_features): New. * c-objc-common.cc (struct c_feature_info): New. (c_register_features): New. * c-objc-common.h (c_register_features): New. gcc/cp/ChangeLog: PR c++/60512 * cp-lang.cc (c_family_register_lang_features): New. * cp-objcp-common.cc (struct cp_feature_selector): New. (cp_feature_selector::has_feature): New. (struct cp_feature_info): New. (cp_register_features): New. * cp-objcp-common.h (cp_register_features): New. gcc/ChangeLog: PR c++/60512 * doc/cpp.texi: Document __has_{feature,extension}. gcc/objc/ChangeLog: PR c++/60512 * objc-act.cc (struct objc_feature_info): New. (objc_nonfragile_abi_p): New. (objc_common_register_features): New. * objc-act.h (objc_common_register_features): New. * objc-lang.cc (c_family_register_lang_features): New. gcc/objcp/ChangeLog: PR c++/60512 * objcp-lang.cc (c_family_register_lang_features): New. libcpp/ChangeLog: PR c++/60512 * include/cpplib.h (struct cpp_callbacks): Add has_feature. (enum cpp_builtin_type): Add BT_HAS_{FEATURE,EXTENSION}. * init.cc: Add __has_{feature,extension}. * macro.cc (_cpp_builtin_macro_text): Handle BT_HAS_{FEATURE,EXTENSION}. gcc/testsuite/ChangeLog: PR c++/60512 * c-c++-common/has-feature-common.c: New test. * c-c++-common/has-feature-pedantic.c: New test. * g++.dg/ext/has-feature.C: New test. * gcc.dg/asan/has-feature-asan.c: New test. * gcc.dg/has-feature.c: New test. * gcc.dg/ubsan/has-feature-ubsan.c: New test. * obj-c++.dg/has-feature.mm: New test. * objc.dg/has-feature.m: New test. Co-Authored-By: Iain Sandoe <iain@sandoe.co.uk>
next prev parent reply other threads:[~2023-11-27 10:46 UTC|newest] Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-03-12 19:24 [Bug c++/60512] New: would be useful if gcc implemented __has_feature similary " eteran at alum dot rit.edu 2014-03-12 19:35 ` [Bug c++/60512] " glisse at gcc dot gnu.org 2014-03-12 19:36 ` pinskia at gcc dot gnu.org 2014-03-12 19:52 ` eteran at alum dot rit.edu 2014-03-12 20:16 ` glisse at gcc dot gnu.org 2023-01-03 16:41 ` acoplan at gcc dot gnu.org 2023-01-04 11:40 ` redi at gcc dot gnu.org 2023-01-06 14:50 ` jrtc27 at jrtc27 dot com 2023-02-02 16:43 ` jason at gcc dot gnu.org 2023-04-11 16:39 ` acoplan at gcc dot gnu.org 2023-05-05 16:31 ` acoplan at gcc dot gnu.org 2023-05-05 18:03 ` iains at gcc dot gnu.org 2023-05-05 18:19 ` iains at gcc dot gnu.org 2023-05-05 20:26 ` iains at gcc dot gnu.org 2023-05-09 10:37 ` [Bug c++/60512] would be useful if gcc implemented __has_feature similarly " acoplan at gcc dot gnu.org 2023-05-09 10:57 ` iains at gcc dot gnu.org 2023-05-09 11:13 ` iains at gcc dot gnu.org 2023-05-09 12:14 ` acoplan at gcc dot gnu.org 2023-11-27 10:46 ` cvs-commit at gcc dot gnu.org [this message] 2023-11-27 11:08 ` acoplan at gcc dot gnu.org 2023-12-11 21:53 ` egallager at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-60512-4-wXSE7W7dZp@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).