[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-12-01 Thread Carl Worth
On Mon, 23 Nov 2009 15:24:46 +0100, Jed Brown wrote: > >From the gcc man page: > >-Wunused-value >Warn whenever a statement computes a result that is explicitly >not used. To suppress this warning cast the unused expression >to void. This includes an

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Dirk-Jan Binnema
Hi Jed, On Mon, Nov 23, 2009 at 4:24 PM, Jed Brown wrote: > > > But I'm confused here because I don't currently see any warnings with > gcc-4.4.2. Actually this must be a bug because I get no warnings for > the blatantly unused > > malloc(5); > Did you try it with -O2? Without optimizations

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Jed Brown
On Mon, 23 Nov 2009 18:14:12 +0200, Dirk-Jan Binnema wrote: > Did you try it with -O2? Without optimizations many of the warnings are not > issued. Yes, $ cat > foo.c #include #include int main() { malloc(5); write(2,0,10); return 0; } $ gcc -static -std=c89 -O0 -Wall -Wextra -pedantic

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Jed Brown
On Mon, 23 Nov 2009 14:19:18 +0100, Karl Wiberg wrote: > On Mon, Nov 23, 2009 at 12:11 PM, Dirk-Jan Binnema > wrote: > > > On Mon, Nov 23, 2009 at 9:34 AM, Karl Wiberg wrote: > > > > > Didn't the "(void)" suggestion work? > > > > I actually preferred that solution, but unfortunately, it

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Karl Wiberg
On Mon, Nov 23, 2009 at 12:11 PM, Dirk-Jan Binnema wrote: > On Mon, Nov 23, 2009 at 9:34 AM, Karl Wiberg wrote: > > > Didn't the "(void)" suggestion work? > > I actually preferred that solution, but unfortunately, it didn't > stop gcc from complaining... Hmpf. I'd argue that that's a gcc bug,

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Dirk-Jan Binnema
On Mon, Nov 23, 2009 at 9:34 AM, Karl Wiberg wrote: > On Mon, Nov 23, 2009 at 7:20 AM, Dirk-Jan C. Binnema > wrote: > > > +ssize_t ignored; > > static char msg[] = "Stopping... \n"; > > -write(2, msg, sizeof(msg)-1); > > + > > +ignored = write(2, msg, sizeof(msg)-1); > >

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Karl Wiberg
On Mon, Nov 23, 2009 at 7:20 AM, Dirk-Jan C. Binnema wrote: > + ? ?ssize_t ignored; > ? ? static char msg[] = "Stopping... ? ? ? ? \n"; > - ? ?write(2, msg, sizeof(msg)-1); > + > + ? ?ignored = write(2, msg, sizeof(msg)-1); > ? ? interrupted = 1; > ?} Didn't the "(void)" suggestion work? --

[notmuch] [PATCH 1/2] * avoid gcc 4.4.1 compiler warnings due to ignored write return values

2009-11-23 Thread Dirk-Jan C. Binnema
From: Dirk-Jan C. Binnema Date: Mon, 23 Nov 2009 08:03:35 +0200 --- notmuch-new.c |4 +++- notmuch-tag.c |4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/notmuch-new.c b/notmuch-new.c index a2b30bd..3d04efa 100644 --- a/notmuch-new.c +++