aboutsummaryrefslogtreecommitdiff
path: root/libcpp/include
diff options
context:
space:
mode:
authorMartin Sebor <msebor@redhat.com>2019-10-28 22:46:28 +0000
committerMartin Sebor <msebor@gcc.gnu.org>2019-10-28 16:46:28 -0600
commitad1539d5555a161cf6851de8995641d6dfe792d9 (patch)
treee56e9d15ba5ff4476a38e5269c6163b5dc6a36e9 /libcpp/include
parent48b2123f6336ba6c06846d7c8b60bd14eaeae7ec (diff)
downloadgcc-ad1539d5555a161cf6851de8995641d6dfe792d9.zip
gcc-ad1539d5555a161cf6851de8995641d6dfe792d9.tar.gz
gcc-ad1539d5555a161cf6851de8995641d6dfe792d9.tar.bz2
PR c/66970 - Add __has_builtin() macro
gcc/ChangeLog: PR c/66970 * doc/cpp.texi (__has_builtin): Document. * doc/extend.texi (__builtin_frob_return_addr): Correct spelling. gcc/c/ChangeLog: PR c/66970 * c-decl.c (names_builtin_p): Define a new function. gcc/c-family/ChangeLog: PR c/66970 * c-common.c (c_common_nodes_and_builtins): Call c_define_builtins even when only preprocessing. * c-common.h (names_builtin_p): Declare new function. * c-lex.c (init_c_lex): Set has_builtin. (c_common_has_builtin): Define a new function. * c-ppoutput.c (init_pp_output): Set has_builtin. gcc/cp/ChangeLog: PR c/66970 * cp-objcp-common.c (names_builtin_p): Define new function. gcc/testsuite/ChangeLog: PR c/66970 * c-c++-common/cpp/has-builtin-2.c: New test. * c-c++-common/cpp/has-builtin-3.c: New test. * c-c++-common/cpp/has-builtin.c: New test. From-SVN: r277544
Diffstat (limited to 'libcpp/include')
-rw-r--r--libcpp/include/cpplib.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/libcpp/include/cpplib.h b/libcpp/include/cpplib.h
index 224369b..c655d3f 100644
--- a/libcpp/include/cpplib.h
+++ b/libcpp/include/cpplib.h
@@ -676,6 +676,9 @@ struct cpp_callbacks
/* Callback to identify whether an attribute exists. */
int (*has_attribute) (cpp_reader *);
+ /* Callback to determine whether a built-in function is recognized. */
+ int (*has_builtin) (cpp_reader *);
+
/* Callback that can change a user lazy into normal macro. */
void (*user_lazy_macro) (cpp_reader *, cpp_macro *, unsigned);
@@ -855,7 +858,8 @@ enum cpp_builtin_type
BT_PRAGMA, /* `_Pragma' operator */
BT_TIMESTAMP, /* `__TIMESTAMP__' */
BT_COUNTER, /* `__COUNTER__' */
- BT_HAS_ATTRIBUTE /* `__has_attribute__(x)' */
+ BT_HAS_ATTRIBUTE, /* `__has_attribute__(x)' */
+ BT_HAS_BUILTIN /* `__has_builtin(x)' */
};
#define CPP_HASHNODE(HNODE) ((cpp_hashnode *) (HNODE))