I want to apply a certain flag-setting nvcc pragma, say turn off warnings of type noreturn_function_does_return
- but only for a certain function of mine.
Now, in this answer here on SO, it says I should be able to write:
#pragma push
#pragma diag_suppress = noreturn_function_does_return
...
#pragma pop
which would have indeed solved my problems; except that the pushing and pop'ing doesnt work: I get a warning about these two pragmas being ignored. Also, I couldn't figure out how this is supposed to effect other warning flags (since it's a =
rather than a +=
I guess)
So is there an actual way to push and pop? Or at least - to suppress and then un-suppress a certain warning?
Note: I use the CUDA 9.2.88 nvcc with gcc 6.3.0 on a Devuan ASCII (~= Debian Stretch) system.
Without going into details, and with recent versions of CUDA (9.2.88, 10.x and later) - this should do the trick:
#pragma diag_suppress = noreturn_function_does_return
... your code here ...
#pragma diag_default = noreturn_function_does_return
For the details, have a look at the answer the question originally linked to, which got updated...