Question

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.

Was it helpful?

Solution 2

Macroexpansion happening within include can probably help.

GCC will accept this:

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

OTHER TIPS

One workaround would be to define a header that includes the following preproccesor macro:

//hp_workaround.h
#ifdef HP_
#define HP_INCLUDE_DIRECTIVE(x) x
#else
#define HP_INCLUDE_DIRECTIVE(x) 
#endif

then guard your directives with this macro

#include "hp_workaround.h"
#include <stdio.h> HP_INCLUDE_DIRECTIVE(nolist)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top