This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)


Stefan Kristiansson <stefan.kristiansson@saunalahti.fi> writes:

> @@ -291,14 +290,41 @@
>      const char *const *multi;
>      insn_output_fn function;
>    } output;
> +  union {
> +    rtx (*argc0)	(void);
> +    rtx (*argc1)	(rtx);
> +    rtx (*argc2)	(rtx, rtx);
> +    rtx (*argc3)	(rtx, rtx, rtx);
> +    rtx (*argc4)	(rtx, rtx, rtx, rtx);
> +    rtx (*argc5)	(rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc6)	(rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc7)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc8)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc9)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc10)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc11)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +  } genfun;
>  #else
>    struct {
>      const char *single;
>      const char *const *multi;
>      insn_output_fn function;
>    } output;
> +  struct {
> +    rtx (*argc0)	(void);
> +    rtx (*argc1)	(rtx);
> +    rtx (*argc2)	(rtx, rtx);
> +    rtx (*argc3)	(rtx, rtx, rtx);
> +    rtx (*argc4)	(rtx, rtx, rtx, rtx);
> +    rtx (*argc5)	(rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc6)	(rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc7)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc8)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc9)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc10)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +    rtx (*argc11)	(rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx, rtx);
> +  } genfun;

I don't think there is a need to conditionalize this on
HAVE_DESIGNATED_UNION_INITIALIZERS.  All function pointers are alike, so
it should be good enough to cast on assignment and use the right
alternative on call.

Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]