1
votes

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.

1
I tried using your pragmas and I don't get any warnings about anything being ignored. CUDA 10.0, gcc 4.8.5. Also tried CUDA 10.1, gcc 8.3.1, also seems to work correctly there.Robert Crovella
@RobertCrovella: Added my compiler versions. But what you're describing is weird...einpoklum

1 Answers

2
votes

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...