3

In this question:

How to disable a specific nvcc compiler warnings

there's a link to a long "dictionary" mapping tokens to error messages, which seems to fit NVCC ... except it doesn't cover all warnings. Specifically, I want to suppress

warning: 'long double' is treated as 'double' in device code

... and that warning isn't in there. What's the token for it? Or perhaps - how can I determine the token given a warning string?

Note: AFAICT, it's not

"double" used for "long double" in generated C code

which is very similar.

einpoklum
  • 118,144
  • 57
  • 340
  • 684
  • @njuffa: Actually, it seems I only got it partially right. – einpoklum Jun 17 '21 at 20:40
  • Have you tried without the `=`? Some compilers use just the number, so you would write, say, `#pragma diag_suppress 191`. I think the PGI compilers use this convention. – njuffa Jun 18 '21 at 01:18
  • I got this warning when trying to combine constexpr functions with literal operators (that take `long double`) with nvcc – alfC Apr 17 '23 at 02:44

1 Answers1

2

The number of that warning is 20208; thus, it will be suppressed if you append the following to your compilation command-line:

-Xcudafe --diag_suppress=20208

I figured this out thanks to this answer, which explains how you can get NVCC to emit warning numbers.

However - this doesn't work:

#pragma diag_suppress = 20208

so the syntax for suppressing errors by number within the code must be different.


Note: Don't mistake diag-suppress for diag_suppress.

einpoklum
  • 118,144
  • 57
  • 340
  • 684