YACC生成的C文件SCCSID警告抑制
我正在研究一个使用YACC -1.9 20130304的旧项目。 生成的.c文件包含SCCSID字符串(来自Skeleton.c):
#ifndef lint
static const char <file_name>sccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
使用GCC-WAL来编译时,我会收到预期的警告:
警告:'&lt; file_name&gt; sccsid'已定义但未使用[-wunused-const-variable = wunuse-cont-varable = = ]
我可以删除警告的一种方法是以某种方式添加__属性__(((未使用)))
>一个复杂的制作结构。
因此,我想知道是否有更简单的方法。我可以告诉YACC不要生成SCCS ID吗?还是可以指示海湾合作委员会不要警告#IFDEF棉绒?还是其他解决方案?
编辑:我无法升级到BYACC的较新版本(不插入SCCSID)或修改Skeleton.c和重新编译YACC,因为由于软件保证保证,我们必须使用特定版本的Linux和Linux和库。
任何建议/提示都将不胜感激!
I am working on a legacy project that uses yacc - 1.9 20130304.
The generated .c files contain the sccsid string (from the skeleton.c):
#ifndef lint
static const char <file_name>sccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93";
#endif
When compiling with gcc -Wall I get the expected warning:
warning: '<file_name>sccsid' defined but not used [-Wunused-const-variable=]
One way that I can remove the warning is to somehow add __attribute__((unused))
in the generated file but that would be very tedious since the project is huge and contains a lot of parser-generators with a complicated makefile structure.
Therefore I am wondering if there is a simpler way. Can I tell yacc to not generate the sccs id? Or can I instruct gcc to not warn on #ifdef lint? Or maybe some other solution?
Edit: I cannot upgrade to a newer version of byacc (that doesn't insert the sccsid) or modify skeleton.c and recompile yacc because we must ship the software with a specific version of linux and libraries due to software assurance guarantees.
Any suggestions/hints are appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将注释转换为答案。
有多种可能性:
-wno-unused-const-variable
添加到您的命令行选项中,但它可能会抑制有关您应该注意的其他变量的其他警告。-dlint
负担得起(语法文件)吗?它将从编译器的视图中消除变量。最后的(用
-dlint
编译语法)可能是最好的。受#ifndef lint
保护的代码对于代码的操作很少至关重要。它用于在lint
的日子里从lint
编程中隐藏可疑构造。如今,在使用标题和编译器的详细警告时,lint
很少使用。Converting comments into an answer.
There are multiple possibilities:
-Wno-unused-const-variable
to your command-line options, but it might suppress other warnings about other variables that you should pay attention to.-Dlint
? It will eliminate the variable from the compiler's view.The last (compiling the grammars with
-Dlint
) is probably the best. Code that is protected by#ifndef lint
is rarely crucial to the operation of the code. It was used to hide dubious constructs from thelint
program back in the days whenlint
was used. These days, with proper care in the use of headers and detailed warnings from compilers,lint
is rarely used.