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 the

Re: Request for suppressing warn_unused_result warnings

2010-05-29 Thread Andreas Schwab
Dave Korn dave.korn.cyg...@gmail.com writes: On 29/05/2010 01:14, Ian Lance Taylor wrote: Dave Korn dave.korn.cygwin@ writes: 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

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 dave.korn.cyg...@gmail.com wrote: On 29/05/2010 01:17, Ian Lance Taylor wrote: Dave Korn dave.korn.cyg...@gmail.com writes: On 28/05/2010 22:25, Ian Lance Taylor wrote: The warn_unused_result extension was implemented specifically to catch security

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 dave.korn.cyg...@gmail.com wrote: On 29/05/2010 01:14, Ian Lance Taylor wrote: Dave Korn dave.korn.cygwin@ writes:   there is *no* circumstances under which ignoring the return from *any* function is *always* a bug. For practical purposes, it is

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 dave.korn.cyg...@gmail.com 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

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

RE: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
] 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, Anton (NIH/NLM/NCBI) [C] wrote: Dear GCC

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] vaka...@ncbi.nlm.nih.gov 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

RE: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Vakatov, Denis (NIH/NLM/NCBI) [E]
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] vaka...@ncbi.nlm.nih.gov wrote: Hi Paolo, Can this design please be changed

Re: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Ian Lance Taylor
Vakatov, Denis (NIH/NLM/NCBI) [E] vaka...@ncbi.nlm.nih.gov 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

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

Re: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Ian Lance Taylor
Vakatov, Denis (NIH/NLM/NCBI) [E] vaka...@ncbi.nlm.nih.gov 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

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 i...@google.com wrote: Vakatov, Denis (NIH/NLM/NCBI) [E] vaka...@ncbi.nlm.nih.gov 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

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 security

Re: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Ian Lance Taylor
Vakatov, Denis (NIH/NLM/NCBI) [E] vaka...@ncbi.nlm.nih.gov 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

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 Dave Korn
On 28/05/2010 22:25, Ian Lance Taylor wrote: Vakatov, Denis (NIH/NLM/NCBI) [E] vakatov@ writes: 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

Re: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Ian Lance Taylor
Dave Korn dave.korn.cyg...@gmail.com 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 ^^

Re: Request for suppressing warn_unused_result warnings

2010-05-28 Thread Ian Lance Taylor
Dave Korn dave.korn.cyg...@gmail.com 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

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 dave.korn.cyg...@gmail.com 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

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 dave.korn.cygwin@ writes: 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

Request for suppressing warn_unused_result warnings

2010-05-27 Thread Lavrentiev, Anton (NIH/NLM/NCBI) [C]
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 explicitly casts the result to (void). Like in (void) chdir(/);