Re: [PATCH] checkpatch.pl: Check for functions without a real prototype

From: Richard Weinberger
Date: Fri Mar 16 2012 - 19:36:04 EST


Am 17.03.2012 00:31, schrieb Joe Perches:
> Perhaps this should be:
> if ($line =~ /(\b$Type\s+$Ident)\s*\(\s*\)/) {

Makes sense.

>> + ERROR("FUNCTION_NO_PROTOTYPE",
>> +"Function without a real prototype\n" . $herecurr .
>
> Sensible, but maybe:
> "Bad function definition - $1() should probably be $1(void)\n"

Too.

>> +"Thou shalt not, in the language of C, under any circumstances, on the
>> +pain of death, declare or define a function with an empty set of
>> +parentheses, for though in the language of C++ it meaneth the same as
>> +(void), in C it meaneth (...) which is of meaningless as there be no
>> +anchor argument by which the types of the varadic arguments can be
>> +expressed, and which misleadeth the compiler into allowing unsavory code
>> +and in some cases generate really ugly stuff for varadic handling.
>> + -hpa\n");
>
> Humorous once, painful in twice, annoying after.
>

It has to be annoying and painful. :-)

Thanks,
//richard

Attachment: signature.asc
Description: OpenPGP digital signature