From 1d914cc031ff246ac8c696ade2f38aa480115730 Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Tue, 22 Nov 2022 23:59:52 +0100 Subject: [PATCH] Linux build fixes. --- hashset/Makefile | 2 +- hashset/src/main.c | 1 + libhashset/Makefile | 2 +- libhashset/include/hash_set.h | 9 +++++++-- libhashset/src/hash_set.c | 1 + 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/hashset/Makefile b/hashset/Makefile index 206236d..31223af 100644 --- a/hashset/Makefile +++ b/hashset/Makefile @@ -13,7 +13,7 @@ endif EXE_SUFFIX := .exe endif -CFLAGS = -O3 -DNDEBUG -I../libhashset/include $(XCFLAGS) +CFLAGS = -std=c99 -O3 -DNDEBUG -D_DEFAULT_SOURCE -Wpedantic -I../libhashset/include $(XCFLAGS) SRC_PATH := src BIN_PATH := bin diff --git a/hashset/src/main.c b/hashset/src/main.c index ed2fb88..7ae47bd 100644 --- a/hashset/src/main.c +++ b/hashset/src/main.c @@ -8,6 +8,7 @@ #include #include #include +#include #ifndef _WIN32 # include diff --git a/libhashset/Makefile b/libhashset/Makefile index 55f36d2..54c5083 100644 --- a/libhashset/Makefile +++ b/libhashset/Makefile @@ -6,7 +6,7 @@ else ifneq ($(firstword $(filter i686-%,$(DUMPMACHINE))),) XCFLAGS = -march=pentiumpro -mtune=intel endif -CFLAGS = -O3 -DNDEBUG -Iinclude $(XCFLAGS) +CFLAGS = -std=c99 -O3 -DNDEBUG -Wpedantic -Iinclude $(XCFLAGS) SRC_PATH := src OBJ_PATH := obj diff --git a/libhashset/include/hash_set.h b/libhashset/include/hash_set.h index e6cca4c..471fd01 100644 --- a/libhashset/include/hash_set.h +++ b/libhashset/include/hash_set.h @@ -3,8 +3,8 @@ /* This work has been released under the CC0 1.0 Universal license! */ /******************************************************************************/ -#ifndef _INC_HASH_SET_H -#define _INC_HASH_SET_H +#ifndef _HASHSET_INCLUDED +#define _HASHSET_INCLUDED #include #include @@ -13,6 +13,11 @@ extern "C" { #endif +#if !defined(_MSC_VER) && !defined(__MINGW32__) && !defined(_ERRNO_T_DEFINED) +typedef int errno_t; +#define _ERRNO_T_DEFINED 1 +#endif + #define HASHSET_OPT_FAILFAST UINT16_C(0x1) struct _hash_set; diff --git a/libhashset/src/hash_set.c b/libhashset/src/hash_set.c index e44e76d..6ef34a5 100644 --- a/libhashset/src/hash_set.c +++ b/libhashset/src/hash_set.c @@ -8,6 +8,7 @@ /* CRT */ #include #include +#include #include typedef int bool_t;