While I certainly agree with what you said in the other thread about C
being designed in such a way that it "punishes" or requires extra work
for making a function, it is part of the burden of the language. :-/
Personally, I would just define the functions in a prototype. If it makes you feel better, you can all it "uselessPrototypesToShutGccUp.h".
Andrew Bachmann wrote:
Michael Phipps <mphipps1@xxxxxxxxxxxxxxxx> wrote:
I think that we need more info. Are these functions that the driver contains? Kernel functions?
The "proper" way to do this is to put the prototypes in a header file. There are apps out there that can generate header files from C code. In general, keeping warnings is a good thing...
Here's an example:
There's a function called control_hook. It is defined in a prototype prior to its use in device_hooks. Since control_hook actually
performs a number of different behaviors, depending on the
argument, each was broken out into a separate function, which was
defined before control_hook. No other functions are going to call
these functions, so there's really no point to define prototypes for
them in the header or anywhere else.
I agree that warnings are a good thing but sometimes they just don't serve a useful purpose. We are already going to get the warning when a function is implicitly defined due to a missing prototype and I think that's enough.