This is incomplete, and untested, but covers some of the cases
where an attribute's value's TREE_CODE is tested (e.g. via STRING_CST).

Alternatively, maybe we need a helper function for extracting
the value (and location_t) of an attribute, issuing an error if it's
not a STRING_CST?

gcc/ChangeLog:
        * config/arc/arc.c (arc_handle_interrupt_attribute): Handle
        location wrapper.
        * config/epiphany/epiphany.c
        (epiphany_handle_interrupt_attribute): Likewise.
        (epiphany_handle_forwarder_attribute): Likewise.
        * config/ia64/ia64.c (ia64_handle_model_attribute): Likewise.
        * config/m32r/m32r.c (m32r_handle_model_attribute): Likewise.
        * config/mips/mips.c (mips_handle_interrupt_attr): Likewise.
        (mips_handle_use_shadow_register_set_attr): Likewise.
        * config/msp430/msp430.c (msp430_attr): Likewise.
        * config/s390/s390.c (s390_handle_hotpatch_attribute): Likewise.
---
 gcc/config/arc/arc.c           | 2 ++
 gcc/config/epiphany/epiphany.c | 3 +++
 gcc/config/ia64/ia64.c         | 1 +
 gcc/config/m32r/m32r.c         | 2 ++
 gcc/config/mips/mips.c         | 2 ++
 gcc/config/msp430/msp430.c     | 2 +-
 gcc/config/s390/s390.c         | 2 ++
 7 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 7be9f7c..d84c2ab 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -1922,6 +1922,8 @@ arc_handle_interrupt_attribute (tree *, tree name, tree 
args, int,
 
   tree value = TREE_VALUE (args);
 
+  STRIP_ANY_LOCATION_WRAPPER (value);
+
   if (TREE_CODE (value) != STRING_CST)
     {
       warning (OPT_Wattributes,
diff --git a/gcc/config/epiphany/epiphany.c b/gcc/config/epiphany/epiphany.c
index 26b0f3c..ac64d1f 100644
--- a/gcc/config/epiphany/epiphany.c
+++ b/gcc/config/epiphany/epiphany.c
@@ -496,6 +496,7 @@ epiphany_handle_interrupt_attribute (tree *node, tree name, 
tree args,
     }
 
   value = TREE_VALUE (args);
+  STRIP_ANY_LOCATION_WRAPPER (value);
 
   if (TREE_CODE (value) != STRING_CST)
     {
@@ -537,6 +538,8 @@ epiphany_handle_forwarder_attribute (tree *node 
ATTRIBUTE_UNUSED,
 
   value = TREE_VALUE (args);
 
+  STRIP_ANY_LOCATION_WRAPPER (value);
+
   if (TREE_CODE (value) != STRING_CST)
     {
       warning (OPT_Wattributes,
diff --git a/gcc/config/ia64/ia64.c b/gcc/config/ia64/ia64.c
index 84a5b56..ae7f1f1 100644
--- a/gcc/config/ia64/ia64.c
+++ b/gcc/config/ia64/ia64.c
@@ -742,6 +742,7 @@ ia64_handle_model_attribute (tree *node, tree name, tree 
args,
 
   init_idents ();
   arg = TREE_VALUE (args);
+  STRIP_ANY_LOCATION_WRAPPER (arg);
   if (arg == small_ident1 || arg == small_ident2)
     {
       addr_area = ADDR_AREA_SMALL;
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index f104457..f12a8e9 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -399,6 +399,8 @@ m32r_handle_model_attribute (tree *node ATTRIBUTE_UNUSED, 
tree name,
   init_idents ();
   arg = TREE_VALUE (args);
 
+  STRIP_ANY_LOCATION_WRAPPER (arg);
+
   if (arg != small_ident1
       && arg != small_ident2
       && arg != medium_ident1
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 7dde705..2b9f68a 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -1474,6 +1474,7 @@ mips_handle_interrupt_attr (tree *node ATTRIBUTE_UNUSED, 
tree name, tree args,
       tree cst;
 
       cst = TREE_VALUE (args);
+      STRIP_ANY_LOCATION_WRAPPER (cst);
       if (TREE_CODE (cst) != STRING_CST)
        {
          warning (OPT_Wattributes,
@@ -1528,6 +1529,7 @@ mips_handle_use_shadow_register_set_attr (tree *node 
ATTRIBUTE_UNUSED,
       tree cst;
 
       cst = TREE_VALUE (args);
+      STRIP_ANY_LOCATION_WRAPPER (cst);
       if (TREE_CODE (cst) != STRING_CST)
        {
          warning (OPT_Wattributes,
diff --git a/gcc/config/msp430/msp430.c b/gcc/config/msp430/msp430.c
index 0ee0b6c..ea40628 100644
--- a/gcc/config/msp430/msp430.c
+++ b/gcc/config/msp430/msp430.c
@@ -1867,7 +1867,7 @@ msp430_attr (tree * node,
       gcc_assert (TREE_NAME_EQ (name, ATTR_INTR));
 
       tree value = TREE_VALUE (args);
-
+      STRIP_ANY_LOCATION_WRAPPER (value);
       switch (TREE_CODE (value))
        {
        case STRING_CST:
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index 4e08955..2d511b3 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -1110,6 +1110,8 @@ s390_handle_hotpatch_attribute (tree *node, tree name, 
tree args,
     {
       expr = TREE_VALUE (args);
       expr2 = TREE_VALUE (TREE_CHAIN (args));
+      STRIP_ANY_LOCATION_WRAPPER (expr);
+      STRIP_ANY_LOCATION_WRAPPER (expr2);
     }
   if (args == NULL || TREE_CHAIN (args) == NULL)
     err = 1;
-- 
1.8.5.3

Reply via email to