Re: [PATCH v2] x86/cpu: fix prototype warning

From: Michael Matz
Date: Thu Nov 08 2018 - 10:47:39 EST


Hi,

On Thu, 8 Nov 2018, Borislav Petkov wrote:

> And frankly, I don't see why we should be fixing all those. So what if a
> global function does't have a previous prototype declaration?!
>
> Micha, is there anything "useful" that warning bitches about or should
> we disable it?

What tglx said. If you don't intend such functions to be called
from other units make them static, if you do intend them to be callable
declare the properly.

[There's also one subtle issue with argument promotions. prototypeless
functions are called as if they are declared "int name()" that is
default argument promotions take place (float->double, {char,short}->int),
which won't happen with prototypes, and argument type conversions won't
take place (as no parameter types are known). This might lead to
different values between calling a prototyped and a prototype-less
function arriving at the function even though the call expression looked
the same]


Ciao,
Michael.