|
enum oroApi |
|
{ |
|
ORO_API_AUTOMATIC = 1<<0, |
|
ORO_API_HIPDRIVER = 1 << 1, |
|
ORO_API_HIPRTC = 1 << 2, |
|
ORO_API_HIP = ORO_API_HIPDRIVER | ORO_API_HIPRTC, |
|
ORO_API_CUDADRIVER = 1 << 3, |
|
ORO_API_CUDARTC = 1 << 4, |
|
ORO_API_CUDA = ORO_API_CUDADRIVER | ORO_API_CUDARTC, |
|
}; |
The union (i.e., bitwise OR operation) of
oroApi elements is not an element of
oroApi. But the current API deign forces us to cast the union to
oroApi, such as
oroInitialize(static_cast<oroApi>(ORO_API_HIP | ORO_API_CUDA,.
|
int oroInitialize( oroApi api, oroU32 flags, |
For this case, the Clang analyzer can detect the out of range for
oroApi and warns. To avoid such out of range, it may be better to change the function parameter type from
oroApi to
uint32_t.
Orochi/Orochi/Orochi.h
Lines 1161 to 1170 in e8da229
The union (i.e., bitwise OR operation) of
oroApielements is not an element oforoApi. But the current API deign forces us to cast the union tooroApi, such asoroInitialize(static_cast<oroApi>(ORO_API_HIP | ORO_API_CUDA,.Orochi/Orochi/Orochi.h
Line 1257 in e8da229
For this case, the Clang analyzer can detect the out of range for
oroApiand warns. To avoid such out of range, it may be better to change the function parameter type fromoroApitouint32_t.