【发布时间】:2021-10-11 19:41:16
【问题描述】:
我正在尝试使用 c-preprocessor 预处理几个文件以使用 -Werror 扩展宏,我注意到在预处理时重新定义了错误。
fileA.h:203:0: error: "TEST_DIR" redefined
#define TEST_DIR 2
fileB.h:119:0: note: this is the location of the previous definition
#define TEST_DIR 90
fileC.h:203:0: error: "TEST_DIR" redefined
#define TEST_DIR_TASK 1000
fileD.h:119:0: note: this is the location of the previous definition
#define TEST_DIR_TASK 8
实际上TEST_DIR_TASK 在一个文件中以十六进制格式定义,在另一个文件中以十进制定义,这两个值表示相同,我想忽略这些。是否有任何特殊的 gcc 标志有助于根据某些标准忽略某些警告子集。谢谢!
【问题讨论】:
-
十六进制的
8是十进制的8,所以这与这里看到的1000不匹配(也许你的意思是二进制?)。另外,如果其中任何一个是十六进制的,0x前缀在哪里?