Sophie

Sophie

distrib > Mageia > 6 > armv7hl > media > core-release-src > by-pkgid > edbb6dca6d5be5d8becb78ed3ef0fe79 > files > 5

kst-2.0.8-5.mga6.src.rpm

From 53c7ac919b52212020a2778892db850cb9ac0bfa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Peter=20K=C3=BCmmel?= <syntheticpp@gmx.net>
Date: Tue, 5 Aug 2014 17:05:16 +0200
Subject: [PATCH] disable last value option in ascii reader when thread local
 is not available

---
 CMakeLists.txt                              | 7 +------
 src/datasources/CMakeLists.txt              | 5 +++++
 src/datasources/ascii/asciiconfigwidget.cpp | 4 ++++
 src/datasources/ascii/asciisource.cpp       | 2 ++
 src/datasources/ascii/kst_atof.h            | 6 +++++-
 5 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 692a626..5bfde3f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -90,12 +90,7 @@ else()
     set(CPACK_PACKAGE_INSTALL_DIRECTORY "Kst ${kst_version}")
 endif()
 
-if(MINGW)
-    execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
-    message(STATUS "Using GCC version ${GCC_VERSION}")
-endif()
-
-if(MINGW)
+if(CMAKE_COMPILER_IS_GNUCC)
     execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
     message(STATUS "Using GCC version ${GCC_VERSION}")
 endif()
diff --git a/src/datasources/CMakeLists.txt b/src/datasources/CMakeLists.txt
index 3d703d8..88dbb9d 100644
--- a/src/datasources/CMakeLists.txt
+++ b/src/datasources/CMakeLists.txt
@@ -6,6 +6,11 @@ if(MSVC OR MINGW)
 	add_definitions(-DKST_USE_KST_ATOF)
 endif()
 
+if(CMAKE_COMPILER_IS_GNUCC AND NOT GCC_VERSION VERSION_GREATER 4.2)
+    add_definitions(-DKST_NO_THREAD_LOCAL)
+endif()
+
+
 if(UNIX)
   # speedup on Linux x2.7
   add_definitions(-DKST_USE_KST_ATOF)
diff --git a/src/datasources/ascii/asciiconfigwidget.cpp b/src/datasources/ascii/asciiconfigwidget.cpp
index ac5a82b..f84ab65 100644
--- a/src/datasources/ascii/asciiconfigwidget.cpp
+++ b/src/datasources/ascii/asciiconfigwidget.cpp
@@ -55,6 +55,10 @@ AsciiConfigWidgetInternal::AsciiConfigWidgetInternal(QWidget *parent) :
   QObject::connect(_formattedString, SIGNAL(toggled(bool)), this, SLOT(interpretationChanged(bool)));
   QObject::connect(_previewButton, SIGNAL(clicked()), this, SLOT(showPreviewWindow()));
   //QObject::connect(_timeAsciiFormatString, SIGNAL(textEdited(QString)), this, SLOT(testAsciiFormatString(QString)));
+
+#ifdef KST_NO_THREAD_LOCAL
+  _nanPrevious->hide();
+#endif
 }
 
 void AsciiConfigWidgetInternal::testAsciiFormatString(QString format) {
diff --git a/src/datasources/ascii/asciisource.cpp b/src/datasources/ascii/asciisource.cpp
index d260152..ad53216 100644
--- a/src/datasources/ascii/asciisource.cpp
+++ b/src/datasources/ascii/asciisource.cpp
@@ -451,7 +451,9 @@ int AsciiSource::tryReadField(double *v, const QString& field, int s, int n)
   switch (_config._nanValue.value()) {
   case 0: nanMode = LexicalCast::NullValue; break;
   case 1: nanMode = LexicalCast::NaNValue; break;
+#ifndef KST_NO_THREAD_LOCAL
   case 2: nanMode = LexicalCast::PreviousValue; break;
+#endif
   default:nanMode = LexicalCast::NullValue; break;
   }
   LexicalCast::AutoReset useDot(_config._useDot, nanMode);
diff --git a/src/datasources/ascii/kst_atof.h b/src/datasources/ascii/kst_atof.h
index 280425f..d62c236 100644
--- a/src/datasources/ascii/kst_atof.h
+++ b/src/datasources/ascii/kst_atof.h
@@ -22,7 +22,11 @@
 #ifdef Q_CC_MSVC
   #define KST_THREAD_LOCAL __declspec(thread)
 #else
- #define KST_THREAD_LOCAL __thread
+ #ifndef KST_NO_THREAD_LOCAL
+   #define KST_THREAD_LOCAL __thread
+  #else
+   #define KST_THREAD_LOCAL
+  #endif
 #endif
 
 class LexicalCast
-- 
2.2.0