Search code examples
cgccwarningshp-nonstop

Suppress GCC warning "extra tokens at end of #include directive"


I'm writing a program in C intended to be compiled and run on a HP NonStop machine. However, I want to do the main development on my workstation running Linux. The HP NonStop C-Compiler requires non-standard #include directives like the following:

#include <stdio.h> nolist

For each #include directive, my workstation's GCC is complaining:

S88USF.c:139:21: warning: extra tokens at end of #include directive

How can I suppress this particular warning?

Note: On SO, similar questions have already been asked, the correct answer being along the lines of "don't give gcc any reason to complain in the first place". In this scenario however, I explicitly want to have the #include directives exactly as they are.

I know what I'm doing, I just don't know how to inform gcc about it.


Solution

  • Macroexpansion happening within include can probably help.

    GCC will accept this:

    #define nolist
    #include <stdlib.h> nolist
    /* maybe #undef nolist here */