[Libreoffice-commits] core.git: 2 commits - sc/CppunitTest_sc_opencl_test.mk sc/CppunitTest_sc_ucalc.mk sc/source

Tor Lillqvist tml at collabora.com
Wed Oct 29 08:17:09 PDT 2014


 sc/CppunitTest_sc_opencl_test.mk         |    7 
 sc/CppunitTest_sc_ucalc.mk               |    7 
 sc/source/core/inc/clcc/clew.h           | 1316 +++++++++++++++++++++++++++++++
 sc/source/core/inc/formulagroupcl.hxx    |   41 
 sc/source/core/inc/openclwrapper.hxx     |  111 ++
 sc/source/core/opencl/clcc/clew.cxx      |    2 
 sc/source/core/opencl/clcc/clew.h        | 1316 -------------------------------
 sc/source/core/opencl/formulagroupcl.cxx |   58 -
 sc/source/core/opencl/openclwrapper.hxx  |  111 --
 sc/source/core/tool/formulagroup.cxx     |   22 
 10 files changed, 1494 insertions(+), 1497 deletions(-)

New commits:
commit 3bdee6495ebc7f515d6d297e7f7df9a46acc3880
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Oct 29 17:12:13 2014 +0200

    Avoid pointless thin wrapper layer
    
    Also works around some warnings from our Clang plug-ins.
    
    Change-Id: Ic9d2bbafefac345b6319300514735143f92dd196

diff --git a/sc/source/core/opencl/clcc/clew.h b/sc/source/core/inc/clcc/clew.h
similarity index 100%
rename from sc/source/core/opencl/clcc/clew.h
rename to sc/source/core/inc/clcc/clew.h
diff --git a/sc/source/core/inc/formulagroupcl.hxx b/sc/source/core/inc/formulagroupcl.hxx
new file mode 100644
index 0000000..9325b25
--- /dev/null
+++ b/sc/source/core/inc/formulagroupcl.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
+#define INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
+
+#include "formulagroup.hxx"
+
+namespace sc { namespace opencl {
+
+class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter
+{
+public:
+    FormulaGroupInterpreterOpenCL() :
+        FormulaGroupInterpreter()
+    {
+    }
+    virtual ~FormulaGroupInterpreterOpenCL()
+    {
+    }
+
+    virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE;
+    virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc,
+        const ScAddress& rTopPos,
+        ScFormulaCellGroup& rGroup,
+        ScTokenArray& rCode ) SAL_OVERRIDE;
+    virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos,
+        ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE;
+};
+
+}} // namespace sc::opencl
+
+#endif // INCLUDED_SC_SOURCE_CORE_INC_FORMULAGROUPCL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/opencl/openclwrapper.hxx b/sc/source/core/inc/openclwrapper.hxx
similarity index 100%
rename from sc/source/core/opencl/openclwrapper.hxx
rename to sc/source/core/inc/openclwrapper.hxx
diff --git a/sc/source/core/opencl/clcc/clew.cxx b/sc/source/core/opencl/clcc/clew.cxx
index 636c8e2..dec4cc9 100644
--- a/sc/source/core/opencl/clcc/clew.cxx
+++ b/sc/source/core/opencl/clcc/clew.cxx
@@ -4,7 +4,7 @@
 //  Distributed under the Boost Software License, Version 1.0.
 //  (See accompanying file license.txt)
 
-#include "clew.h"
+#include "clcc/clew.h"
 
 //! \file clew.c
 //! \brief OpenCL run-time loader source
diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx
index 4286050..645d889 100644
--- a/sc/source/core/opencl/formulagroupcl.cxx
+++ b/sc/source/core/opencl/formulagroupcl.cxx
@@ -8,6 +8,7 @@
  */
 
 #include "formulagroup.hxx"
+#include "formulagroupcl.hxx"
 #include "clkernelthread.hxx"
 #include "grouptokenconverter.hxx"
 #include "document.hxx"
@@ -3510,26 +3511,6 @@ const DynamicKernelArgument* SymbolTable::DeclRefArg(
     }
 }
 
-class FormulaGroupInterpreterOpenCL : public FormulaGroupInterpreter
-{
-public:
-    FormulaGroupInterpreterOpenCL() :
-        FormulaGroupInterpreter()
-    {
-    }
-    virtual ~FormulaGroupInterpreterOpenCL()
-    {
-    }
-
-    virtual ScMatrixRef inverseMatrix( const ScMatrix& rMat ) SAL_OVERRIDE;
-    virtual CompiledFormula* createCompiledFormula( ScDocument& rDoc,
-        const ScAddress& rTopPos,
-        ScFormulaCellGroup& rGroup,
-        ScTokenArray& rCode ) SAL_OVERRIDE;
-    virtual bool interpret( ScDocument& rDoc, const ScAddress& rTopPos,
-        ScFormulaCellGroupRef& xGroup, ScTokenArray& rCode ) SAL_OVERRIDE;
-};
-
 ScMatrixRef FormulaGroupInterpreterOpenCL::inverseMatrix( const ScMatrix& )
 {
     return NULL;
@@ -3730,41 +3711,4 @@ bool FormulaGroupInterpreterOpenCL::interpret( ScDocument& rDoc,
 
 }} // namespace sc::opencl
 
-extern "C" {
-
-sc::FormulaGroupInterpreter*
-createFormulaGroupOpenCLInterpreter()
-{
-    return new sc::opencl::FormulaGroupInterpreterOpenCL();
-}
-
-size_t getOpenCLPlatformCount()
-{
-    return sc::opencl::getOpenCLPlatformCount();
-}
-
-void fillOpenCLInfo(
-    sc::OpenCLPlatformInfo* pInfos, size_t nInfoSize )
-{
-    const std::vector<sc::OpenCLPlatformInfo>& rPlatforms =
-        sc::opencl::fillOpenCLInfo();
-    size_t n = std::min(rPlatforms.size(), nInfoSize);
-    for (size_t i = 0; i < n; ++i)
-        pInfos[i] = rPlatforms[i];
-}
-
-bool switchOpenCLDevice(
-    const OUString* pDeviceId, bool bAutoSelect,
-    bool bForceEvaluation )
-{
-    return sc::opencl::switchOpenCLDevice(pDeviceId, bAutoSelect, bForceEvaluation);
-}
-
-void getOpenCLDeviceInfo( size_t* pDeviceId, size_t* pPlatformId )
-{
-    sc::opencl::getOpenCLDeviceInfo(*pDeviceId, *pPlatformId);
-}
-
-} // extern "C"
-
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 376b22d..9d61efa 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -10,6 +10,7 @@
 #include <config_features.h>
 
 #include "formulagroup.hxx"
+#include "formulagroupcl.hxx"
 #include "document.hxx"
 #include "formulacell.hxx"
 #include "tokenarray.hxx"
@@ -31,11 +32,7 @@
 
 #if HAVE_FEATURE_OPENCL
 
-extern "C" size_t getOpenCLPlatformCount(void);
-extern "C" void fillOpenCLInfo(sc::OpenCLPlatformInfo*, size_t);
-extern "C" bool switchOpenCLDevice(const OUString*, bool, bool);
-extern "C" sc::FormulaGroupInterpreter* createFormulaGroupOpenCLInterpreter();
-extern "C" void getOpenCLDeviceInfo(size_t*, size_t*);
+#include "openclwrapper.hxx"
 
 #endif
 
@@ -543,13 +540,14 @@ void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rP
 #if !HAVE_FEATURE_OPENCL
     (void) rPlatforms;
 #else
-    size_t nPlatforms = ::getOpenCLPlatformCount();
+    size_t nPlatforms = sc::opencl::getOpenCLPlatformCount();
     if (!nPlatforms)
         return;
 
-    std::vector<OpenCLPlatformInfo> aPlatforms(nPlatforms);
-    ::fillOpenCLInfo(&aPlatforms[0], aPlatforms.size());
-    rPlatforms.swap(aPlatforms);
+    const std::vector<sc::OpenCLPlatformInfo>& rPlatformsFromWrapper =
+        sc::opencl::fillOpenCLInfo();
+
+    rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());
 #endif
 }
 
@@ -571,7 +569,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
         return true;
     }
 #if HAVE_FEATURE_OPENCL
-    bool bSuccess = ::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
+    bool bSuccess = sc::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
     if(!bSuccess)
         return false;
 #else
@@ -584,7 +582,7 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
 #if HAVE_FEATURE_OPENCL
     if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled )
     {
-        msInstance = ::createFormulaGroupOpenCLInterpreter();
+        msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL();
         return msInstance != NULL;
     }
 #else
@@ -606,7 +604,7 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
     size_t aDeviceId = static_cast<size_t>(-1);
     size_t aPlatformId = static_cast<size_t>(-1);
 
-    ::getOpenCLDeviceInfo(&aDeviceId, &aPlatformId);
+    sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
     rDeviceId = aDeviceId;
     rPlatformId = aPlatformId;
 #endif
commit 66884ac67e248c24b3872bb6ff316ae35c7c1aba
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Oct 29 17:11:47 2014 +0200

    Need -ldl on Linux now
    
    Change-Id: I3a207f86611a5078cd2de1437cd48e612232aaf2

diff --git a/sc/CppunitTest_sc_opencl_test.mk b/sc/CppunitTest_sc_opencl_test.mk
index 16ebd5e..8fa8837 100644
--- a/sc/CppunitTest_sc_opencl_test.mk
+++ b/sc/CppunitTest_sc_opencl_test.mk
@@ -107,6 +107,13 @@ $(eval $(call gb_CppunitTest_use_components,sc_opencl_test,\
     xmloff/util/xo \
 ))
 
+ifeq ($(OS),LINUX)
+$(eval $(call gb_CppunitTest_add_libs,sc_opencl_test,\
+    -ldl \
+	-lrt \
+))
+endif
+
 $(eval $(call gb_CppunitTest_use_configuration,sc_opencl_test))
 
 $(eval $(call gb_CppunitTest_use_filter_configuration,sc_opencl_test))
diff --git a/sc/CppunitTest_sc_ucalc.mk b/sc/CppunitTest_sc_ucalc.mk
index 7fa3369..9c5606e6 100644
--- a/sc/CppunitTest_sc_ucalc.mk
+++ b/sc/CppunitTest_sc_ucalc.mk
@@ -106,6 +106,13 @@ $(eval $(call gb_CppunitTest_use_components,sc_ucalc,\
     uui/util/uui \
 ))
 
+ifeq ($(OS),LINUX)
+$(eval $(call gb_CppunitTest_add_libs,sc_ucalc,\
+    -ldl \
+	-lrt \
+))
+endif
+
 $(eval $(call gb_CppunitTest_use_configuration,sc_ucalc))
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list