summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2023-02-02 16:19:11 +0200
committerIlmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>2023-02-03 07:13:52 +0000
commitc544f9ea78eab46c4f5230273a5a8571b28ea84d (patch)
tree21a9f4cbdc862d604b2094798a935d27899fb35f
parent2422e1b0418d057e08ef08251e8638d1478631fe (diff)
Use raw string literal in opencl to keep PMD static analyser happy
Change-Id: Ibf2bd12b79c6e7c7eae59fc516e75c1bda971a7c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146502 Tested-by: Jenkins Tested-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakangas@libreoffice.org>
-rw-r--r--opencl/source/opencl_device.cxx18
1 files changed, 8 insertions, 10 deletions
diff --git a/opencl/source/opencl_device.cxx b/opencl/source/opencl_device.cxx
index ca9f4f43b5d1..e8712cb5a745 100644
--- a/opencl/source/opencl_device.cxx
+++ b/opencl/source/opencl_device.cxx
@@ -30,8 +30,6 @@
#define INPUTSIZE 15360
#define OUTPUTSIZE 15360
-#define STRINGIFY(...) #__VA_ARGS__"\n"
-
namespace {
void DS_CHECK_STATUS(cl_int status, char const * name) {
@@ -55,13 +53,13 @@ struct LibreOfficeDeviceEvaluationIO
tools::ULong outputSize;
};
-const char* source = STRINGIFY(
-\n#if defined(KHR_DP_EXTENSION)
-\n#pragma OPENCL EXTENSION cl_khr_fp64 : enable
-\n#elif defined(AMD_DP_EXTENSION)
-\n#pragma OPENCL EXTENSION cl_amd_fp64 : enable
-\n#endif
- \n
+const char* source = R"delimit(
+#if defined(KHR_DP_EXTENSION)
+#pragma OPENCL EXTENSION cl_khr_fp64 : enable
+#elif defined(AMD_DP_EXTENSION)
+#pragma OPENCL EXTENSION cl_amd_fp64 : enable
+#endif
+
int isNan(fp_t a) { return a != a; }
fp_t fsum(fp_t a, fp_t b) { return a + b; }
@@ -108,7 +106,7 @@ const char* source = STRINGIFY(
fp_t tmp1 = fMin(input1) * fSoP(input2, input3);
result[gid0] = fsum(tmp0, tmp1);
}
- );
+ )delimit";
size_t sourceSize[] = { strlen(source) };