各个层次的gcc警告

时间:2022-08-19 02:24:29

#pragma GCC diagnostic [error|warning|ignored] "-W<警告选项>"

诊断-忽略:(关闭警告)
#pragma  GCC diagnostic ignored  "-Wunused"
#pragma  GCC diagnostic ignored  "-Wunused-parameter"


诊断-警告:(开启警告)
#pragma  GCC diagnostic warning  "-Wunused"
#pragma  GCC diagnostic warning  "-Wunused-parameter"


诊断-错误:(开启警告-升级为错误)
#pragma  GCC diagnostic error  "-Wunused"
#pragma  GCC diagnostic error  "-Wunused-parameter"

 

转载:https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html