This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: warning when bool parameter in function prototype


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;
{
}

Josef


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]