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
This commit is contained in:
Martin Sebor 2019-10-28 22:46:28 +00:00 committed by Martin Sebor
parent 48b2123f63
commit ad1539d555
20 changed files with 616 additions and 8 deletions

View file

@ -568,6 +568,10 @@ _cpp_builtin_macro_text (cpp_reader *pfile, cpp_hashnode *node,
case BT_HAS_ATTRIBUTE:
number = pfile->cb.has_attribute (pfile);
break;
case BT_HAS_BUILTIN:
number = pfile->cb.has_builtin (pfile);
break;
}
if (result == NULL)