Re: [LTP] [PATCH 00/13]Fix a few syntax error

Cyril Hrubis
2011-01-10T19:44:39Z

Hi!
> >> > I still could not compile the latest git. I've got a bunch of:
> >> >
> >> > pipe declared with warn_unused_result
> >> > write declared with warn_unused_result
> >> > read declared with warn_unused_result
> >>
> >> Now you know why I used void casts in a few spots :). Some are of value, some are fud.
> >
> > The problem seems to be that in different versions of libc different
> > calls are marked with warn_unused_result. I'm still thinking if -Werror
> > is right default for git tree. And I'm almost sure that it's wrong for
> > releases.
>
> Agreed, but people need to turn it on before committing test code, so
> that their code doesn't introduce any new warnings.

Well that doesn't catch up warnings if they are compiling, let's say on
ancient rhel distros. Unless somebody checks the code on recent enough
glibc... As far as I remember warn_unused_result is quite recent
feature.

> >> Ok. It would be nice to have a summary email (off-list) with all of
> >> these warnings, as they can lead to really bad problems. I may do like
> >> I've done in some directories as well and add -Wno-error with a
> >> comment stating why things were done that way.
> >
> > Will send.
>
> Thanks. Subrata sent me a bunch of warnings-related errors so I'll
> need to follow up on them. Now that tst_brk is reentrant (for better
> or for worse -- I needed to do this so people could use SAFE_CLOSE,
> etc in cleanup functions otherwise the compiler would whine that code
> doesn't return), the compiler isn't smart enough to realize that the
> following will always result in an immediate exit:
>
> int
> main(void)
> {
> tst_brkm(TCONF, NULL, "gcc is dumb");
> }

Well, that's the whole reason for attribute __noreturn__. The compiler
is not smart enough and it's not easy to make it smarter, without a buch
of matematicians and a lot of work. And as such code leads, usually, to
bug, the gcc folks rather prints the warning. There are even parts of
gcc compiler, that are compiled with warnings disabled...

--
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.