MSVC 2015 / Wall有很多没有用的消息 [英] MSVC 2015 /Wall has lots of not useful messages

查看:239
本文介绍了MSVC 2015 / Wall有很多没有用的消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使我有一个空的程序保存包含字符串,即使我抑制警告包括,我仍然得到很多警告。

Even if I have an empty program save for include string, even if I suppress warnings around includes, I still get lots of warnings.

要重现: p>

To reproduce:

# CMakeLists.txt

add_executable(main main.cpp)

# All warnings, and treat as errors
if(MSVC)
    set_target_properties(main PROPERTIES COMPILE_FLAGS "/Wall /WX")
endif()







// main.cpp

#pragma warning(push, 0) // suppress warnings from dependencies
#include <string>
#pragma warning(pop)

int main()
{
}

即使只是这样,我得到了一些警告,第一个是...

Even with just this, I get pages of warnings, the first of which is...

main.cpp(8): warning C4710: 'int swprintf_s(wchar_t *const ,const std::size_t,const wchar_t *const ,...)': function not inlined

这是否是预期的?或者我做错了什么?

Is this expected? Or did I do something wrong?

我应该选择警告抑制,并且在我写的每个文件中都禁止他们吗?

Should I cherry pick warnings to suppress, and supress them in every file I write?

或者,我应该选择启用哪些警告?

Alternatively, should I cherry pick which warnings to enable? But that could become a tediously long list, which I would have to maintain as new checks become available.

推荐答案

我查了一下,警告,并指向我通常禁止的此警告列​​表: https:// msdn.microsoft.com/en-us/library/23k5d385.aspx

I looked up that warning and it pointed me to this list of warnings that are normally suppressed: https://msdn.microsoft.com/en-us/library/23k5d385.aspx.

您可以查看该列表,并全局禁止您的警告不在乎。我不知道如何做一个全局抑制。

You can review that list and do global suppress of the warnings that you don't care about. I'm not sure how to do a global suppress. But that particular warning seems useless.

找到了关于如何全局抑制警告的链接: https://msdn.microsoft.com/en-us/library/jj715718.aspx

Found the link on how to globally suppress warnings: https://msdn.microsoft.com/en-us/library/jj715718.aspx.

这篇关于MSVC 2015 / Wall有很多没有用的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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