[PATCH] avoid AltiVec keyword vector
Thomas Monjalon
thomas at monjalon.net
Tue May 3 17:44:26 CEST 2022
03/05/2022 14:30, Bruce Richardson:
> On Tue, May 03, 2022 at 02:03:21PM +0200, Thomas Monjalon wrote:
> > The keyword "vector" may conflict easily.
> > As a rule, it is better to use the alternative keyword "__vector".
I forgot to say that we should #undef vector.
> hi Thomas,
>
> could you perhaps clarify a bit more in the log, I'm not aware of it being
> a keyword generally.
https://www.ibm.com/docs/fr/xl-c-and-cpp-linux/latest?topic=support-vector-types
> What would "vector" conflict with?
> If it's a keyword is it possible to use it as a variable name in these files?
It conflicts with anything named as "vector"
if you include AltiVec header file.
It is especially a problem when using C++ vector type,
that's why the keyword vector is not defined with C++:
https://github.com/gcc-mirror/gcc/blob/master/gcc/config/rs6000/altivec.h#L45
The workaround is to #undef vector after including altivec.h,
or directly in rte_altivec.h (with a compatibility breakage).
In any case we should use only __vector keyword to allow such #undef.
More information about the dev
mailing list