开发者

Can I restrict warnings to my project's includes instead of all includes with llvm or gcc?

开发者 https://www.devze.com 2023-03-17 05:03 出处:网络
I would like to restrict certain warnings to project includes, so system incl开发者_开发知识库udes are not checked. So:

I would like to restrict certain warnings to project includes, so system incl开发者_开发知识库udes are not checked. So:

/* I want no warnings from this include */
#include <myheader.h>

/* I want warnings from this include */
#include "myotherheader.h"

Is this possible with llvm and/or gcc?

Regards, Jochen


GCC already does this - you can specify additional directories to be considered as 'system directories' if you have some headers that you want to suppress warnings for:

  • http://gcc.gnu.org/onlinedocs/cpp/System-Headers.html

I don't really know about llvm/clang, but since clang has an option, -Wsystem-headers, to enable warnings from system headers I'd assume it does something similar to GCC for system headers (i.e., suppress warnings for them).

0

精彩评论

暂无评论...
验证码 换一张
取 消