From d64d0389118ec6ceaf414096f5a215e3d721a1c9 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 30 Aug 2020 10:06:17 -0700 Subject: [PATCH] ircd::spirit: Adjust generator_state linkage for clang/gcc. --- include/ircd/spirit/generate.h | 8 +++++++- ircd/parse.cc | 6 ++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/include/ircd/spirit/generate.h b/include/ircd/spirit/generate.h index 672802fe6..5c5f5a59a 100644 --- a/include/ircd/spirit/generate.h +++ b/include/ircd/spirit/generate.h @@ -14,6 +14,12 @@ /// it involves extremely expensive boost headers for creating formal spirit /// grammars. This file is automatically included in the spirit.h group. +#ifdef __clang__ + #define IRCD_SPIRIT_GSPTR_LINKAGE static +#else + #define IRCD_SPIRIT_GSPTR_LINKAGE extern +#endif + namespace ircd { namespace spirit __attribute__((visibility("default"))) @@ -21,7 +27,7 @@ __attribute__((visibility("default"))) IRCD_EXCEPTION(error, generator_error); IRCD_EXCEPTION(generator_error, buffer_overrun); - static thread_local struct generator_state *generator_state {nullptr}; + IRCD_SPIRIT_GSPTR_LINKAGE thread_local struct generator_state *generator_state; extern thread_local char generator_buffer[8][64_KiB]; }} diff --git a/ircd/parse.cc b/ircd/parse.cc index 739f9d62d..dbddf94a6 100644 --- a/ircd/parse.cc +++ b/ircd/parse.cc @@ -28,6 +28,12 @@ decltype(ircd::spirit::rule_buffer) ircd::spirit::rule_buffer alignas(64); +#ifndef __clang__ +thread_local +decltype(ircd::spirit::generator_state) +ircd::spirit::generator_state; +#endif + thread_local decltype(ircd::spirit::generator_buffer) ircd::spirit::generator_buffer