Skip to content

Commit cc51a64

Browse files
author
Pavel Chupin
authored
[SYCL][NFC] Rename major/minor to ocl_major/ocl_minor (#6906)
Workaround to avoid conflict with system macros on older systems. See https://bugzilla.redhat.com/show_bug.cgi?id=130601
1 parent 1621c13 commit cc51a64

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

sycl/plugins/opencl/pi_opencl.hpp

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -31,50 +31,50 @@
3131
namespace OCLV {
3232
class OpenCLVersion {
3333
protected:
34-
unsigned int major;
35-
unsigned int minor;
34+
unsigned int ocl_major;
35+
unsigned int ocl_minor;
3636

3737
public:
38-
OpenCLVersion() : major(0), minor(0) {}
38+
OpenCLVersion() : ocl_major(0), ocl_minor(0) {}
3939

40-
OpenCLVersion(unsigned int major, unsigned int minor)
41-
: major(major), minor(minor) {
40+
OpenCLVersion(unsigned int ocl_major, unsigned int ocl_minor)
41+
: ocl_major(ocl_major), ocl_minor(ocl_minor) {
4242
if (!isValid())
43-
major = minor = 0;
43+
ocl_major = ocl_minor = 0;
4444
}
4545

4646
OpenCLVersion(const char *version) : OpenCLVersion(std::string(version)) {}
4747

48-
OpenCLVersion(const std::string &version) : major(0), minor(0) {
48+
OpenCLVersion(const std::string &version) : ocl_major(0), ocl_minor(0) {
4949
/* The OpenCL specification defines the full version string as
50-
* 'OpenCL<space><major_version.minor_version><space><platform-specific
50+
* 'OpenCL<space><ocl_major_version.ocl_minor_version><space><platform-specific
5151
* information>' for platforms and as
52-
* 'OpenCL<space><major_version.minor_version><space><vendor-specific
52+
* 'OpenCL<space><ocl_major_version.ocl_minor_version><space><vendor-specific
5353
* information>' for devices.
5454
*/
5555
std::regex rx("OpenCL ([0-9]+)\\.([0-9]+)");
5656
std::smatch match;
5757

5858
if (std::regex_search(version, match, rx) && (match.size() == 3)) {
59-
major = strtoul(match[1].str().c_str(), nullptr, 10);
60-
minor = strtoul(match[2].str().c_str(), nullptr, 10);
59+
ocl_major = strtoul(match[1].str().c_str(), nullptr, 10);
60+
ocl_minor = strtoul(match[2].str().c_str(), nullptr, 10);
6161

6262
if (!isValid())
63-
major = minor = 0;
63+
ocl_major = ocl_minor = 0;
6464
}
6565
}
6666

6767
bool operator==(const OpenCLVersion &v) const {
68-
return major == v.major && minor == v.minor;
68+
return ocl_major == v.ocl_major && ocl_minor == v.ocl_minor;
6969
}
7070

7171
bool operator!=(const OpenCLVersion &v) const { return !(*this == v); }
7272

7373
bool operator<(const OpenCLVersion &v) const {
74-
if (major == v.major)
75-
return minor < v.minor;
74+
if (ocl_major == v.ocl_major)
75+
return ocl_minor < v.ocl_minor;
7676

77-
return major < v.major;
77+
return ocl_major < v.ocl_major;
7878
}
7979

8080
bool operator>(const OpenCLVersion &v) const { return v < *this; }
@@ -88,21 +88,21 @@ class OpenCLVersion {
8888
}
8989

9090
bool isValid() const {
91-
switch (major) {
91+
switch (ocl_major) {
9292
case 0:
9393
return false;
9494
case 1:
9595
case 2:
96-
return minor <= 2;
96+
return ocl_minor <= 2;
9797
case UINT_MAX:
9898
return false;
9999
default:
100-
return minor != UINT_MAX;
100+
return ocl_minor != UINT_MAX;
101101
}
102102
}
103103

104-
int getMajor() const { return major; }
105-
int getMinor() const { return minor; }
104+
int getMajor() const { return ocl_major; }
105+
int getMinor() const { return ocl_minor; }
106106
};
107107

108108
inline const OpenCLVersion V1_0(1, 0);

0 commit comments

Comments
 (0)