From 630afde3fd3844b898f37d5d7749be076b10ec61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Obiltschnig?= Date: Mon, 12 Apr 2021 20:15:30 +0200 Subject: [PATCH] #3086: Use POCO_IOS_INIT_HACK for Linux in combination with libc++ --- Foundation/include/Poco/StreamUtil.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Foundation/include/Poco/StreamUtil.h b/Foundation/include/Poco/StreamUtil.h index 79c94f549..a77b0e630 100644 --- a/Foundation/include/Poco/StreamUtil.h +++ b/Foundation/include/Poco/StreamUtil.h @@ -55,11 +55,11 @@ // // In this scenario, std::ios::init() is called twice // (the first time by the MyIOS constructor, the second -// time by the std::istream constructor), resulting in -// two locale objects being allocated, the pointer second -// one overwriting the pointer to the first one and thus +// time by the std::istream constructor), resulting in +// two locale objects being allocated, the pointer second +// one overwriting the pointer to the first one and thus // causing a memory leak. -// +// // The workaround is to call init() only once for each // stream object - by the istream, ostream or iostream // constructor, and not calling init() in ios-derived @@ -77,6 +77,9 @@ # define POCO_IOS_INIT_HACK 1 // QNX with Dinkumware but not GNU C++ Library # elif defined(__QNX__) && !defined(__GLIBCPP__) +# define POCO_IOS_INIT_HACK 1 + // Linux with Clang libc++ +# elif defined(__linux) && defined(_LIBCPP_VERSION) # define POCO_IOS_INIT_HACK 1 # endif #endif