c-parser.c (c_parser_has_attribute_expression): New function.
authorMartin Sebor <msebor@redhat.com>
Wed, 21 Nov 2018 02:50:02 +0000 (02:50 +0000)
committerMartin Sebor <msebor@gcc.gnu.org>
Wed, 21 Nov 2018 02:50:02 +0000 (19:50 -0700)
commit98f08eb8939735c1e9cbc1ec5cadebe79e935c90
tree9fb2084c7e170349abee1d8f950047936556b98a
parent48d1f31d1b7131e8f809ede8256e4f1eb6c5c3ae
c-parser.c (c_parser_has_attribute_expression): New function.

gcc/c/ChangeLog:

* c-parser.c (c_parser_has_attribute_expression): New function.
(c_parser_attribute): New function.
(c_parser_attributes): Move code into c_parser_attribute.
(c_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.

gcc/c-family/ChangeLog:

* c-attribs.c (type_for_vector_size): New function.
(type_valid_for_vector_size): Same.
(handle_vector_size_attribute): Move code to the functions above
and call them.
(validate_attribute, has_attribute): New functions.
* c-common.h (has_attribute): Declare.
(rid): Add RID_HAS_ATTRIBUTE_EXPRESSION.
* c-common.c (c_common_resword): Same.

gcc/cp/ChangeLog:

* cp-tree.h (cp_check_const_attributes): Declare.
* decl2.c (cp_check_const_attributes): Declare extern.
* parser.c (cp_parser_has_attribute_expression): New function.
(cp_parser_unary_expression): Handle RID_HAS_ATTRIBUTE_EXPRESSION.
(cp_parser_gnu_attribute_list): Add argument.

gcc/ChangeLog:

* doc/extend.texi (Other Builtins): Add __builtin_has_attribute.

gcc/testsuite/ChangeLog:

* c-c++-common/builtin-has-attribute-2.c: New test.
* c-c++-common/builtin-has-attribute-3.c: New test.
* c-c++-common/builtin-has-attribute-4.c: New test.
* c-c++-common/builtin-has-attribute.c: New test.
* gcc.dg/builtin-has-attribute.c: New test.
* gcc/testsuite/gcc.target/i386/builtin-has-attribute.c: New test.

From-SVN: r266335
19 files changed:
gcc/ChangeLog
gcc/c-family/ChangeLog
gcc/c-family/c-attribs.c
gcc/c-family/c-common.c
gcc/c-family/c-common.h
gcc/c/ChangeLog
gcc/c/c-parser.c
gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/decl2.c
gcc/cp/parser.c
gcc/doc/extend.texi
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/builtin-has-attribute-2.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/builtin-has-attribute-3.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/builtin-has-attribute-4.c [new file with mode: 0644]
gcc/testsuite/c-c++-common/builtin-has-attribute.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/builtin-has-attribute.c [new file with mode: 0644]
gcc/testsuite/gcc.target/i386/builtin-has-attribute.c [new file with mode: 0644]