Rule T019 and OpenMP

Issue #53 resolved
Philippe FOUBERT created an issue

If we have code such as:

    int k;
#ifdef _OPENMP
    #pragma omp parallel for \
        private(k)
#endif /*_OPENMP*/
    for(k = 0; k < 10; k++)
    {
        // ...
    }

we have got in the report something like:

<vera>
    <file name="example.cpp">
        <report rule="T019" line="92">
            ![CDATA[full block {} expected in the control structure]]
        </report>
    </file>
</vera>

The "#pragma omp parallel for" is seen as a standard "for" loop.

Regards, Philippe.

Comments (6)

  1. Philippe FOUBERT reporter

    I think it is not a duplicate of #48: in the code i provided to illustrate this issue, there is no white space after the "for" keyword (loop on "k") and there is one in the precompiler code (which is split on 2 lines).

    I think that the easier and most generic way to get rid of such some problems should be to make the parser ignore precompiler code (the same way it is done for comments).

  2. Log in to comment