This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: warning when bool parameter in function prototype
- From: Josef Zlomek <zlomj9am at artax dot karlin dot mff dot cuni dot cz>
- To: Nathan Sidwell <nathan at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 16 Jan 2003 12:49:10 +0100
- Subject: Re: warning when bool parameter in function prototype
- References: <20030116090414.GB31549@artax.karlin.mff.cuni.cz> <3E26974D.4070209@codesourcery.com>
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