RE: Request for suppressing "warn_unused_result" warnings

2010-06-03 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
Okay, I guess we 'll just disable the __wur's by default then -- as introducing an unnecessary hard-to-avoid noise. I recon many other people do the same. Thanks nevertheless. It's still a useful feature, just not flexible enough to use it for *everyday* compilation. Denis

Re: Request for suppressing "warn_unused_result" warnings

2010-05-31 Thread Basile Starynkevitch
On Fri, May 28, 2010 at 11:32:46AM -0700, Ian Lance Taylor wrote: > Please read http://gcc.gnu.org/PR25509 . > > As the compiler documentation states, warn_unused_result was intended > for cases where failing to check the return value is always a security > risk or a bug. The documentation cites

Re: Request for suppressing "warn_unused_result" warnings

2010-05-29 Thread Dave Korn
On 29/05/2010 11:55, Richard Guenther wrote: > On Sat, May 29, 2010 at 3:16 AM, Dave Korn wrote: >> What it really is is, I don't see the consistency in disregarding an >> explicit cast to void, yet permitting a workaround such as an inlined no-op >> function that casts the parameter to void. I

Re: Request for suppressing "warn_unused_result" warnings

2010-05-29 Thread Richard Guenther
On Sat, May 29, 2010 at 3:16 AM, Dave Korn wrote: > On 29/05/2010 01:14, Ian Lance Taylor wrote: >> Dave Korn >>>   there is *no* circumstances >>> under which ignoring the return from *any* function is *always* a bug. > >> For practical purposes, it is always a bug to ignore the return value >>

Re: Request for suppressing "warn_unused_result" warnings

2010-05-29 Thread Richard Guenther
On Sat, May 29, 2010 at 3:13 AM, Dave Korn wrote: > On 29/05/2010 01:17, Ian Lance Taylor wrote: >> Dave Korn writes: >> >>> On 28/05/2010 22:25, Ian Lance Taylor wrote: >>> The warn_unused_result extension was implemented specifically to catch security problems.  Permitting developers

Re: Request for suppressing "warn_unused_result" warnings

2010-05-29 Thread Andreas Schwab
Dave Korn writes: > On 29/05/2010 01:14, Ian Lance Taylor wrote: >> Dave Korn >>> there is *no* circumstances >>> under which ignoring the return from *any* function is *always* a bug. > >> For practical purposes, it is always a bug to ignore the return value >> of realloc (I disregard the unu

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Dave Korn
On 29/05/2010 01:14, Ian Lance Taylor wrote: > Dave Korn > there is *no* circumstances >> under which ignoring the return from *any* function is *always* a bug. > For practical purposes, it is always a bug to ignore the return value > of realloc (I disregard the unusual case of passing 0 as the

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Dave Korn
On 29/05/2010 01:17, Ian Lance Taylor wrote: > Dave Korn writes: > >> On 28/05/2010 22:25, Ian Lance Taylor wrote: >> >>> The warn_unused_result extension was implemented specifically to catch >>> security problems. Permitting developers to just add a cast to void >>> would make it a very weak f

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Ian Lance Taylor
Dave Korn writes: > On 28/05/2010 22:25, Ian Lance Taylor wrote: > >> The warn_unused_result extension was implemented specifically to catch >> security problems. Permitting developers to just add a cast to void >> would make it a very weak facility. > > But it's a weak and fundamentally flawe

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Ian Lance Taylor
Dave Korn writes: > On 28/05/2010 19:32, Ian Lance Taylor wrote: > >> As the compiler documentation states, warn_unused_result was intended >> for cases where failing to check the return value is always a security >^^ > Note: "always

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Dave Korn
On 28/05/2010 22:25, Ian Lance Taylor wrote: > "Vakatov, Denis (NIH/NLM/NCBI) [E]" > The reasonable (or, "great enough") solution would be to just trust >> explicit developer's void-casting. >> >> Also, 'warn_unused_result' should be enough; there is no need to add >> more levels to this simple par

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Dave Korn
On 28/05/2010 19:32, Ian Lance Taylor wrote: > As the compiler documentation states, warn_unused_result was intended > for cases where failing to check the return value is always a security ^^ Note: "always". > risk or a bug. OK,

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Ian Lance Taylor
"Vakatov, Denis (NIH/NLM/NCBI) [E]" writes: > The problem with the suggested scenario with one trusted developer > that uses this option is that other developers won't see these > warnings at all. However, IMO we can have our cake and eat it too -- > and, leave most of the involved parties genera

RE: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
Ian Lance Taylor wrote: > [...] developers can not always be trusted. Instead, we assume that there at > least one trusted developer who can add warn_unused_result when > appropriate. Then the compiler arranges matters such that other developers > can not easily avoid the warning. Thus securi

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Richard Guenther
On Fri, May 28, 2010 at 11:25 PM, Ian Lance Taylor wrote: > "Vakatov, Denis (NIH/NLM/NCBI) [E]" writes: > >> Ian Lance Taylor wrote: >> >>> We should handle must_use_result and warn_unused_result similarly, except >>> that adding a cast to (void) disables the warn_unused_result warning.   >>> Pe

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Ian Lance Taylor
"Vakatov, Denis (NIH/NLM/NCBI) [E]" writes: > Ian Lance Taylor wrote: > >> We should handle must_use_result and warn_unused_result similarly, except >> that adding a cast to (void) disables the warn_unused_result warning. >> Perhaps there should also be other simple ways to disable the >> war

RE: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
Ian Lance Taylor wrote: > We should handle must_use_result and warn_unused_result similarly, except > that adding a cast to (void) disables the warn_unused_result warning. > Perhaps there should also be other simple ways to disable the > warn_unused_result warning. > > This is not a great solu

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Ian Lance Taylor
"Vakatov, Denis (NIH/NLM/NCBI) [E]" writes: > Can this design please be changed (or, dare I say without being > considered impolite, improved) to better accommodate for the cases > where there is indeed no reason for checking the return value? > > Making the developers jump through more complicat

RE: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
Behalf Of Paolo Bonzini Sent: Friday, May 28, 2010 1:10 PM To: Vakatov, Denis (NIH/NLM/NCBI) [E] Cc: Lavrentiev, Anton (NIH/NLM/NCBI) [C]; gcc@gcc.gnu.org Subject: Re: Request for suppressing "warn_unused_result" warnings On Fri, May 28, 2010 at 18:12, Vakatov, Denis (NIH/NLM/NCBI) [E] wr

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Paolo Bonzini
On Fri, May 28, 2010 at 18:12, Vakatov, Denis (NIH/NLM/NCBI) [E] wrote: > Hi Paolo, > > Can this design please be changed By saying "by design" I was implying that it won't. FWIW I agree with you, but I'm also very undecided whether it is not glibc that was too greedy in applying __wur (which al

RE: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
olo.bonz...@gmail.com] On Behalf Of Paolo Bonzini Sent: Friday, May 28, 2010 9:12 AM To: Lavrentiev, Anton (NIH/NLM/NCBI) [C] Cc: gcc@gcc.gnu.org; Vakatov, Denis (NIH/NLM/NCBI) [E] Subject: Re: Request for suppressing "warn_unused_result" warnings On 05/28/2010 06:36 AM, Lavrentiev, Ant

Re: Request for suppressing "warn_unused_result" warnings

2010-05-28 Thread Paolo Bonzini
On 05/28/2010 06:36 AM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] wrote: Dear GCC developers, Would you please consider suppressing (relatively new) warnings like this one: ignoring return value of 'int chdir(const char*)', declared with attribute warn_unused_result in cases when the source code ex