如何在 cpp 中抑制 'missing termination character' 警告?

How to suppress a 'missing termination character' warning in cpp?

我正在尝试使用 cpp(ANSI-C 预处理器)来预处理一些非 ANSI-C 文件。

这些文件包含 PicoBlaze 语法中的汇编指令。 PicoBlaze 使用 'd 来注释文字的基数。我想用 cpp 预处理我的文件。

我得到了几个:

<stdin>:228:163: warning: missing terminating ' character [enabled by default]
<stdin>:257:98: warning: missing terminating ' character [enabled by default]
...

警告。如何在 cpp 中禁用 '(或所有字符)的终止字符检查?

这是我的命令行调用:

cpp.exe -E main_Page0.psm

我想我自己找到了解决方案,但我仍然愿意接受其他建议。

解决方案 1)
-w 禁用所有警告 -> 不满意

Suppress all warnings, including those which GNU CPP issues by default.
GCC Manual (v4.9.2) -> page 158

解决方案 2)
-x assembler-with-cpp 将 cpp 的源语言设置为汇编。
如果文件扩展名未知(等于 -x c),则默认语言为 ANSI-C。

Specify the source language: C, C++, Objective-C, or assembly. This has nothing to do with standards conformance or extensions; it merely selects which base syntax to expect. If you give none of these options, cpp will deduce the language from the extension of the source file: ‘.c’, ‘.cc’, ‘.m’, or ‘.S’. Some other common extensions for C++ and assembly are also recognized. If cpp does not recognize the extension, it will treat the file as C; this is the most generic mode.
GCC Manual (v4.9.2) -> page 160