燮preSS GCC警告"在#include指令&QUOT年底多出的令牌; [英] Suppress GCC warning "extra tokens at end of #include directive"
问题描述
我在C语言编写的程序意在编译和HP NonStop服务器的机器上运行。然而,我想要做的运行Linux在工作站上的主要发展。惠普的NonStop C编译器需要非标准#include指令类似如下:
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
对于每一个#include指令,我的工作站的GCC抱怨:
For each #include directive, my workstation's GCC is complaining:
S88USF.c:139:21: warning: extra tokens at end of #include directive
我怎么能燮preSS这个特殊的警告?
How can I suppress this particular warning?
注:在SO,类似的问题已经被问,正确答案沿着线是不给GCC任何理由摆在首位抱怨。在这种情况下不过,我明确地希望有#include指令,正是因为他们的。
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.
我知道我在做什么,我只是不知道如何告诉GCC了。
I know what I'm doing, I just don't know how to inform gcc about it.
推荐答案
宏扩展中发生的包括大概可以提供帮助。
Macroexpansion happening within include can probably help.
GCC将接受这样的:
GCC will accept this:
#define nolist
#include <stdlib.h> nolist
/* maybe #undef nolist here */
这篇关于燮preSS GCC警告&QUOT;在#include指令&QUOT年底多出的令牌;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!