C++ PATCH for c++/60364 - noreturn after first decl not diagnosed (v2)
Marek Polacek
polacek@redhat.com
Thu Jun 20 19:12:00 GMT 2019
On Thu, Jun 20, 2019 at 07:57:08PM +0200, Jakub Jelinek wrote:
> On Thu, Jun 20, 2019 at 12:49:13PM -0400, Marek Polacek wrote:
> > Sorry about that. Does this patch work?
> >
> > 2019-06-20 Marek Polacek <polacek@redhat.com>
> >
> > * config/sh/sh.c (sh2a_function_vector_p): Use get_attribute_name.
>
> Just that?
> grep is_attribute_p.*TREE_PURPOSE config/*/*
> config/m32c/m32c.c: if (is_attribute_p ("interrupt", TREE_PURPOSE (list)))
> config/m32c/m32c.c: if (is_attribute_p ("bank_switch", TREE_PURPOSE (list)))
> config/m32c/m32c.c: if (is_attribute_p ("fast_interrupt", TREE_PURPOSE (list)))
> config/m32c/m32c.c: if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
> config/m32c/m32c.c: if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
> config/rl78/rl78.c: if (is_attribute_p ("saddr", TREE_PURPOSE (list)))
> config/sh/sh.c: if (is_attribute_p ("sp_switch", TREE_PURPOSE (attrs))
> config/sh/sh.c: || is_attribute_p ("trap_exit", TREE_PURPOSE (attrs))
> config/sh/sh.c: || is_attribute_p ("nosave_low_regs", TREE_PURPOSE (attrs))
> config/sh/sh.c: || is_attribute_p ("resbank", TREE_PURPOSE (attrs)))
> config/sh/sh.c: if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
> config/sh/sh.c: if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
Here's a bunch of more; I've audited the uses of TREE_PURPOSE in config/*/*.
I haven't tested it or anything, but... ok for trunk?
2019-06-20 Marek Polacek <polacek@redhat.com>
* config/epiphany/epiphany.c (epiphany_compute_function_type): Use
get_attribute_name.
* config/m32c/m32c.c (interrupt_p): Likewise.
(bank_switch_p): Likewise.
(fast_interrupt_p): Likewise.
(m32c_special_page_vector_p): Likewise.
(current_function_special_page_vector): Likewise.
* config/nds32/nds32.c (nds32_asm_function_prologue): Likewise.
* config/rl78/rl78.c (rl78_attrlist_to_encoding): Likewise.
* config/sh/sh.c (sh_insert_attributes): Likewise.
(sh2a_get_function_vector_number): Likewise.
diff --git gcc/config/epiphany/epiphany.c gcc/config/epiphany/epiphany.c
index 657a8886ac7..2cc6c59eae3 100644
--- gcc/config/epiphany/epiphany.c
+++ gcc/config/epiphany/epiphany.c
@@ -1044,7 +1044,7 @@ epiphany_compute_function_type (tree decl)
a;
a = TREE_CHAIN (a))
{
- tree name = TREE_PURPOSE (a);
+ tree name = get_attribute_name (a);
if (name == get_identifier ("interrupt"))
fn_type = EPIPHANY_FUNCTION_INTERRUPT;
diff --git gcc/config/m32c/m32c.c gcc/config/m32c/m32c.c
index 1a0d0c681b4..bda56e3beee 100644
--- gcc/config/m32c/m32c.c
+++ gcc/config/m32c/m32c.c
@@ -2858,7 +2858,7 @@ interrupt_p (tree node ATTRIBUTE_UNUSED)
tree list = M32C_ATTRIBUTES (node);
while (list)
{
- if (is_attribute_p ("interrupt", TREE_PURPOSE (list)))
+ if (is_attribute_p ("interrupt", get_attribute_name (list)))
return 1;
list = TREE_CHAIN (list);
}
@@ -2872,7 +2872,7 @@ bank_switch_p (tree node ATTRIBUTE_UNUSED)
tree list = M32C_ATTRIBUTES (node);
while (list)
{
- if (is_attribute_p ("bank_switch", TREE_PURPOSE (list)))
+ if (is_attribute_p ("bank_switch", get_attribute_name (list)))
return 1;
list = TREE_CHAIN (list);
}
@@ -2886,7 +2886,7 @@ fast_interrupt_p (tree node ATTRIBUTE_UNUSED)
tree list = M32C_ATTRIBUTES (node);
while (list)
{
- if (is_attribute_p ("fast_interrupt", TREE_PURPOSE (list)))
+ if (is_attribute_p ("fast_interrupt", get_attribute_name (list)))
return 1;
list = TREE_CHAIN (list);
}
@@ -2915,7 +2915,7 @@ m32c_special_page_vector_p (tree func)
list = M32C_ATTRIBUTES (func);
while (list)
{
- if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
+ if (is_attribute_p ("function_vector", get_attribute_name (list)))
return 1;
list = TREE_CHAIN (list);
}
@@ -2984,7 +2984,7 @@ current_function_special_page_vector (rtx x)
list = M32C_ATTRIBUTES (t);
while (list)
{
- if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
+ if (is_attribute_p ("function_vector", get_attribute_name (list)))
{
num = TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list)));
return num;
diff --git gcc/config/nds32/nds32.c gcc/config/nds32/nds32.c
index eba98126705..ea532ce1eb3 100644
--- gcc/config/nds32/nds32.c
+++ gcc/config/nds32/nds32.c
@@ -2190,7 +2190,7 @@ nds32_asm_function_prologue (FILE *file)
/* Display all attributes of this function. */
while (attrs)
{
- name = TREE_PURPOSE (attrs);
+ name = get_attribute_name (attrs);
fprintf (file, "%s ", IDENTIFIER_POINTER (name));
/* Pick up the next attribute. */
diff --git gcc/config/rl78/rl78.c gcc/config/rl78/rl78.c
index d2caa118281..067b966b48d 100644
--- gcc/config/rl78/rl78.c
+++ gcc/config/rl78/rl78.c
@@ -4532,7 +4532,7 @@ rl78_attrlist_to_encoding (tree list, tree decl ATTRIBUTE_UNUSED)
{
while (list)
{
- if (is_attribute_p ("saddr", TREE_PURPOSE (list)))
+ if (is_attribute_p ("saddr", get_attribute_name (list)))
return 's';
list = TREE_CHAIN (list);
}
diff --git gcc/config/sh/sh.c gcc/config/sh/sh.c
index dfaeab55142..5354d7960b0 100644
--- gcc/config/sh/sh.c
+++ gcc/config/sh/sh.c
@@ -8360,16 +8360,17 @@ sh_insert_attributes (tree node, tree *attributes)
for (tail = attributes; attrs; attrs = TREE_CHAIN (attrs))
{
- if (is_attribute_p ("sp_switch", TREE_PURPOSE (attrs))
- || is_attribute_p ("trap_exit", TREE_PURPOSE (attrs))
- || is_attribute_p ("nosave_low_regs", TREE_PURPOSE (attrs))
- || is_attribute_p ("resbank", TREE_PURPOSE (attrs)))
+ if (is_attribute_p ("sp_switch", get_attribute_name (attrs))
+ || is_attribute_p ("trap_exit", get_attribute_name (attrs))
+ || is_attribute_p ("nosave_low_regs",
+ get_attribute_name (attrs))
+ || is_attribute_p ("resbank", get_attribute_name (attrs)))
warning (OPT_Wattributes,
"%qE attribute only applies to interrupt functions",
- TREE_PURPOSE (attrs));
+ get_attribute_name (attrs));
else
{
- *tail = tree_cons (TREE_PURPOSE (attrs), NULL_TREE,
+ *tail = tree_cons (get_attribute_name (attrs), NULL_TREE,
NULL_TREE);
tail = &TREE_CHAIN (*tail);
}
@@ -8537,7 +8538,7 @@ sh2a_get_function_vector_number (rtx x)
return 0;
for (tree list = SH_ATTRIBUTES (t); list; list = TREE_CHAIN (list))
- if (is_attribute_p ("function_vector", TREE_PURPOSE (list)))
+ if (is_attribute_p ("function_vector", get_attribute_name (list)))
return TREE_INT_CST_LOW (TREE_VALUE (TREE_VALUE (list)));
return 0;
More information about the Gcc-patches
mailing list