views:

140

answers:

2

Does the Eclipse CDT C++ editor have a means of supporting the Altivec C++ language extensions, as implemented for example in the GNU g++ compilers when compiling with -maltivec?

Specifically, can it be made to stop reporting the vector data types as syntax errors? e.g.

vector unsigned char foo;

declares a 128-bit vector variable named "foo" containing sixteen 8-bit unsigned chars.

+1  A: 

No. It is supposedly possible to extend the CDT indexer to recognize new language elements, but I don't think it can be done for an existing toolchain definition.

That said, the easiest way to solve (or work around) this particular problem is to define vector as an empty preprocessor symbol (Project properties -> C/C++ General -> Paths and symbols -> Symbols).

JesperE
Thanks, but that breaks the STL quite nastily.
grrussel
Yes, it does. Bad idea, then.
JesperE
A: 

The Eclipse CDT has two C++ parsers, one of which aims for GNU compatibility and currently lacks support for Altivec. The second aims for compatibility with XLC, and has syntactic support for Altivec types in program code (but not semantic support!), with support for some GNU extensions too.

That can be gotten from Eclipse CDT CVS (look for the java package org.eclipse.cdt.core.lrparser.xlc)

Once the XLC parser is installed, it can be selected using the Language Mappings properties page to switch to the XLC C++ parser.

grrussel