Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348018 - [XLC++ Parser] restrict keyword in parameter results in parse error when restrict keyword is enabled
Summary: [XLC++ Parser] restrict keyword in parameter results in parse error when rest...
Status: REOPENED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 8.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-01 16:52 EDT by John Liu CLA
Modified: 2020-09-04 15:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Liu CLA 2011-06-01 16:52:30 EDT
In the following example I can't navigate from the call to matmul to the definition. The definition of matmul is not highlighted as a function in the editor.

If I remove the 'restrict' keywords from the parameters then it works. 

#define N 2500
typedef double matrix[N][N];

matrix A, B, C;

extern "C" inline double fma(double a1, double m1, double m2) {
   return a1 + m1 * m2 ;
}

extern "C" void matmul(matrix& restrict a, matrix& restrict b, matrix& restrict c) {
   for (int i=0; i < N; i++)
      for (int j=0; j < N; j++)
         for (int k=0; k < N; k++)
            c[i][j] += a[i][k]*b[k][j];
}

extern "C" void initialize(matrix mat, int seed, int mod) {
   for (int i=0; i < N; i++)
      for (int j=0; j < N; j++)
         mat[i][j] = (double)((seed + N*i + j) % mod);
}


int main(int argc, char* argv[]) {
   initialize(A, 5, 19);
//   cout << A[0][0] << endl;
   initialize(B, 7, 23);
//   cout << B[0][0] << endl;
   matmul(A, B, C);
//   cout << C[0][0] << endl;
}
Comment 1 Markus Schorn CLA 2011-06-06 05:42:23 EDT
There is a syntax error, 'restrict' is not a keyword in c++. The parser accepts the gnu-extension '__restrict'. In case your c++-compiler supports 'restrict' you can either provide a macro definition '-Drestrict=__restrict', or configure it as a keyword via an IScannerExtensionConfiguration.
Comment 2 Mike Kucera CLA 2011-06-08 10:28:32 EDT
I think this is still a bug against the XLC++ parser. 

The XLC++ compiler supports a command line option that turns on the 'restrict' keyword for C++. CDT supports this when you have the XLC++ parser installed, there is a preference page "XL C/C++ language options" that lets you turn on the restrict keyword for XLC++. However this doesn't seem to be working.

I've reopened the bug and refiled it against the XLC++ parser.

It might also be a good idea to test all the language options to see if they are working.