steveyen/moxi

macro doing check generates warning on gcc, breaking build

Closed this issue · 1 comments

gcc -std=gnu99 -DHAVE_CONFIG_H -I. -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DNDEBUG -DHAVE_CONFLATE_H -I./libmemcached-0.29 -I./../libconflate -I./../libstrophe -I/home/ubuntu/proxybuild/libstrophe -I/home/ubuntu/proxybuild/libconflate -g -O2 -Werror -pedantic -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -MT moxi-work.o -MD -MP -MF .deps/moxi-work.Tpo -c -o moxi-work.o test -f 'work.c' || echo './'work.c
cc1: warnings being treated as errors
work.c: In function ‘work_recv’:
work.c:104: error: ignoring return value of ‘read’, declared with attribute warn_unused_result
make[2]: *** [moxi-work.o] Error 1

quick (ugly) workaround:
$ git diff
diff --git a/work.c b/work.c
index 425476a..2894229 100644
--- a/work.c
+++ b/work.c
@@ -101,7 +101,10 @@ void work_recv(int fd, short which, void *arg) {
//
pthread_mutex_lock(&m->work_lock);

  • read(fd, buf, 1);

  • int readrv = read(fd, buf, 1);

  • assert(readrv == 1);

  • if (readrv != 1)

  •  exit(-1);
    

    curr = m->work_head;
    m->work_head = NULL;

added read() return value test