-w
适用的调用
| 选项 | xlc (编译 C) | xlC (编译 C++) | xlclang(编译 C) | xlclang++(编译 C++) |
|---|---|---|---|---|
| -w | ✓ | ✓ | ✓ | ✓ |
注: 此表中仅列出典型调用。 对于所有基本调用及其等效特殊调用,您可以参阅 编译器调用的完整列表 。
类别
等效编译指示
无。
用途
禁止 警告消息。

此选项等同于指定 -qflag=e : e。
此选项等同于指定。 -qflag=s :
s
语法
缺省值
将报告所有参考消息和警告消息。
使用量
此选项不会禁用向严重错误提供其他信息的参考消息和警告消息。
预定义的宏
无。
示例
请考虑文件 myprogram.c。
#include <stdio.h>
int main()
{ char* greeting = "hello world";
printf("%d \n", greeting);
return 0;
}- 如果在不使用
-w选项的情况下编译myprogram.c,那么编译器将发出警告消息。
输出:xlC myprogram.c"5:18: warning: format specifies type 'int' but the argument has type 'char *' [-Wformat] printf("%d \n", greeting); ~~ ^~~~~ %s 1 warning generated." - 如果使用
-w选项编译myprogram.c,那么将禁止警告消息。xlC myprogram.c -w
