Skip to content

Commit 419edce

Browse files
committed
makefile: Revert c version from gnu17 to c17 so that it can be built on other platforms as well.
1 parent f0ab015 commit 419edce

File tree

6 files changed

+4
-12
lines changed

6 files changed

+4
-12
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ OBJS = $(DEPS:.c=.o)
2121

2222
export CC
2323

24-
CFLAGS += -std=gnu17 -Ideps -Isrc/common -Isrc/repository -Isrc/registry
24+
CFLAGS += -std=c17 -U__STRICT_ANSI__ -Ideps -Isrc/common -Isrc/repository -Isrc/registry
2525
CFLAGS += -g -Wall -Werror=return-type -Wno-unused-function $(shell curl-config --cflags)
2626

2727
ifdef STATIC

deps/url/url.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ url_data_inspect (url_data_t *data);
156156
#ifdef URL_H_IMPLEMENTATION
157157

158158
// non C99 standard functions
159-
#if _POSIX_C_SOURCE < 200809L
159+
#if _POSIX_C_SOURCE < 200809L && !(defined URL_H_NO_STRDUP)
160160
char *
161161
strdup (const char *str) {
162162
int n = strlen(str) + 1;

src/clib-build.c

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
#include <stdio.h>
1313
#include <string.h>
1414

15-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
16-
#include <unistd.h>
17-
#endif
18-
1915
#ifdef HAVE_PTHREADS
2016
#include <pthread.h>
2117
#endif

src/clib-configure.c

-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,6 @@
1212
#include <stdio.h>
1313
#include <string.h>
1414

15-
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
16-
#include <unistd.h>
17-
#endif
18-
1915
#ifdef HAVE_PTHREADS
2016
#include <pthread.h>
2117
#endif

src/clib-init.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,15 @@
77

88
#include "asprintf/asprintf.h"
99
#include "commander/commander.h"
10-
#include "common/clib-package.h"
1110
#include "debug/debug.h"
12-
#include "fs/fs.h"
1311
#include "logger/logger.h"
1412
#include "parson/parson.h"
1513
#include "version.h"
1614
#include <stdio.h>
1715
#include <stdlib.h>
1816
#include <string.h>
1917
#include <unistd.h>
18+
#include <strdup/strdup.h>
2019

2120
#if defined(_WIN32) || defined(WIN32) || defined(__MINGW32__) || \
2221
defined(__MINGW64__) || defined(__CYGWIN__)

src/common/url.c

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#define URL_H_IMPLEMENTATION
2+
#define URL_H_NO_STRDUP
23
#include "url/url.h"
34

45
// This is a bit of a hack to use url.h in multiple files.

0 commit comments

Comments
 (0)