diff --git a/openmp/libomptarget/src/rtl.h b/openmp/libomptarget/src/rtl.h --- a/openmp/libomptarget/src/rtl.h +++ b/openmp/libomptarget/src/rtl.h @@ -13,6 +13,7 @@ #ifndef _OMPTARGET_RTL_H #define _OMPTARGET_RTL_H +#include "omptarget.h" #include #include #include @@ -38,33 +39,33 @@ int32_t, int32_t, int32_t, uint64_t); typedef int64_t(init_requires_ty)(int64_t); - int32_t Idx; // RTL index, index is the number of devices - // of other RTLs that were registered before, - // i.e. the OpenMP index of the first device - // to be registered with this RTL. - int32_t NumberOfDevices; // Number of devices this RTL deals with. + int32_t Idx = -1; // RTL index, index is the number of devices + // of other RTLs that were registered before, + // i.e. the OpenMP index of the first device + // to be registered with this RTL. + int32_t NumberOfDevices = -1; // Number of devices this RTL deals with. - void *LibraryHandler; + void *LibraryHandler = nullptr; #ifdef OMPTARGET_DEBUG std::string RTLName; #endif // Functions implemented in the RTL. - is_valid_binary_ty *is_valid_binary; - number_of_devices_ty *number_of_devices; - init_device_ty *init_device; - load_binary_ty *load_binary; - data_alloc_ty *data_alloc; - data_submit_ty *data_submit; - data_retrieve_ty *data_retrieve; - data_delete_ty *data_delete; - run_region_ty *run_region; - run_team_region_ty *run_team_region; - init_requires_ty *init_requires; + is_valid_binary_ty *is_valid_binary = nullptr; + number_of_devices_ty *number_of_devices = nullptr; + init_device_ty *init_device = nullptr; + load_binary_ty *load_binary = nullptr; + data_alloc_ty *data_alloc = nullptr; + data_submit_ty *data_submit = nullptr; + data_retrieve_ty *data_retrieve = nullptr; + data_delete_ty *data_delete = nullptr; + run_region_ty *run_region = nullptr; + run_team_region_ty *run_team_region = nullptr; + init_requires_ty *init_requires = nullptr; // Are there images associated with this RTL. - bool isUsed; + bool isUsed = false; // Mutex for thread-safety when calling RTL interface functions. // It is easier to enforce thread-safety at the libomptarget level, @@ -73,17 +74,9 @@ // The existence of the mutex above makes RTLInfoTy non-copyable. // We need to provide a copy constructor explicitly. - RTLInfoTy() - : Idx(-1), NumberOfDevices(-1), LibraryHandler(0), -#ifdef OMPTARGET_DEBUG - RTLName(), -#endif - is_valid_binary(0), number_of_devices(0), init_device(0), - load_binary(0), data_alloc(0), data_submit(0), data_retrieve(0), - data_delete(0), run_region(0), run_team_region(0), - init_requires(0), isUsed(false), Mtx() {} + RTLInfoTy() = default; - RTLInfoTy(const RTLInfoTy &r) : Mtx() { + RTLInfoTy(const RTLInfoTy &r) { Idx = r.Idx; NumberOfDevices = r.NumberOfDevices; LibraryHandler = r.LibraryHandler; @@ -121,9 +114,9 @@ // binaries. std::vector UsedRTLs; - int64_t RequiresFlags; + int64_t RequiresFlags = OMP_REQ_UNDEFINED; - explicit RTLsTy() {} + explicit RTLsTy() = default; // Register the clauses of the requires directive. void RegisterRequires(int64_t flags); @@ -158,9 +151,9 @@ /// Map between the host ptr and a table index struct TableMap { - TranslationTable *Table; // table associated with the host ptr. - uint32_t Index; // index in which the host ptr translated entry is found. - TableMap() : Table(0), Index(0) {} + TranslationTable *Table = nullptr; // table associated with the host ptr. + uint32_t Index = 0; // index in which the host ptr translated entry is found. + TableMap() = default; TableMap(TranslationTable *table, uint32_t index) : Table(table), Index(index) {} };