Merge pull request #218 from ChrisKitching/nodiscard
Add [[nodiscard]] attribute to hipError_t in C++17 mode
[ROCm/clr commit: 9713dbb6f6]
This commit is contained in:
@@ -143,6 +143,13 @@ typedef struct hipPointerAttribute_t {
|
||||
*
|
||||
*/
|
||||
|
||||
// Ignoring error-code return values from hip APIs is discouraged. On C++17,
|
||||
// we can make that yield a warning
|
||||
#if __cplusplus >= 201703L
|
||||
#define __HIP_NODISCARD [[nodiscard]]
|
||||
#else
|
||||
#define __HIP_NODISCARD
|
||||
#endif
|
||||
|
||||
/*
|
||||
* @brief hipError_t
|
||||
@@ -152,7 +159,7 @@ typedef struct hipPointerAttribute_t {
|
||||
// Developer note - when updating these, update the hipErrorName and hipErrorString functions in NVCC and HCC paths
|
||||
// Also update the hipCUDAErrorTohipError function in NVCC path.
|
||||
|
||||
typedef enum hipError_t {
|
||||
typedef enum __HIP_NODISCARD hipError_t {
|
||||
hipSuccess = 0, ///< Successful completion.
|
||||
hipErrorOutOfMemory = 2,
|
||||
hipErrorNotInitialized = 3,
|
||||
@@ -219,6 +226,8 @@ typedef enum hipError_t {
|
||||
hipErrorTbd ///< Marker that more error codes are needed.
|
||||
} hipError_t;
|
||||
|
||||
#undef __HIP_NODISCARD
|
||||
|
||||
/*
|
||||
* @brief hipDeviceAttribute_t
|
||||
* @enum
|
||||
|
||||
Reference in New Issue
Block a user