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]

Re: New const function detection code and infinite loops.


> > 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


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