Re: [RFC] PR/24900: computed but not used cast values

2005-11-18 Thread Neil Booth
Richard Henderson wrote:- > On Thu, Nov 17, 2005 at 03:18:00PM -0800, Ian Lance Taylor wrote: > > I don't think you should get a warning for not using the return value of a > > function, at least not under -Wunused. > > For this, I agree. Except that we're not talking about the > return value of

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Mark Mitchell
Richard Henderson wrote: > On Thu, Nov 17, 2005 at 08:42:19PM -0400, Aldy Hernandez wrote: > >>Well, as I mentioned in the PR, macro writers can wrap the whole thing >>in a statement expression and avoid the warning. Can't we suggest this >>and keep (almost) everybody happy? > > I think so. FWI

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Richard Henderson
On Thu, Nov 17, 2005 at 08:42:19PM -0400, Aldy Hernandez wrote: > Well, as I mentioned in the PR, macro writers can wrap the whole thing > in a statement expression and avoid the warning. Can't we suggest this > and keep (almost) everybody happy? I think so. r~

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Aldy Hernandez
> A stronger case for changing this would be that gcc version > n-1 didn't warn. As discussed elsewhere, some modicum of > stability in warnings is desirable from the user's perspective. > I don't know whether or not this applies in this case. Well, as I mentioned in the PR, macro writers can wra

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Richard Henderson
On Thu, Nov 17, 2005 at 03:18:00PM -0800, Ian Lance Taylor wrote: > I don't think you should get a warning for not using the return value of a > function, at least not under -Wunused. For this, I agree. Except that we're not talking about the return value of the function directly, we're talking a

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Richard Henderson
On Thu, Nov 17, 2005 at 03:00:42PM -0800, Joe Buck wrote: > As in the example, these cases will usually arise in macros, where under > some circumstances some computation will be wasted. Which is no different from f()+1, for which no one is arguing that the warning we give is incorrect. If you've

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Ian Lance Taylor
Richard Henderson <[EMAIL PROTECTED]> writes: > On Thu, Nov 17, 2005 at 02:01:56PM -0800, Ian Lance Taylor wrote: > > We traditionally do not warn about not using the value returned by a > > function. And I don't see why adding a cast should change that. > > Intuitively, a cast by itself is not a

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Joe Buck
On Thu, Nov 17, 2005 at 02:54:48PM -0800, Richard Henderson wrote: > On Thu, Nov 17, 2005 at 02:01:56PM -0800, Ian Lance Taylor wrote: > > We traditionally do not warn about not using the value returned by a > > function. And I don't see why adding a cast should change that. > > Intuitively, a cas

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Richard Henderson
On Thu, Nov 17, 2005 at 02:01:56PM -0800, Ian Lance Taylor wrote: > We traditionally do not warn about not using the value returned by a > function. And I don't see why adding a cast should change that. > Intuitively, a cast by itself is not a computation. In many cases is certainly is -- it's a

Re: [RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Ian Lance Taylor
Aldy Hernandez <[EMAIL PROTECTED]> writes: > this reduces to: > > int f(void); > void g(void) > { (unsigned) f(); } > > Which was made to deliberately warn by Joseph's patch here: > > http://gcc.gnu.org/ml/gcc-patches/2005-08/msg00275.html > > I closed the bug as a WONT

[RFC] PR/24900: computed but not used cast values

2005-11-17 Thread Aldy Hernandez
Hi folks. In this PR we are emitting a "value computed is not used" warning for the following code (via some fancy macro expansion in the Linux kernel): unsigned long t(void); void apic_write_atomic(unsigned long reg, unsigned int v) { ((__typeof__(*((volatile un