From d6c3426b84dd74c093987b3dc5b3a2cd4f97111d Mon Sep 17 00:00:00 2001 From: Erik Ekman Date: Thu, 29 May 2014 18:37:40 +0200 Subject: [PATCH] Set C standard to C99 Also include strings.h where strcasecmp() is used --- src/Makefile | 2 +- src/client.c | 1 + src/dns.c | 1 + src/iodined.c | 1 + src/osflags | 2 +- tests/Makefile | 2 +- 6 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Makefile b/src/Makefile index 5fbfbbd..83c00e5 100644 --- a/src/Makefile +++ b/src/Makefile @@ -10,7 +10,7 @@ HEAD_COMMIT = `git rev-parse --short HEAD` LIBPATH = -L. LDFLAGS += -lz `sh osflags $(TARGETOS) link` $(LIBPATH) -CFLAGS += -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\" +CFLAGS += -std=c99 -c -g -Wall -D$(OS) -pedantic `sh osflags $(TARGETOS) cflags` -DGITREVISION=\"$(HEAD_COMMIT)\" all: stateos $(CLIENT) $(SERVER) diff --git a/src/client.c b/src/client.c index efb0f51..e3a1479 100644 --- a/src/client.c +++ b/src/client.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include diff --git a/src/dns.c b/src/dns.c index bd1257f..2bd4a2c 100644 --- a/src/dns.c +++ b/src/dns.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #ifdef WINDOWS32 diff --git a/src/iodined.c b/src/iodined.c index 75979d9..6ebf3a6 100644 --- a/src/iodined.c +++ b/src/iodined.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include diff --git a/src/osflags b/src/osflags index 2d8a03b..9eda8f0 100755 --- a/src/osflags +++ b/src/osflags @@ -33,7 +33,7 @@ cflags) echo '-Dsocklen_t=int'; ;; Linux) - FLAGS=""; + FLAGS="-D_GNU_SOURCE" [ -e /usr/include/selinux/selinux.h ] && FLAGS="$FLAGS -DHAVE_SETCON"; [ -e /usr/include/systemd/sd-daemon.h ] && FLAGS="$FLAGS -DHAVE_SYSTEMD"; echo $FLAGS; diff --git a/tests/Makefile b/tests/Makefile index 07210dc..43310eb 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -6,7 +6,7 @@ OS = `uname | tr "a-z" "A-Z"` CHECK_PATH = /usr/local LDFLAGS = -L$(CHECK_PATH)/lib `pkg-config check --libs` -lpthread `sh ../src/osflags $(TARGETOS) link` -CFLAGS = -g -Wall -D$(OS) `pkg-config check --cflags` -I../src -I$(CHECK_PATH)/include -pedantic `sh ../src/osflags $(TARGETOS) cflags` +CFLAGS = -std=c99 -g -Wall -D$(OS) `pkg-config check --cflags` -I../src -I$(CHECK_PATH)/include -pedantic `sh ../src/osflags $(TARGETOS) cflags` all: $(TEST) @LD_LIBRARY_PATH=${CHECK_PATH}/lib ./$(TEST)