Take _GNU_SOURCE out of source and put it in CFLAGS

This commit is contained in:
Alex Young
2012-06-13 09:59:08 +01:00
parent c7525f87dc
commit b986f6b63e
5 changed files with 20 additions and 14 deletions

View File

@@ -12,7 +12,9 @@ TEST_SOURCES = FileList['tests/*.c']
TEST_OBJECTS = TEST_SOURCES.pathmap( "%{^tests,build/tests}X.o" ) TEST_OBJECTS = TEST_SOURCES.pathmap( "%{^tests,build/tests}X.o" )
LIBS = %w( pthread ) LIBS = %w( pthread )
CCFLAGS = %w( -Wall CCFLAGS = %w(
-D_GNU_SOURCE=1
-Wall
-Wextra -Wextra
-Werror-implicit-function-declaration -Werror-implicit-function-declaration
-Wstrict-prototypes -Wstrict-prototypes
@@ -129,8 +131,23 @@ file check("serve") =>
gcc_link t.name, t.prerequisites + [LIBCHECK] gcc_link t.name, t.prerequisites + [LIBCHECK]
end 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" tgt = "build/tests/check_#{m}.o"
deps = ["build/ioutil.o", "build/util.o"] deps = ["build/ioutil.o", "build/util.o"]
maybe_obj_name = "build/#{m}.o" maybe_obj_name = "build/#{m}.o"

View File

@@ -227,7 +227,6 @@ int control_mirror(struct control_params* client, int linesc, char** lines)
remote_size = socket_nbd_read_hello(fd); remote_size = socket_nbd_read_hello(fd);
remote_size = remote_size; // shush compiler
mirror = xmalloc(sizeof(struct mirror_status)); mirror = xmalloc(sizeof(struct mirror_status));
mirror->client = fd; mirror->client = fd;

View File

@@ -1,6 +1,3 @@
#define _LARGEFILE64_SOURCE
#define _GNU_SOURCE
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/sendfile.h> #include <sys/sendfile.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>

View File

@@ -10,10 +10,7 @@
#define REQUEST_READ 0 #define REQUEST_READ 0
#define REQUEST_WRITE 1 #define REQUEST_WRITE 1
#define REQUEST_DISCONNECT 2 #define REQUEST_DISCONNECT 2
#define REQUEST_ENTRUST (1<<16)
#ifndef _LARGEFILE64_SOURCE
# define _LARGEFILE64_SOURCE
#endif
#include <linux/types.h> #include <linux/types.h>
#include <inttypes.h> #include <inttypes.h>

View File

@@ -1,10 +1,6 @@
#ifndef SERVE_H #ifndef SERVE_H
#define SERVE_H #define SERVE_H
#define _GNU_SOURCE
#define _LARGEFILE64_SOURCE
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>