summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorMitya Selivanov <automainint@guattari.tech>2023-01-01 20:08:31 +0100
committerMitya Selivanov <automainint@guattari.tech>2023-01-01 20:08:31 +0100
commit86d86462b420f098ee34a022cffd922e3192dabe (patch)
tree20770c3ba0d29ef920ada35ca8609a28e4d0294f /source
parente6451dae35a962fba59a450b2a22d80e64399fe4 (diff)
downloadkit-86d86462b420f098ee34a022cffd922e3192dabe.zip
Remove ANSI C option; add pedantic gcc flag
Diffstat (limited to 'source')
-rw-r--r--source/kit/CMakeLists.txt5
-rw-r--r--source/kit/async_function.h12
-rw-r--r--source/kit/lower_bound.c1
-rw-r--r--source/kit/thread.posix.c11
-rw-r--r--source/kit/thread.win32.c11
-rw-r--r--source/test/unittests/async_function.test.c22
6 files changed, 31 insertions, 31 deletions
diff --git a/source/kit/CMakeLists.txt b/source/kit/CMakeLists.txt
index 101e2a8..4113668 100644
--- a/source/kit/CMakeLists.txt
+++ b/source/kit/CMakeLists.txt
@@ -3,9 +3,8 @@ target_sources(
PRIVATE
input_buffer.c bigint.c status.c secure_random.c
thread.posix.c atomic.win32.c condition_variable.c thread.win32.c
- move_back.c input_stream.c lower_bound.c file.c string_ref.c
- async_function.c allocator.c array_ref.c dynamic_array.c mutex.c
- mersenne_twister_64.c
+ move_back.c input_stream.c file.c string_ref.c async_function.c
+ allocator.c array_ref.c dynamic_array.c mutex.c mersenne_twister_64.c
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/mutex.h>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/status.h>
diff --git a/source/kit/async_function.h b/source/kit/async_function.h
index 73e3fee..1791291 100644
--- a/source/kit/async_function.h
+++ b/source/kit/async_function.h
@@ -190,12 +190,12 @@ typedef struct {
((promise_)._state_machine(&(promise_), kit_af_request_join), \
(promise_).return_value)
-#define KIT_AF_JOIN_N(promises_, size_) \
- do { \
- int kit_af_index_; \
- for (kit_af_index_ = 0; kit_af_index_ < (size_); \
- kit_af_index_++) \
- KIT_AF_JOIN((promises_)[kit_af_index_]); \
+#define KIT_AF_JOIN_N(promises_, size_) \
+ do { \
+ int kit_af_index_; \
+ for (kit_af_index_ = 0; kit_af_index_ < (size_); \
+ kit_af_index_++) \
+ (void) KIT_AF_JOIN((promises_)[kit_af_index_]); \
} while (0)
#define KIT_AF_RESUME_AND_JOIN(promise_) \
diff --git a/source/kit/lower_bound.c b/source/kit/lower_bound.c
deleted file mode 100644
index 0ae8489..0000000
--- a/source/kit/lower_bound.c
+++ /dev/null
@@ -1 +0,0 @@
-#include "lower_bound.h"
diff --git a/source/kit/thread.posix.c b/source/kit/thread.posix.c
index 12bdd05..192dca4 100644
--- a/source/kit/thread.posix.c
+++ b/source/kit/thread.posix.c
@@ -1,11 +1,12 @@
+#include "thread.h"
+
+#include "allocator.h"
+#include "condition_variable.h"
+#include "mutex.h"
+
#ifndef KIT_DISABLE_SYSTEM_THREADS
# if !defined(_WIN32) || defined(__CYGWIN__)
-# include "allocator.h"
-# include "condition_variable.h"
-# include "mutex.h"
-# include "thread.h"
-
# include <assert.h>
# include <errno.h>
# include <limits.h>
diff --git a/source/kit/thread.win32.c b/source/kit/thread.win32.c
index e483c4e..94f6e89 100644
--- a/source/kit/thread.win32.c
+++ b/source/kit/thread.win32.c
@@ -1,3 +1,9 @@
+#include "thread.h"
+
+#include "allocator.h"
+#include "condition_variable.h"
+#include "mutex.h"
+
#ifndef KIT_DISABLE_SYSTEM_THREADS
# if defined(_WIN32) && !defined(__CYGWIN__)
@@ -8,11 +14,6 @@
# include <stdbool.h>
# include <stdlib.h>
-# include "allocator.h"
-# include "condition_variable.h"
-# include "mutex.h"
-# include "thread.h"
-
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN 1
# endif
diff --git a/source/test/unittests/async_function.test.c b/source/test/unittests/async_function.test.c
index 320f323..6ec8825 100644
--- a/source/test/unittests/async_function.test.c
+++ b/source/test/unittests/async_function.test.c
@@ -142,29 +142,29 @@ TEST("coroutine generator") {
TEST("coroutine status finished") {
AF_CREATE(promise, test_bar);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(AF_FINISHED(promise));
}
TEST("coroutine task") {
AF_CREATE(promise, test_task);
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(AF_FINISHED(promise));
}
TEST("coroutine nested task") {
AF_CREATE(promise, test_nest_task);
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(AF_FINISHED(promise));
}
@@ -174,7 +174,7 @@ TEST("coroutine nested generator") {
REQUIRE(AF_RESUME_AND_JOIN(promise) == 2);
REQUIRE(AF_RESUME_AND_JOIN(promise) == 3);
REQUIRE(!AF_FINISHED(promise));
- AF_RESUME_AND_JOIN(promise);
+ (void) AF_RESUME_AND_JOIN(promise);
REQUIRE(AF_FINISHED(promise));
}
@@ -198,7 +198,7 @@ TEST("coroutine custom execution context lazy") {
AF_RESUME(promise);
REQUIRE(promise.return_value == 0);
REQUIRE(!AF_FINISHED(promise));
- AF_JOIN(promise);
+ (void) AF_JOIN(promise);
REQUIRE(promise.return_value == 42);
REQUIRE(AF_FINISHED(promise));
}
@@ -210,7 +210,7 @@ TEST("coroutine custom execution context immediate") {
AF_RESUME(promise);
REQUIRE(promise.return_value == 42);
REQUIRE(AF_FINISHED(promise));
- AF_JOIN(promise);
+ (void) AF_JOIN(promise);
REQUIRE(promise.return_value == 42);
REQUIRE(AF_FINISHED(promise));
}