OS X 10.6.1 compile fail

0 views
Skip to first unread message

Johan Bergström

unread,
Nov 20, 2009, 8:48:04 AM11/20/09
to beanstalk-talk
..caused by this commit: http://github.com/kr/beanstalkd/commit/6e0675e2a610bdc14315eee04080516c768468ac

# make
make all-am
make[1]: Entering directory `/Users/jbergstroem/Sites/beanstalkd'
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -Werror -I/g2/usr/include -c
-o beanstalkd.o beanstalkd.c
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -Werror -I/g2/usr/include -c
-o binlog.o binlog.c
cc1: warnings being treated as errors
binlog.c: In function 'binlog_close':
binlog.c:264: warning: statement with no effect
make[1]: *** [binlog.o] Error 1
make[1]: Leaving directory `/Users/jbergstroem/Sites/beanstalkd'
make: *** [all] Error 2
zsh: exit 2 make

Johan Bergström

unread,
Nov 20, 2009, 8:53:41 AM11/20/09
to beanstalk-talk
How about something like:

commit 0a02e0d6e863aa2fc805462b5f5527a244a1a6e7
Author: Johan Bergström <bu...@bergstroem.nu>
Date: Fri Nov 20 14:51:13 2009 +0100

10.6 build fix

diff --git a/binlog.c b/binlog.c
index 8e2ab64..377eac9 100644
--- a/binlog.c
+++ b/binlog.c
@@ -261,7 +261,7 @@ binlog_close(binlog b)
{
if (!b) return;
if (b->fd < 0) return;
- if (b->free) 0 && ftruncate(b->fd, lseek(b->fd, b->free,
SEEK_END));
+ if (b->free) (void) ftruncate(b->fd, lseek(b->fd, b->free,
SEEK_END));
close(b->fd);
b->fd = -1;
binlog_dref(b);

Graham Barr

unread,
Nov 24, 2009, 2:18:48 PM11/24/09
to beansta...@googlegroups.com
I agree this would be the correct fix for the compiler warnings

Any chance of a v1.4.3 soon ?

2009/11/20 Johan Bergström <bu...@bergstroem.nu>:
> --
>
> You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
> To post to this group, send email to beansta...@googlegroups.com.
> To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=.
>
>
>

Keith Rarick

unread,
Nov 24, 2009, 11:51:09 PM11/24/09
to beansta...@googlegroups.com
On Tue, Nov 24, 2009 at 11:18 AM, Graham Barr <gmb...@gmail.com> wrote:
> I agree this would be the correct fix for the compiler warnings

Will fix.

> Any chance of a v1.4.3 soon ?

Yes, I've been holding off because of the bug fixing going on. I'm
working on it right now, though.

kr

Keith Rarick

unread,
Nov 25, 2009, 12:37:41 AM11/25/09
to beansta...@googlegroups.com
On Tue, Nov 24, 2009 at 8:51 PM, Keith Rarick <k...@xph.us> wrote:
> On Tue, Nov 24, 2009 at 11:18 AM, Graham Barr <gmb...@gmail.com> wrote:
>> I agree this would be the correct fix for the compiler warnings
>
> Will fix.

I spoke too soon. Johan's patch returns me to my original state:

$ make
make all-am
make[1]: Entering directory `/home/kr/src/beanstalkd'
gcc -DHAVE_CONFIG_H -I. -g -O2 -Wall -Werror -I/usr/include -c -o
binlog.o binlog.c
cc1: warnings being treated as errors
binlog.c: In function ‘binlog_close’:
binlog.c:264: error: ignoring return value of ‘ftruncate’, declared
with attribute warn_unused_result
make[1]: *** [binlog.o] Error 1
make[1]: Leaving directory `/home/kr/src/beanstalkd'
make: *** [all] Error 2

I don't know how to suppress just this instance of this warning
without breaking the build somewhere.

kr

Johan Bergström

unread,
Nov 26, 2009, 3:17:37 PM11/26/09
to beanstalk-talk
Keith,
without knowing too much about your environment, here goes.
This is not very pretty since we now actually "care" about return
value, but does it work?!? :-)

commit 0e5d281a6b93c781091e902441579f79d9621c2e
Author: Johan Bergström <bu...@bergstroem.nu>
Date: Thu Nov 26 21:15:17 2009 +0100

Another stab at fixing ftruncate warnings. This time it gets ugly

diff --git a/binlog.c b/binlog.c
index 377eac9..56675f8 100644
--- a/binlog.c
+++ b/binlog.c
@@ -259,9 +259,10 @@ binlog_read_log_file(binlog b, job binlog_jobs)
static void
binlog_close(binlog b)
{
+ int unused;
if (!b) return;
if (b->fd < 0) return;
- if (b->free) (void) ftruncate(b->fd, lseek(b->fd, b->free,
SEEK_END));
+ if (b->free) unused = ftruncate(b->fd, lseek(b->fd, b->free,
SEEK_END));
close(b->fd);
b->fd = -1;
binlog_dref(b);




Keith Rarick

unread,
Nov 27, 2009, 3:36:17 PM11/27/09
to beansta...@googlegroups.com
Yeah, it works. Thanks. I will commit a slightly different version of
the same idea, with explanatory comments.

kr

2009/11/26 Johan Bergström <bu...@bergstroem.nu>:
> --
>
> You received this message because you are subscribed to the Google Groups "beanstalk-talk" group.
> To post to this group, send email to beansta...@googlegroups.com.
> To unsubscribe from this group, send email to beanstalk-tal...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/beanstalk-talk?hl=en.
>
>
>
Reply all
Reply to author
Forward
0 new messages