From b986f6b63ef2b6800247b969584f6eadc6ad1309 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Wed, 13 Jun 2012 09:59:08 +0100 Subject: [PATCH] Take _GNU_SOURCE out of source and put it in CFLAGS --- Rakefile | 21 +++++++++++++++++++-- src/control.c | 1 - src/ioutil.c | 3 --- src/nbdtypes.h | 5 +---- src/serve.h | 4 ---- 5 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Rakefile b/Rakefile index 34ccc32..41054f1 100644 --- a/Rakefile +++ b/Rakefile @@ -12,7 +12,9 @@ TEST_SOURCES = FileList['tests/*.c'] TEST_OBJECTS = TEST_SOURCES.pathmap( "%{^tests,build/tests}X.o" ) LIBS = %w( pthread ) -CCFLAGS = %w( -Wall +CCFLAGS = %w( + -D_GNU_SOURCE=1 + -Wall -Wextra -Werror-implicit-function-declaration -Wstrict-prototypes @@ -129,8 +131,23 @@ file check("serve") => gcc_link t.name, t.prerequisites + [LIBCHECK] end +file check("readwrite") => +%w{build/tests/check_readwrite.o + build/readwrite.o + build/client.o + build/self_pipe.o + build/serve.o + build/parse.o + build/acl.o + build/control.o + build/nbdtypes.o + build/ioutil.o + build/util.o} do |t| + gcc_link t.name, t.prerequisites + [LIBCHECK] +end -(TEST_MODULES- %w{acl client serve}).each do |m| + +(TEST_MODULES- %w{acl client serve readwrite}).each do |m| tgt = "build/tests/check_#{m}.o" deps = ["build/ioutil.o", "build/util.o"] maybe_obj_name = "build/#{m}.o" diff --git a/src/control.c b/src/control.c index 33c6d42..3d381ad 100644 --- a/src/control.c +++ b/src/control.c @@ -227,7 +227,6 @@ int control_mirror(struct control_params* client, int linesc, char** lines) remote_size = socket_nbd_read_hello(fd); - remote_size = remote_size; // shush compiler mirror = xmalloc(sizeof(struct mirror_status)); mirror->client = fd; diff --git a/src/ioutil.c b/src/ioutil.c index 442189d..0d1883c 100644 --- a/src/ioutil.c +++ b/src/ioutil.c @@ -1,6 +1,3 @@ -#define _LARGEFILE64_SOURCE -#define _GNU_SOURCE - #include #include #include diff --git a/src/nbdtypes.h b/src/nbdtypes.h index f902aa1..5f3cfaf 100644 --- a/src/nbdtypes.h +++ b/src/nbdtypes.h @@ -10,10 +10,7 @@ #define REQUEST_READ 0 #define REQUEST_WRITE 1 #define REQUEST_DISCONNECT 2 - -#ifndef _LARGEFILE64_SOURCE -# define _LARGEFILE64_SOURCE -#endif +#define REQUEST_ENTRUST (1<<16) #include #include diff --git a/src/serve.h b/src/serve.h index 558a1d2..bc750d9 100644 --- a/src/serve.h +++ b/src/serve.h @@ -1,10 +1,6 @@ #ifndef SERVE_H #define SERVE_H -#define _GNU_SOURCE - -#define _LARGEFILE64_SOURCE - #include #include