Consistency of function attributes between prototype and definition

Jeff Law law@redhat.com
Fri Oct 2 17:05:00 GMT 2015


On 10/02/2015 05:25 AM, Florian Weimer wrote:
> glibc has a preprocessor macro called internal_function which switches
> to a different calling convention on certain targets (i386 uses stdcall
> and regparams).  For non-K&R function definitions, the compiler enforces
> that both the prototype declaration and the definition match.
>
> When someone writes a patch on a different architecture than i386 and
> forgets to specify internal_function on both prototype and definition,
> the build will pass, even though i386 will not compile.
>
> Is there a way to use a certain harmless attribute to detect this
> mismatch even on architectures where internal_function has no effect?
I'm not aware of one, but perhaps one could be invented to cover this 
class of sanity checking.

jeff



More information about the Gcc-help mailing list