Skip to content

Commit c3d5a4a

Browse files
committed
Convert error codes to lower case
This avoids a clash with e.g. `#define SUCCESS 0` in another header somewhere.
1 parent 5b2f1d2 commit c3d5a4a

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

sycl/doc/syclcompat/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1544,10 +1544,10 @@ SYCL spec supported by the current SYCL compiler.
15441544
15451545
The `SYCLCOMPAT_CHECK_ERROR` macro encapsulates an error-handling mechanism for
15461546
expressions that might throw `sycl::exception` and `std::runtime_error`. If no
1547-
exceptions are thrown, it returns `syclcompat::error_code::SUCCESS`. If a
1548-
`sycl::exception` is caught, it returns `syclcompat::error_code::BACKEND_ERROR`.
1547+
exceptions are thrown, it returns `syclcompat::error_code::success`. If a
1548+
`sycl::exception` is caught, it returns `syclcompat::error_code::backend_error`.
15491549
If a `std::runtime_error` exception is caught,
1550-
`syclcompat::error_code::DEFAULT_ERROR` is returned instead. For both cases, it
1550+
`syclcompat::error_code::default_error` is returned instead. For both cases, it
15511551
prints the error message to the standard error stream.
15521552
15531553
``` c++
@@ -1580,7 +1580,7 @@ template <int Arg> class syclcompat_kernel_scalar;
15801580
15811581
15821582
namespace syclcompat {
1583-
enum error_code { SUCCESS = 0, BACKEND_ERROR = 1, DEFAULT_ERROR = 999 };
1583+
enum error_code { success = 0, backend_error = 1, default_error = 999 };
15841584
}
15851585
15861586
#define SYCLCOMPAT_CHECK_ERROR(expr)

sycl/include/syclcompat/defs.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,19 @@ template <int Arg> class syclcompat_kernel_scalar;
6767
SYCLCOMPAT_PATCH_VERSION)
6868

6969
namespace syclcompat {
70-
enum error_code { SUCCESS = 0, BACKEND_ERROR = 1, DEFAULT_ERROR = 999 };
70+
enum error_code { success = 0, backend_error = 1, default_error = 999 };
7171
}
7272

7373
#define SYCLCOMPAT_CHECK_ERROR(expr) \
7474
[&]() { \
7575
try { \
7676
expr; \
77-
return syclcompat::error_code::SUCCESS; \
77+
return syclcompat::error_code::success; \
7878
} catch (sycl::exception const &e) { \
7979
std::cerr << e.what() << std::endl; \
80-
return syclcompat::error_code::BACKEND_ERROR; \
80+
return syclcompat::error_code::backend_error; \
8181
} catch (std::runtime_error const &e) { \
8282
std::cerr << e.what() << std::endl; \
83-
return syclcompat::error_code::DEFAULT_ERROR; \
83+
return syclcompat::error_code::default_error; \
8484
} \
8585
}()

sycl/test-e2e/syclcompat/defs.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ void test_check_error() {
5454
throw std::runtime_error("Expected invalid exception in test_check_error");
5555
};
5656

57-
assert(syclcompat::error_code::SUCCESS == SYCLCOMPAT_CHECK_ERROR());
58-
assert(syclcompat::error_code::BACKEND_ERROR ==
57+
assert(syclcompat::error_code::success == SYCLCOMPAT_CHECK_ERROR());
58+
assert(syclcompat::error_code::backend_error ==
5959
SYCLCOMPAT_CHECK_ERROR(sycl_error_throw()));
60-
assert(syclcompat::error_code::DEFAULT_ERROR ==
60+
assert(syclcompat::error_code::default_error ==
6161
SYCLCOMPAT_CHECK_ERROR(runtime_error_throw()));
6262
}
6363

0 commit comments

Comments
 (0)