From 4b1fb6c3be9f810c1ddceddc6536f7687c23197d Mon Sep 17 00:00:00 2001 From: johannst Date: Tue, 29 Sep 2020 02:15:18 +0200 Subject: replace compile_guard with umbrella header for arch --- lib/Makefile | 2 +- lib/arch.h | 13 +++++++++++++ lib/compile_guard.cc | 5 ----- lib/executor.cc | 2 +- lib/thread.cc | 2 +- 5 files changed, 16 insertions(+), 8 deletions(-) create mode 100644 lib/arch.h delete mode 100644 lib/compile_guard.cc diff --git a/lib/Makefile b/lib/Makefile index 1416c9d..5ddabff 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -8,7 +8,7 @@ AR := ar ARCH := x86_64 -libmatcha.a: compile_guard.o thread.o executor.o \ +libmatcha.a: thread.o executor.o \ thread.h executor.h \ arch/$(ARCH)/thread_create.o arch/$(ARCH)/yield.o \ arch/$(ARCH)/init_stack.o \ diff --git a/lib/arch.h b/lib/arch.h new file mode 100644 index 0000000..fc86cad --- /dev/null +++ b/lib/arch.h @@ -0,0 +1,13 @@ +/* Copyright (c) 2020 Johannes Stoelp */ + +#pragma once + +#if !defined(linux) +static_assert(false, "Matcha Threads only supported on Linux!"); +#endif + +#if defined(__x86_64__) || defined(__amd64__) +# include "arch/x86_64/api.h" +#else +static_assert(false, "Matcha Threads only supported on x86_64!"); +#endif diff --git a/lib/compile_guard.cc b/lib/compile_guard.cc deleted file mode 100644 index 61c7ad5..0000000 --- a/lib/compile_guard.cc +++ /dev/null @@ -1,5 +0,0 @@ -/* Copyright (c) 2020 Johannes Stoelp */ - -#if !defined(linux) || (!defined(__x86_64__) && !defined(__amd64__)) -static_assert(false, "Matcha Threads only supported on Linux x86_64!"); -#endif diff --git a/lib/executor.cc b/lib/executor.cc index 175d7a5..bd068c6 100644 --- a/lib/executor.cc +++ b/lib/executor.cc @@ -2,7 +2,7 @@ #include "executor.h" -#include "arch/x86_64/api.h" +#include "arch.h" namespace nMatcha { void Executor::spawn(std::unique_ptr t) { diff --git a/lib/thread.cc b/lib/thread.cc index e25fa5a..31161ab 100644 --- a/lib/thread.cc +++ b/lib/thread.cc @@ -2,7 +2,7 @@ #include "thread.h" -#include "arch/x86_64/api.h" +#include "arch.h" #include "executor.h" #include -- cgit v1.2.3