This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: New const function detection code and infinite loops.
- To: Joe Buck <jbuck@synopsys.com>
- Subject: Re: New const function detection code and infinite loops.
- From: Jan Hubicka <jhub6202@ss1000.ms.mff.cuni.cz>
- Date: Mon, 23 Aug 1999 20:46:48 +0200 (MET DST)
- cc: John Wehle <john@feith.com>, mitchell@codesourcery.com, law@cygnus.com, gcc@gcc.gnu.org
> > mark f as const since it is externally visable and void type. It
> > will however mark f as const in the following example:
> >
> > static int f() {
> > while (1);
> > return 0;
> > }
>
> (It would be nice to issue a warning for this function, as it cannot
> return a value).
I have the noreturn detection code, so i can warn for nonvoid functions
returning value if this is considered to be usefull.
At the other hand,such warning will arise for many "int
main" functions. Maybe these can be taken as exception?
At least we can print warning (or error) when nonvoid
function have noreturn attribute. Similary for void functions having const
or pure attribute (this I've already implemented)
Honza