| Summary: | [XLC++ Parser] restrict keyword in parameter results in parse error when restrict keyword is enabled | ||
|---|---|---|---|
| Product: | [Tools] CDT | Reporter: | John Liu <jwsliu> |
| Component: | cdt-parser | Assignee: | Project Inbox <cdt-parser-inbox> |
| Status: | REOPENED --- | QA Contact: | Jonah Graham <jonah> |
| Severity: | normal | ||
| Priority: | P3 | CC: | cdtdoug, mikekucera, yevshif |
| Version: | 8.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
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. 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. |
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; }