This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

_Pragma with UNROLL yields "error #612: this kind of pragma may not be used here"

Hi!

I'm trying to use the following code to use "#pragma UNROLL(...); from a macro:

#define PRAGMA(x) _Pragma(#x)
#define P_UNROLL(cnt) \
        PRAGMA(UNROLL(cnt))
#define ANYNUMBER 42

P_UNROLL(ANYNUMBER)
for (i=0;i<ANYNUMBER;i++)
{
    doSomething(i);
}


We use the same PRAGMA macro sheme for DATA_SECTION and CODE_SECTION. Works perfectly.

But this one yields "error #612: this kind of pragma may not be used here"

Why do we use _Pragma and not #pragma? We want to compile the same code with cl6x and gcc. But gcc doesn't know "#pragma UNROLL", so we try to hide it in a macro.

Any ideas?