From b4e467d63471422c1026c4064d8872a3667f24d0 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Wed, 14 Nov 2018 17:08:23 +0100 Subject: [PATCH] do not include tsc.h on non x86 archs (closes #211) --- include/villas/task.h | 7 +++++-- lib/task.c | 2 -- tests/unit/CMakeLists.txt | 5 ++++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/villas/task.h b/include/villas/task.h index aaf2caa6c..24328b45a 100644 --- a/include/villas/task.h +++ b/include/villas/task.h @@ -27,7 +27,6 @@ #include #include -#include #ifdef __cplusplus extern "C" { @@ -48,6 +47,10 @@ extern "C" { #error "Platform not supported" #endif +#if PERIODIC_TASK_IMPL == RDTSC + #include +#endif + struct task { int clock; /**< CLOCK_{MONOTONIC,REALTIME} */ @@ -62,7 +65,7 @@ struct task { #if PERIODIC_TASK_IMPL == TIMERFD int fd; /**< The timerfd_create(2) file descriptior. */ #elif PERIODIC_TASK_IMPL == RDTSC - struct tsc tsc; /**< Initialized by tsc_init(). */ + struct tsc tsc; /**< Initialized by tsc_init(). */ #endif }; diff --git a/lib/task.c b/lib/task.c index e3effbeab..583de3076 100644 --- a/lib/task.c +++ b/lib/task.c @@ -30,8 +30,6 @@ #if PERIODIC_TASK_IMPL == TIMERFD #include -#elif PERIODIC_TASK_IMPL == RDTSC - #include #endif int task_init(struct task *t, double rate, int clock) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 4ca244170..49b90abe8 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -41,10 +41,13 @@ if(CRITERION_FOUND) task.c timing.c utils.c - tsc.c hash_table.c ) + if(ARCH STREQUAL "x86_64") + list(APPEND TEST_SRC tsc.c) + endif() + add_executable(unit-tests ${TEST_SRC}) target_link_libraries(unit-tests PUBLIC PkgConfig::CRITERION