__restrict__ compiles, but Eclipse (Linux) indicates syntax error; __restrict works!

Editing a .cu file, Eclipse shows any function with a restrict parameter as a syntax error. Because of the syntax error, the code for the function appears with a yellow underscore throughout all the text of the function, and the function does not appear in the Outline view for the file. Similarly, any field of a struct or class using restrict shows as a syntax error.

However, the source compiles and executes just fine!

If I replace restrict by __restrict, the syntax error indicators vanish, and it compiles. I imagine __restrict is doing what I expect?

Is this a bug, or am I misusing restrict?

Thanks!
Here’s a simple example:

__device__ int foo(const float * __restrict__ f){
  return 9;
}

Thank you for reporting this issue. I opened a bug on internal bug tracker and will get back to you if workaround is found.

Note that you may ignore those errors, they do not prevent Nsight from building, debugging or profiling the application.

I am running NSight 9.2 (downloaded today) and am getting a similar problem. Has there been any progress made? (Using the Eclipse version on Ubuntu 16.04). I am trying to write a C version using just restrict, rather than `restrict’ and the former gives me the syntax error in the function definitions/declaration.

Hi,

I can’t reproduce your issue by using following code, no error or warning displayed. And the code can be built successfully.

#include <stdio.h>
#include <assert.h>

// CUDA runtime
#include <cuda_runtime.h>

device int foo(const float * restrict f){
return 9;
}

int main() {
//cout << “!!!Hello World!!!” << endl; // prints !!!Hello World!!!
return 1;
}