warning when bool parameter in function prototype

Jan Hubicka jh@suse.cz
Thu Jan 16 16:46:00 GMT 2003


> On Thu, Jan 16, 2003 at 11:28:13AM +0000, Nathan Sidwell wrote:
> > Josef Zlomek wrote:
> > >static _Bool copy_bb_p (basic_block, _Bool);
> > >static _Bool
> > >copy_bb_p (bb, code_may_grow)
> > >     basic_block bb;
> > >     _Bool code_may_grow;
> > >{
> > >...
> > >}
> > >
> > >Compiler writes a warning
> > >warning: promoted argument `code_may_grow' doesn't match prototype
> > >when bootstraping.
> > >
> > >Any ideas why the mainline compiler complains?
> > because the prototype doesn't match the definition.
> > 
> > 	void foo (char);
> > matches
> > 	void foo (char i) {}
> > but
> > 	void foo (int);
> > matches
> > 	void foo (i) char i; {}
> > 
> > The latter is a knr style definition, and arguments are really passed
> > following default promotions. The prototype must indicated the promoted type
> > (thus char, short & float, are passed as int, int, double).
> 
> So there should be 
> static bool copy_bb_p PARAMS((basic_block, int));
> static bool
> copy_bb_p (bb, code_may_grow)
> 	basic_block bb;
> 	bool code_may_grow;
> {
> }
For consistency please use int in both places.
SImply never use bool as function arguemnt.

Honza
> 
> Josef



More information about the Gcc mailing list