summaryrefslogtreecommitdiff
path: root/tools/qa
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2021-10-27 10:09:31 +0200
committerLuboš Luňák <l.lunak@collabora.com>2021-10-27 18:36:59 +0200
commited43620c007e7fa8eb3a4ea49a90d2171b8de594 (patch)
tree728c45ebf91b3bfc6d4d7f8cb7318906ff23d2cd /tools/qa
parent7ba33498303b5c9761d14feb03074d8392e15b2e (diff)
CPU-specific files should not include templates or inlines
Otherwise the possible copy emitted compiled with CPU-specific instructions might be chosen as the copy to keep and would be used by generic code. See history for the Calc Kahan code. Change-Id: Ifc1bbd8d9720d9effe05b8ff8ee5e804363939df Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124257 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'tools/qa')
-rw-r--r--tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx10
-rw-r--r--tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx13
-rw-r--r--tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx9
3 files changed, 16 insertions, 16 deletions
diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx
index b5948223752c..39c18e5314e0 100644
--- a/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx
+++ b/tools/qa/cppunit/test_cpu_runtime_detection_AVX2_check.cxx
@@ -10,17 +10,17 @@
#include <sal/types.h>
#include <tools/simdsupport.hxx>
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
+#include <stdlib.h>
#include "test_cpu_runtime_detection_x86_checks.hxx"
/* WARNING: This file is compiled with AVX2 support, don't call
* any function without checking cpuid to check the CPU can actually
- * handle it.
+ * handle it, and don't include any headers that contain templates
+ * or inline functions, which includes cppunit.
*/
+#define CPPUNIT_ASSERT_EQUAL(a, b) ((a) == (b) ? (void)0 : abort())
+
void CpuRuntimeDetectionX86Checks::checkAVX2()
{
#ifdef LO_AVX2_AVAILABLE
diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx
index 14bcc78717d8..4b706cd5c1de 100644
--- a/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx
+++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSE2_check.cxx
@@ -10,15 +10,16 @@
#include <sal/types.h>
#include <tools/simdsupport.hxx>
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
-
-#include <tools/cpuid.hxx>
+#include <stdlib.h>
#include "test_cpu_runtime_detection_x86_checks.hxx"
+/* WARNING: This file is compiled with SSE2 support, don't call
+ * any function without checking cpuid to check the CPU can actually
+ * handle it, and don't include any headers that contain templates
+ * or inline functions, which includes cppunit.
+ */
+#define CPPUNIT_ASSERT_EQUAL(a, b) ((a) == (b) ? (void)0 : abort())
void CpuRuntimeDetectionX86Checks::checkSSE2()
{
#ifdef LO_SSE2_AVAILABLE
diff --git a/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx
index 5fd46e62c185..5e7c0b3e2a75 100644
--- a/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx
+++ b/tools/qa/cppunit/test_cpu_runtime_detection_SSSE3_check.cxx
@@ -10,17 +10,16 @@
#include <sal/types.h>
#include <tools/simdsupport.hxx>
-#include <cppunit/TestAssert.h>
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-#include <cppunit/plugin/TestPlugIn.h>
+#include <stdlib.h>
#include "test_cpu_runtime_detection_x86_checks.hxx"
/* WARNING: This file is compiled with SSSE3 support, don't call
* any function without checking cpuid to check the CPU can actually
- * handle it.
+ * handle it, and don't include any headers that contain templates
+ * or inline functions, which includes cppunit.
*/
+#define CPPUNIT_ASSERT_EQUAL(a, b) ((a) == (b) ? (void)0 : abort())
void CpuRuntimeDetectionX86Checks::checkSSSE3()
{
#ifdef LO_SSSE3_AVAILABLE