summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-09-25 02:38:54 +0200
committerMitya Selivanov <automainint@guattari.tech>2023-09-25 02:38:54 +0200
commit7ca3f68ac2aa6ee7cee632f8cd72cc3ef6c4faa9 (patch)
tree27d511f75fe832e6e77854fe3c85403e313b2baa /source
parent541477736dc9d0c7fc358413a5910e6d513c29eb (diff)
downloadkit-7ca3f68ac2aa6ee7cee632f8cd72cc3ef6c4faa9.zip
fix impl include order bug
Diffstat (limited to 'source')
-rw-r--r--source/kit/kit_test.h57
1 files changed, 33 insertions, 24 deletions
diff --git a/source/kit/kit_test.h b/source/kit/kit_test.h
index 0f07b32..910bdf1 100644
--- a/source/kit/kit_test.h
+++ b/source/kit/kit_test.h
@@ -289,26 +289,37 @@ int kit_run_benchmarks(int argc, char **argv);
# define run_benchmarks kit_run_benchmarks
#endif
-#ifdef KIT_TEST_IMPLEMENTATION
+#ifdef __cplusplus
+}
+#endif
-# ifndef KIT_TIME_H
-# define KIT_TIME_H
+#endif
-# include <time.h>
+#if defined(KIT_TEST_IMPLEMENTATION) && !defined(KIT_TEST_H_IMPL)
+#define KIT_TEST_H_IMPL
-# ifndef TIME_UTC
-# define TIME_UTC 1
-# endif
+#ifdef __cplusplus
+extern "C" {
+#endif
-# ifdef KIT_REQUIRE_TIMESPEC_GET
-# ifndef WIN32_LEAN_AND_MEAN
-# define WIN32_LEAN_AND_MEAN 1
-# endif
-# include <windows.h>
+#ifndef KIT_TIME_H
+# define KIT_TIME_H
-# define KIT_TIMESPEC_IMPL_UNIX_EPOCH_IN_TICKS \
- 116444736000000000ull
-# define KIT_TIMESPEC_IMPL_TICKS_PER_SECONDS 10000000ull
+# include <time.h>
+
+# ifndef TIME_UTC
+# define TIME_UTC 1
+# endif
+
+# ifdef KIT_REQUIRE_TIMESPEC_GET
+# ifndef WIN32_LEAN_AND_MEAN
+# define WIN32_LEAN_AND_MEAN 1
+# endif
+# include <windows.h>
+
+# define KIT_TIMESPEC_IMPL_UNIX_EPOCH_IN_TICKS \
+ 116444736000000000ull
+# define KIT_TIMESPEC_IMPL_TICKS_PER_SECONDS 10000000ull
static int timespec_get(struct timespec *ts, int base) {
if (ts == NULL || base != TIME_UTC)
@@ -328,15 +339,15 @@ static int timespec_get(struct timespec *ts, int base) {
return base;
}
-# endif
-
# endif
-# include <setjmp.h>
-# include <signal.h>
-# include <stdio.h>
-# include <stdlib.h>
-# include <string.h>
+#endif
+
+#include <setjmp.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
enum {
kit_white_,
@@ -1095,8 +1106,6 @@ int kit_run_benchmarks(int argc, char **argv) {
return status;
}
-#endif
-
#ifdef __cplusplus
}
#endif