Clean up attribute value comparison in lto-symtab.c.

Message ID cf102b12-ea2a-fd33-ddb1-76600ad51ecd@suse.cz
State New
Headers show
Series
  • Clean up attribute value comparison in lto-symtab.c.
Related show

Commit Message

Martin Liška April 11, 2018, 9:26 a.m.
Hi.

This is a small clean-up which Jakub suggested.

Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Ready to be installed?
Martin


gcc/lto/ChangeLog:

2018-04-11  Martin Liska  <mliska@suse.cz>

	* lto-symtab.c (lto_symtab_merge_p): Use attribute_value_equal
	function.
---
 gcc/lto/lto-symtab.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Jakub Jelinek April 11, 2018, 9:31 a.m. | #1
On Wed, Apr 11, 2018 at 11:26:26AM +0200, Martin Liška wrote:
> This is a small clean-up which Jakub suggested.
> 
> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
> 
> Ready to be installed?
> Martin
> 
> 
> gcc/lto/ChangeLog:
> 
> 2018-04-11  Martin Liska  <mliska@suse.cz>
> 
> 	* lto-symtab.c (lto_symtab_merge_p): Use attribute_value_equal
> 	function.

Ok, thanks.

	Jakub

Patch

diff --git a/gcc/lto/lto-symtab.c b/gcc/lto/lto-symtab.c
index 37c4f45eb0b..2660542300e 100644
--- a/gcc/lto/lto-symtab.c
+++ b/gcc/lto/lto-symtab.c
@@ -580,9 +580,7 @@  lto_symtab_merge_p (tree prevailing, tree decl)
       tree prev_attr = lookup_attribute ("error", DECL_ATTRIBUTES (prevailing));
       tree attr = lookup_attribute ("error", DECL_ATTRIBUTES (decl));
       if ((prev_attr == NULL) != (attr == NULL)
-	  || (prev_attr
-	      && TREE_VALUE (TREE_VALUE (prev_attr))
-		 != TREE_VALUE (TREE_VALUE (attr))))
+	  || (prev_attr && !attribute_value_equal (prev_attr, attr)))
 	{
           if (symtab->dump_file)
 	    fprintf (symtab->dump_file, "Not merging decls; "
@@ -593,9 +591,7 @@  lto_symtab_merge_p (tree prevailing, tree decl)
       prev_attr = lookup_attribute ("warning", DECL_ATTRIBUTES (prevailing));
       attr = lookup_attribute ("warning", DECL_ATTRIBUTES (decl));
       if ((prev_attr == NULL) != (attr == NULL)
-	  || (prev_attr
-	      && TREE_VALUE (TREE_VALUE (prev_attr))
-		 != TREE_VALUE (TREE_VALUE (attr))))
+	  || (prev_attr && !attribute_value_equal (prev_attr, attr)))
 	{
           if (symtab->dump_file)
 	    fprintf (symtab->dump_file, "Not merging decls; "