From 4af0dd65843eea6a52af9edf09d00a109be25a54 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Tue, 25 Jul 2017 12:00:35 +0200 Subject: [PATCH] fix for plugin mechanism on clang --- include/villas/plugin.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/villas/plugin.h b/include/villas/plugin.h index e5309f164..ff4792fa3 100644 --- a/include/villas/plugin.h +++ b/include/villas/plugin.h @@ -35,6 +35,7 @@ #include "nodes/cbuilder.h" +/** @todo This is ugly as hell and broken on OS X / Clang anyway. */ #define REGISTER_PLUGIN(p) \ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {\ if (plugins.state == STATE_DESTROYED) \ @@ -42,7 +43,8 @@ __attribute__((constructor(110))) static void UNIQUE(__ctor)() {\ list_push(&plugins, p); \ } \ __attribute__((destructor(110))) static void UNIQUE(__dtor)() { \ - list_remove(&plugins, p); \ + if (plugins.state != STATE_DESTROYED) \ + list_remove(&plugins, p); \ } extern struct list plugins;