RFA: Avoid warning for write_predicate_subfunction generated function

Message ID 5B85BD2E.1020204@riscy-ip.com
State New
Headers show
Series
  • RFA: Avoid warning for write_predicate_subfunction generated function
Related show

Commit Message

Joern Wolfgang Rennecke Aug. 28, 2018, 9:22 p.m.
In predicates.md, we have a predicate like this:

(define_special_predicate "esirisc_simd_shift_reg_operand"
  (match_operand 0 "d_register_operand")
{
  /* Earlier revs shifted both halves by the same amount, which is not usable.  */
  return esirisc_rev_option > 10;
})

genpreds generates for that:

static inline int
esirisc_simd_shift_reg_operand_1 (rtx op, machine_mode mode ATTRIBUTE_UNUSED)
#line 300 "../../gcc/trunk/gcc/gcc/config/esirisc/predicates.md"
{
  /* Earlier revs shifted both halves by the same amount, which is not usable.  */
  return esirisc_rev_option > 10;
}

which means that insn-preds.c fails to build when gcc is configured
with --enable-werror-always .

Fixed with the following patch.  Bootstrapped in r263928 on x86_64-pc-linux-gnu.
OK to apply?

2018-08-28  Joern Rennecke  <joern.rennecke@riscy-ip.com>

	* genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED
	to OP parmeter of generated function.

Comments

Richard Sandiford Aug. 28, 2018, 9:48 p.m. | #1
Joern Wolfgang Rennecke <joern.rennecke@riscy-ip.com> writes:
> 2018-08-28  Joern Rennecke  <joern.rennecke@riscy-ip.com>

>

> 	* genpreds.c (write_predicate_subfunction): Also add ATTRIBUTE_UNUSED

> 	to OP parmeter of generated function.


OK, thanks.

Richard

> Index: genpreds.c

> ===================================================================

> --- genpreds.c	(revision 5271)

> +++ genpreds.c	(working copy)

> @@ -152,7 +152,7 @@ write_predicate_subfunction (struct pred

>    p->exp = and_exp;

>  

>    printf ("static inline int\n"

> -	  "%s_1 (rtx op, machine_mode mode ATTRIBUTE_UNUSED)\n",

> +	  "%s_1 (rtx op ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED)\n",

>  	  p->name);

>    rtx_reader_ptr->print_md_ptr_loc (p->c_block);

>    if (p->c_block[0] == '{')

Patch

Index: genpreds.c
===================================================================
--- genpreds.c	(revision 5271)
+++ genpreds.c	(working copy)
@@ -152,7 +152,7 @@  write_predicate_subfunction (struct pred
   p->exp = and_exp;
 
   printf ("static inline int\n"
-	  "%s_1 (rtx op, machine_mode mode ATTRIBUTE_UNUSED)\n",
+	  "%s_1 (rtx op ATTRIBUTE_UNUSED, machine_mode mode ATTRIBUTE_UNUSED)\n",
 	  p->name);
   rtx_reader_ptr->print_md_ptr_loc (p->c_block);
   if (p->c_block[0] == '{')