[PATCH][RFC] Canonize names of attributes.

Martin Liška mliska@suse.cz
Tue Jun 13 12:32:00 GMT 2017


Hello.

After some discussions with Richi, I would like to propose patch that will
come up with a canonical name of attribute names. That means __attribute__((__abi_tag__))
will be given 'abi_tag' as IDENTIFIER_NAME of the attribute. The change can improve
attribute name lookup and we can delete all the ugly code that compares strlen(i1)
== strlen(i2) + 4, etc.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests (w/ default
languages). I'm currently testing objc, obj-c++ and go.

Ready to be installed?
Martin


gcc/cp/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* parser.c (cp_parser_gnu_attribute_list): Canonize attribute
	names.
	(cp_parser_std_attribute): Likewise.

gcc/go/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* go-gcc.cc (Gcc_backend::function): Use no_split_stack
	instead of __no_split_stack__.

gcc/c/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* c-parser.c (c_parser_attributes): Canonize attribute names.

gcc/c-family/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* c-format.c (cmp_attribs): Simplify comparison of attributes.
	* c-lex.c (c_common_has_attribute): Canonize attribute names.

gcc/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* tree.c (cmp_attrib_identifiers): Simplify comparison of attributes.
	(private_is_attribute_p): Likewise.
	(private_lookup_attribute): Likewise.
	(private_lookup_attribute_by_prefix): Likewise.
	(remove_attribute): Likewise.
	(canonize_attr_name): New function.
	* tree.h: Declared here.

gcc/testsuite/ChangeLog:

2017-06-09  Martin Liska  <mliska@suse.cz>

	* g++.dg/cpp0x/pr65558.C: Change expected warning.
	* gcc.dg/parm-impl-decl-1.c: Likewise.
	* gcc.dg/parm-impl-decl-3.c: Likewise.
---
 gcc/c-family/c-format.c                 |  13 ++--
 gcc/c-family/c-lex.c                    |   1 +
 gcc/c/c-parser.c                        |   9 +++
 gcc/cp/parser.c                         |  11 +++-
 gcc/go/go-gcc.cc                        |   2 +-
 gcc/testsuite/g++.dg/cpp0x/pr65558.C    |   2 +-
 gcc/testsuite/gcc.dg/parm-impl-decl-1.c |   2 +-
 gcc/testsuite/gcc.dg/parm-impl-decl-3.c |   2 +-
 gcc/tree.c                              | 108 +++++++++++---------------------
 gcc/tree.h                              |   4 ++
 10 files changed, 69 insertions(+), 85 deletions(-)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Canonize-names-of-attributes.patch
Type: text/x-patch
Size: 12371 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170613/ed0bf8d3/attachment.bin>


More information about the Gcc-patches mailing list