[PATCH] avoid AltiVec keyword vector

Tyler Retzlaff roretzla at linux.microsoft.com
Wed May 4 08:30:07 CEST 2022


On Tue, May 03, 2022 at 05:44:26PM +0200, Thomas Monjalon wrote:
> 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.
> 

+1 please use __vector it is appropriate and the namespace defined for
the implementation. we should make as much effort as possible to avoid
contamination of the application namespace.


More information about the dev mailing list