From 0dc319e510a9a4d6e709588e81d7f4fda6a3c080 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 25 Sep 2025 13:17:12 +0200 Subject: [PATCH] Fix compilation on older gcc versions required pod type for __thread --- src/ifcparse/IfcLogger.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ifcparse/IfcLogger.cpp b/src/ifcparse/IfcLogger.cpp index 5cd13b0bbb..5595550c3e 100644 --- a/src/ifcparse/IfcLogger.cpp +++ b/src/ifcparse/IfcLogger.cpp @@ -33,7 +33,7 @@ #include #include -static my_thread_local boost::optional current_product_; +static my_thread_local const IfcUtil::IfcBaseClass* current_product_; namespace { @@ -63,11 +63,11 @@ template <> const std::array, 5> severity_strings::value = {L"Performance", L"Debug", L"Notice", L"Warning", L"Error"}; template -void plain_text_message(T& out, const boost::optional& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) { +void plain_text_message(T& out, const IfcUtil::IfcBaseClass* current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) { out << "[" << severity_strings::value[type] << "] "; out << "[" << get_time(type <= Logger::LOG_PERF).c_str() << "] "; if (current_product) { - std::string global_id = (*current_product)->as()->get("GlobalId"); + std::string global_id = current_product->as()->get("GlobalId"); out << "{" << global_id.c_str() << "} "; } out << message.c_str() << std::endl; @@ -90,7 +90,7 @@ std::basic_string string_as(const std::string& string) { } template -void json_message(T& out, const boost::optional& current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) { +void json_message(T& out, const IfcUtil::IfcBaseClass* current_product, Logger::Severity type, const std::string& message, const IfcUtil::IfcBaseInterface* instance) { boost::property_tree::basic_ptree, std::basic_string> property_tree; // @todo this is crazy @@ -103,7 +103,7 @@ void json_message(T& out, const boost::optional& c property_tree.put(level_string, severity_strings::value[type]); if (current_product) { std::ostringstream oss; - (*current_product)->toString(oss); + current_product->toString(oss); property_tree.put(product_string, string_as(oss.str())); } property_tree.put(message_string, string_as(message)); @@ -133,7 +133,7 @@ void Logger::SetProduct(boost::optional product) { PrintPerformanceStats(); performance_statistics_.clear(); } - current_product_ = product; + current_product_ = product.get_value_or(nullptr); } void Logger::SetOutput(std::ostream* stream1, std::ostream* stream2) {