[PATCH 1/8] rs6000: More factoring of overload processing
Segher Boessenkool
segher@kernel.crashing.org
Fri Jan 28 19:11:10 GMT 2022
On Fri, Jan 28, 2022 at 11:50:19AM -0600, Bill Schmidt wrote:
> This patch continues the refactoring started with r12-6014.
ab3f5b71dc6e
> + and the generic code will issue the appropriate error message. Skip
> + this test for functions where we don't fully describe all the possible
> + overload signatures in rs6000-overload.def (because they aren't relevant
> + to the expansion here). If we don't, we get confusing error messages. */
> + if (fcode != RS6000_OVLD_VEC_PROMOTE
> + && fcode != RS6000_OVLD_VEC_SPLATS
> + && fcode != RS6000_OVLD_VEC_EXTRACT
> + && fcode != RS6000_OVLD_VEC_INSERT
> + && fcode != RS6000_OVLD_VEC_STEP
> + && (!VOID_TYPE_P (TREE_VALUE (fnargs)) || n < nargs))
> return NULL;
Can you expand a bit on this, give an example for example? It is very
hard to understand this code, the way it depends on code following many
lines later.
> + default:
> + ;
Don't.
I like this better than a BS break statement, but it is just as stupid.
If you need this, you don't want a switch statement, but some number of
if statements. You cannot use a switch as a shorthand for this because
we have a silly warning and -Werror for this use.
You probably get easier to understand code that way, too, you can get
rid of the above (just do some early returns), etc.
Segher
More information about the Gcc-patches
mailing list