-qwarn0x (C++11)

适用的调用

表 1. 接受给定选项的调用
选项 xlc (编译 C) xlC (编译 C++) xlclang(编译 C) xlclang++(编译 C++)
-qwarn0x    
注: 此表中仅列出典型调用。 对于所有基本调用及其等效特殊调用,您可以参阅 编译器调用的完整列表

类别

错误检查和调试

等效编译指示

无。

用途

控制是否通过消息来通知用户有关其程序因从 C++98 标准迁移至 C++11 标准而导致的差异。

例如,当指定 -qlanglvl=noc99preprocessor-qwarn0x 时, C++11 预处理器会对 #if#elif 条件包含伪指令中的控制表达式进行求值,并将求值结果与 non-C++11 预处理器的求值结果进行比较。 如果它们不同,那么编译器会发出以下警告消息:
The preprocessor controlling expression evaluates differently between C++11
and non-C++11 langlvls.
对于另一个示例,当您同时指定 -qlanglvl=noc99longlong-qwarn0x 选项时,编译器可能会显示消息以指示整数文字的类型在 non-C++11 和 C++11 语言级别之间不同。32 位 方式下,使用整数字面值 2147483648 初始化变量时,编译器会发出以下消息:
Integral constant "2147483648" has implied type unsigned long int under 
the non-C++11 language levels. It has implied type long long int under C++11.
编译器对具有相同选项设置的字面值 10000000000000000000 发出类似消息:
Integral constant "10000000000000000000" has implied type unsigned long 
long or is not allowed with "-qlanglvl=extendedintegersafe" under C++11. 
Its implied type is not unsigned long long under non-C++11 language levels.
启用 -qwarn0x 选项后,对于每次出现的以下关键字,如果禁用了相应的 C++11 功能部件 和关键字 ,那么编译器将发出警告消息。
  • constexpr
  • decltype
  • static_assert
例如,当启用 -qwarn0x 选项时,如果同时指定了 -qlanglvl=nostatic_assert-qnokeyword=static_assert 选项,那么编译器会将 static_assert 视为标识令牌,并针对它迂到的每个 static_assert 标识发出以下消息:
C++0x will reserve "static_assert" as a keyword whose C++0x feature can 
be enabled by -qlanglvl=static_assert.

语法

读取语法图跳过可视语法图  -q nowarn0xwarn0x

缺省值

-qnowarn0x

使用量

此选项在设置 -qwarn0x 时生效。

预定义的宏

无。

相关信息