This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [middle-end] New option Wsuggest-attribute=const|pure
> >> Thanks for the clarification. ?Given that, I would suggest to just
> >>
> >> ? ? "it is known to return normally"
> ^
>
> Sorry, there is a missing "if" -- as it was in the original diagnostic.
I would be happy about pretty much any wording. GCC is able to work out quite
safely all reasons for function not being pure/const (i.e. that it traps, or
writes/reads memory or has dubious asm inside etc.). Only property we are not
good on guessing is finiteness of the function (i.e. the halting problem).
This is what the message is about: user has to decide if he really intend to
make the function to loop forwever without a side effects or if the program
is sane ;)
Honza
>
> >>
> >> in the diagnostic
> >
> > Do you think that makes it clear that
> >
> > ?void foo (unsigned n)
> > ?{
> > ? ?unsigned i;
> > ? ?for (i = n; i>=0; --i)
> > ? ? ?;
> > ?}
> >
> > is not returning normally if n can be zero? ?Thus, does
> > "it is known to return normally" suggest that it _has_ to return
> > or only that if it returns it returns normally?
>
> only "if it returns normally", the "if" was missing in my reply.
>
> -- Gaby