From ac8bcc6868e64e10dbebb109fe9cdeb621351390 Mon Sep 17 00:00:00 2001 From: Pavel V Chupin Date: Wed, 28 Sep 2022 15:04:29 -0700 Subject: [PATCH] [SYCL][NFC] Rename major/minor to ocl_major/ocl_minor Workaround to avoid conflict with system macros on older systems. See https://bugzilla.redhat.com/show_bug.cgi?id=130601 --- sycl/plugins/opencl/pi_opencl.hpp | 42 +++++++++++++++---------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/sycl/plugins/opencl/pi_opencl.hpp b/sycl/plugins/opencl/pi_opencl.hpp index 179d0566c3088..7835df8c4cb6e 100644 --- a/sycl/plugins/opencl/pi_opencl.hpp +++ b/sycl/plugins/opencl/pi_opencl.hpp @@ -31,50 +31,50 @@ namespace OCLV { class OpenCLVersion { protected: - unsigned int major; - unsigned int minor; + unsigned int ocl_major; + unsigned int ocl_minor; public: - OpenCLVersion() : major(0), minor(0) {} + OpenCLVersion() : ocl_major(0), ocl_minor(0) {} - OpenCLVersion(unsigned int major, unsigned int minor) - : major(major), minor(minor) { + OpenCLVersion(unsigned int ocl_major, unsigned int ocl_minor) + : ocl_major(ocl_major), ocl_minor(ocl_minor) { if (!isValid()) - major = minor = 0; + ocl_major = ocl_minor = 0; } OpenCLVersion(const char *version) : OpenCLVersion(std::string(version)) {} - OpenCLVersion(const std::string &version) : major(0), minor(0) { + OpenCLVersion(const std::string &version) : ocl_major(0), ocl_minor(0) { /* The OpenCL specification defines the full version string as - * 'OpenCL' for platforms and as - * 'OpenCL' for devices. */ std::regex rx("OpenCL ([0-9]+)\\.([0-9]+)"); std::smatch match; if (std::regex_search(version, match, rx) && (match.size() == 3)) { - major = strtoul(match[1].str().c_str(), nullptr, 10); - minor = strtoul(match[2].str().c_str(), nullptr, 10); + ocl_major = strtoul(match[1].str().c_str(), nullptr, 10); + ocl_minor = strtoul(match[2].str().c_str(), nullptr, 10); if (!isValid()) - major = minor = 0; + ocl_major = ocl_minor = 0; } } bool operator==(const OpenCLVersion &v) const { - return major == v.major && minor == v.minor; + return ocl_major == v.ocl_major && ocl_minor == v.ocl_minor; } bool operator!=(const OpenCLVersion &v) const { return !(*this == v); } bool operator<(const OpenCLVersion &v) const { - if (major == v.major) - return minor < v.minor; + if (ocl_major == v.ocl_major) + return ocl_minor < v.ocl_minor; - return major < v.major; + return ocl_major < v.ocl_major; } bool operator>(const OpenCLVersion &v) const { return v < *this; } @@ -88,21 +88,21 @@ class OpenCLVersion { } bool isValid() const { - switch (major) { + switch (ocl_major) { case 0: return false; case 1: case 2: - return minor <= 2; + return ocl_minor <= 2; case UINT_MAX: return false; default: - return minor != UINT_MAX; + return ocl_minor != UINT_MAX; } } - int getMajor() const { return major; } - int getMinor() const { return minor; } + int getMajor() const { return ocl_major; } + int getMinor() const { return ocl_minor; } }; inline const OpenCLVersion V1_0(1, 0);