This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- From: Andreas Schwab <schwab at suse dot de>
- To: Stefan Kristiansson <stefan dot kristiansson at saunalahti dot fi>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 10 Jul 2013 09:18:53 +0200
- Subject: Re: [PATCH] Fix illegal cast to rtx (*insn_gen_fn) (rtx, ...)
- References: <20130710011456 dot GA25947 at chokladfabriken dot org>
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."