tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: missing-prototypes enabled in bsd.sys.mk
In article <d2489e60-d5b6-c1cd-3f61-6e19314c4319%geeklan.co.uk@localhost>,
Sevan Janiyan <venture37%geeklan.co.uk@localhost> wrote:
>Hello,
>When building Lua modules bsd.sys.mk gets included in bsd.lua.mk. In
>bsd.sys.mk -Wmissing-prototypes is enabled via CFLAGS. This forces the
>declaration of prototypes where it would not be a show stopper if it
>wasn't, for example in this case, a Lua module where the function is not
>called anywhere else or prior to the implementation.
>
>-Wmissing-prototypes was enabled over 20 years ago in r1.9 of
>bsd.sys.mk, is the necessity for enabling this a relic from the
>transition from K&R to ANSI-C or is it still a necessary and useful
>check to have enabled by default?
It is still useful; consider the following example. You have a file that
contains:
int
foo(void)
{
return 1;
}
int
main(void)
{
return foo();
}
This will warn; you either want to make foo() static, or you want to
have a prototype declaration in scope from a header file which means
that the function can be used from outside the file scope.
christos
Home |
Main Index |
Thread Index |
Old Index