Page 1 of 1

Code completion for openmpi - const classes in separate file

Posted: Wed Feb 09, 2011 8:57 am
by Nosferax
Hi,

I am having trouble to get code completion working for the openmpi library. I get the completion for some elements but not all. I'll point out to one example where the completion cannot seem to understand what is going on.

To use openmpi, you typically install the libopenmpi-dev packages, which puts a bunch of headers in /usr/include/openmpi. I added that folder to my workspace's parser search paths. The completion on classes is just fine, but the problem comes with the definition of some constant classes, defined in the file /usr/include/openmpi/openmpi/ompi/mpi/cxx/constants.h (wew, that was long), included in the file /usr/include/openmpi/openmpi/ompi/mpi/cxx/mpicxx.h, which is included in the file mpi.h, the file you include in your main file (assuming you are programming in c++, if programming c openmpi will include a different file than openmpi/openmpi/ompi/mpi/cxx/mpicxx.h).

Before all of the constants I am trying to get completion on, there is a preprocessor instruction OMPI_DECLSPEC, which I added to my Token list, to no avail. Here is a sample of the file (which I added as an attachment to this message):
// datatypes for reductions functions (C / C++)
OMPI_DECLSPEC extern const Datatype FLOAT_INT;
OMPI_DECLSPEC extern const Datatype DOUBLE_INT;

...

// reserved communicators
// JGS these can not be const because Set_errhandler is not const
OMPI_DECLSPEC extern Intracomm COMM_WORLD;
OMPI_DECLSPEC extern Intracomm COMM_SELF;
The constants.h file is included inside a namespace named MPI. This seems to cause some havoc since, to the code parser, other classes which have been included in the same way are defined outside the MPI namespace (i.e., I get completion on the class Intracomm without typing MPI::, and I have no using namespace MPI in my main file).

Any idea what's going on in the parser?

Thanks!

Re: Code completion for openmpi - const classes in separate file

Posted: Wed Feb 09, 2011 1:02 pm
by eranif
Nosferax wrote:there is a preprocessor instruction OMPI_DECLSPEC, which I added to my Token list, to no avail
Its seems like that the 'extern' keyword is whats causing the mess...
Add 'extern' to the token list, retag workspace (from the main menu: Workspace | Retag workspace (full)) and it will work
Nosferax wrote:other classes which have been included in the same way are defined outside the MPI namespace (i.e., I get completion on the class Intracomm without typing MPI::, and I have no using namespace MPI in my main file).
Please provide with a minimal sample code that shows the problem ( no need to provide the openmpi headers, I will install the package)

Eran