c-preprocessoransi-cpicoblaze

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


I'm trying to use cpp (ANSI-C preprocessor) to preprocess some non ANSI-C files.

These files contain assembly instruction in PicoBlaze syntax. PicoBlaze uses 'd to annotate the literal's radix. I would like to preprocess my files with cpp.

I get several:

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

warnings. How can I disable termination character checks for ' (or all characters) in cpp?

Here is my command line call:

cpp.exe -E main_Page0.psm

Solution

  • I think I found a solution by myself, but I'm still open for other suggestions.

    Solution 1)
    -w disables all warnings -> dissatisfying

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

    Solution 2)
    -x assembler-with-cpp sets cpp's source language to assembly.
    Default language is ANSI-C, if the file extension is unknown (equals -x 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