简体   繁体   中英

“pragma GCC diagnostic ignored” has no effect if it's defined in PCH?

I have several diagnostic pragmas in a header file.

#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wmissing-braces"

When I compiled this header file as PCH, these pragmas seem to have no effects in any other source files. However if I don't compiled it as PCH, it works correctly.

I'm not sure if this is a GCC bug? or maybe I'm missing something?

PS: I don't want to ignored these warnings by adding compiler options.

See comment 5 here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431

Likely a currently unsupported feature related to when things are lexed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM