如何禁用特定的 nvcc 编译器警告 [英] How to disable a specific nvcc compiler warnings

查看:36
本文介绍了如何禁用特定的 nvcc 编译器警告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用 nvcc 禁用特定的编译器警告,特别是

I want to disable a specific compiler warning with nvcc, specifically

警告:不允许 NULL 引用

warning: NULL reference is not allowed

我正在编写的代码使用 NULL 引用是 SFINAE 的一部分,因此无法避免.

The code I am working on uses NULL references are part of SFINAE, so they can't be avoided.

一个理想的解决方案是在我们想要禁用警告的源文件中添加一个 #pragma,但编译器标志也可以,如果存在仅关闭警告的编译器标志问题.

An ideal solution would be a #pragma in just the source file where we want to disable the warnings, but a compiler flag would also be fine, if one exists to turn off only the warning in question.

推荐答案

实际上可以通过 NVCC 禁用设备上的特定警告.我花了很长时间才弄清楚该怎么做.

It is actually possible to disable specific warnings on the device with NVCC. It took me ages to figure out how to do it.

您需要将 -Xcudafe 标志与 此页面.例如,要禁用控制表达式是常量"警告,请将以下内容传递给 NVCC:

You need to use the -Xcudafe flag combined with a token listed on this page. For example, to disable the "controlling expression is constant" warning, pass the following to NVCC:

-Xcudafe "--diag_suppress=boolean_controlling_expr_is_constant"

有关其他警告,请参阅上面的 链接.

For other warnings, see the above link.

这篇关于如何禁用特定的 nvcc 编译器警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆