From: Christian Heller Date: Wed, 26 Mar 2014 20:10:38 +0000 (+0100) Subject: Enforce C11 via Makefile, explicate POSIX dependencies in source files. X-Git-Tag: tce~796 X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/%7B%7Bprefix%7D%7D/static/blog?a=commitdiff_plain;h=169b8dda5f4c4373300b5be5edc113a376799737;p=plomrogue Enforce C11 via Makefile, explicate POSIX dependencies in source files. --- diff --git a/Makefile b/Makefile index 39414e5..96c3aca 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC=gcc -CFLAGS=-Wall -Wextra -Werror -Wformat-security -g +CFLAGS=-std=c11 -pedantic-errors -Wall -Werror -Wextra -Wformat-security -g TARGET_SERVER=roguelike-server TARGET_CLIENT=roguelike-client SRCDIR=src diff --git a/src/client/draw_wins.c b/src/client/draw_wins.c index ed7815e..e31dcc4 100644 --- a/src/client/draw_wins.c +++ b/src/client/draw_wins.c @@ -1,5 +1,6 @@ /* src/client/draw_wins.c */ +#define _POSIX_C_SOURCE 200809L /* strdup() */ #include "draw_wins.h" #include /* typedefs attr_t, chtype, define A_REVERSE */ #include /* NULL */ diff --git a/src/client/interface_conf.c b/src/client/interface_conf.c index 57dff9a..c668376 100644 --- a/src/client/interface_conf.c +++ b/src/client/interface_conf.c @@ -1,5 +1,6 @@ /* src/client/interface_conf.c */ +#define _POSIX_C_SOURCE 2 /* getopt(), optarg */ #include "interface_conf.h" #include /* delwin() */ #include /* uint8_t, uint32_t */ diff --git a/src/client/io.c b/src/client/io.c index 477700f..1995b14 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -1,5 +1,6 @@ /* src/client/io.c */ +#define _POSIX_C_SOURCE 1 /* PIPE_BUF */ #include "io.h" #include /* PIPE_BUF */ #include /* halfdelay(), getch() */ diff --git a/src/client/main.c b/src/client/main.c index a0cb82c..569d6f6 100644 --- a/src/client/main.c +++ b/src/client/main.c @@ -1,5 +1,6 @@ /* main.c */ +#define _POSIX_C_SOURCE 1 /* struct sigaction, sigaction() */ #include /* keypad() */ #include /* struct sigaction, sigaction() */ #include /* NULL */ diff --git a/src/client/windows.c b/src/client/windows.c index 28654b4..e84d652 100644 --- a/src/client/windows.c +++ b/src/client/windows.c @@ -1,5 +1,6 @@ /* src/client/windows.c */ +#define _POSIX_C_SOURCE 200809L /* strnlen() */ #include "windows.h" #include /* chtype, getmaxx(), getmaxy(), erase(), werase(), * endwin(), delwin(), wnoutrefresh(), pnoutrefresh(), diff --git a/src/server/init.c b/src/server/init.c index 3bbd503..3a83c34 100644 --- a/src/server/init.c +++ b/src/server/init.c @@ -1,5 +1,6 @@ /* src/server/init.c */ +#define _POSIX_C_SOURCE 2 /* getopt(), optarg */ #include "init.h" #include /* global errno, EEXIST */ #include /* NULL */