强制使用预定义宏的 gcc 标志

gcc flag to force use of predefined macros

我的问题如下。我正在尝试为 mips 构建一个项目。 当我从它的存储库下载它时,构建它没有问题,但是当我将它作为一个更大项目的一部分构建它时,我收到以下错误:

error: expected ‘,’ or ‘...’ before numeric constant

我发现这是一个问题,因为某些变量称为 mips,而同一变量在 gcc 编译器中被定义为预定义宏。

#define mips 1

我验证了它:

mipsel-linux-gnu-g++ -dM -E - < /dev/null

所以,我的问题是,是否有人知道是否有某个编译器标志或其他什么强制使用此宏?奇怪的是,当我从存储库下载相同的代码时没有构建问题。

两个项目都是使用相同的工具链构建的,我已经验证过了。

感谢您的帮助!

"When the -ansi option, or any -std option that requests strict conformance, is given to the compiler, all the system-specific predefined macros outside the reserved namespace are suppressed. The parallel macros, inside the reserved namespace, remain defined."

也就是说,使用 --ansi 你仍然会得到 __mips__ 而不是 mips