如何找到没有原型C函数? [英] How to find C functions without a prototype?

查看:184
本文介绍了如何找到没有原型C函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

公司的政策规定,在C源$ C ​​$ C每个函数都有一个原型。我继承了一个项目,其自身的使系统(所以我的不能测试它GCC或Visual Studio),发现其中一个文件有没有原型声明的一些静态功能。有没有一种方法(不一定与编译器)列出所有功能,而原型中的所有.c文件?

Company policy dictates that every function in C source code has a prototype. I inherited a project with its own make system (so I cannot test it on gcc or Visual Studio) and found that one of the files has some static functions declared without prototypes. Is there a way (not necessarily with a compiler) to list all functions without prototypes in all .c files?

推荐答案

gcc有一个选项来提醒你一下:

gcc has an option to warn you about this:

gcc -Wmissing-prototypes

您可以关闭该警告变成了错误,停止编译和力量的人来解决它:

You can turn this warning into an error to stop compilation and force people to fix it:

gcc -Werror=missing-prototypes

如果你只是想列出它,你可以用 GCC 选项 -Wmissing的原型和grep的编译否previous原型在日志中。

If you just want to list it you can compile with the gcc option -Wmissing-prototypes and grep for no previous prototype for in the log.

基于编辑更新

既然你现在提到,你不能用gcc,你必须找到你当前的编译器的类似选项。大多数编译器有这样一个选项。先从手册页或内置的帮助输出。

Since you now mention that you can't use gcc, you'll have to find a similar option for your current compiler. Most compilers have such an option. Start with the man page or the built in help output.

这篇关于如何找到没有原型C函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆