Skip to content

Commit 12803cd

Browse files
authored
remove terminating semicolons from do-while-0 (#17554)
The whole point of surrounding a macro definition in `do { } while (0)` is to safely handle the case of missing braces in an if statement. Remove the semicolon from the definitions of `DIE_NO_IMPLEMENTATION`, and `CONTINUE_NO_IMPLEMENTATION`; and put them around all its uses.
1 parent d3123b9 commit 12803cd

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

unified-runtime/source/adapters/native_cpu/common.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ extern thread_local char ErrorMessage[MaxMessageSize];
2525
__FUNCTION__, __FILE__, __LINE__); \
2626
\
2727
return UR_RESULT_ERROR_UNSUPPORTED_FEATURE; \
28-
} while (false);
28+
} while (false)
2929

3030
#define CONTINUE_NO_IMPLEMENTATION \
3131
do { \
3232
logger::warning("Not Implemented : {} - File : {} / Line : {}", \
3333
__FUNCTION__, __FILE__, __LINE__); \
3434
return UR_RESULT_SUCCESS; \
35-
} while (false);
35+
} while (false)
3636

3737
#define CASE_UR_UNSUPPORTED(not_supported) \
3838
case not_supported: \

unified-runtime/source/adapters/native_cpu/context.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextGetNativeHandle(
6969
ur_context_handle_t hContext, ur_native_handle_t *phNativeContext) {
7070
std::ignore = hContext;
7171
std::ignore = phNativeContext;
72-
DIE_NO_IMPLEMENTATION
72+
DIE_NO_IMPLEMENTATION;
7373
}
7474

7575
UR_APIEXPORT ur_result_t UR_APICALL urContextCreateWithNativeHandle(
@@ -84,7 +84,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextCreateWithNativeHandle(
8484
std::ignore = pProperties;
8585
std::ignore = phContext;
8686

87-
DIE_NO_IMPLEMENTATION
87+
DIE_NO_IMPLEMENTATION;
8888
}
8989

9090
UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter(
@@ -94,5 +94,5 @@ UR_APIEXPORT ur_result_t UR_APICALL urContextSetExtendedDeleter(
9494
std::ignore = pfnDeleter;
9595
std::ignore = pUserData;
9696

97-
DIE_NO_IMPLEMENTATION
97+
DIE_NO_IMPLEMENTATION;
9898
}

unified-runtime/source/adapters/native_cpu/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urDeviceGetNativeHandle(
491491
std::ignore = hDevice;
492492
std::ignore = phNativeDevice;
493493

494-
DIE_NO_IMPLEMENTATION
494+
DIE_NO_IMPLEMENTATION;
495495
}
496496

497497
UR_APIEXPORT ur_result_t UR_APICALL urDeviceCreateWithNativeHandle(

unified-runtime/source/adapters/native_cpu/kernel.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ urKernelSetArgSampler(ur_kernel_handle_t hKernel, uint32_t argIndex,
251251
std::ignore = pProperties;
252252
std::ignore = hArgValue;
253253

254-
DIE_NO_IMPLEMENTATION
254+
DIE_NO_IMPLEMENTATION;
255255
}
256256

257257
UR_APIEXPORT ur_result_t UR_APICALL
@@ -290,7 +290,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelGetNativeHandle(
290290
std::ignore = hKernel;
291291
std::ignore = phNativeKernel;
292292

293-
DIE_NO_IMPLEMENTATION
293+
DIE_NO_IMPLEMENTATION;
294294
}
295295

296296
UR_APIEXPORT ur_result_t UR_APICALL urKernelCreateWithNativeHandle(
@@ -304,7 +304,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urKernelCreateWithNativeHandle(
304304
std::ignore = pProperties;
305305
std::ignore = phKernel;
306306

307-
DIE_NO_IMPLEMENTATION
307+
DIE_NO_IMPLEMENTATION;
308308
}
309309

310310
UR_APIEXPORT ur_result_t UR_APICALL urKernelGetSuggestedLocalWorkSize(

unified-runtime/source/adapters/native_cpu/memory.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreate(
2323
std::ignore = pHost;
2424
std::ignore = phMem;
2525

26-
DIE_NO_IMPLEMENTATION
26+
DIE_NO_IMPLEMENTATION;
2727
}
2828

2929
UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
@@ -65,7 +65,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreate(
6565
UR_APIEXPORT ur_result_t UR_APICALL urMemRetain(ur_mem_handle_t hMem) {
6666
std::ignore = hMem;
6767

68-
DIE_NO_IMPLEMENTATION
68+
DIE_NO_IMPLEMENTATION;
6969
}
7070

7171
UR_APIEXPORT ur_result_t UR_APICALL urMemRelease(ur_mem_handle_t hMem) {
@@ -112,7 +112,7 @@ urMemGetNativeHandle(ur_mem_handle_t hMem, ur_device_handle_t hDevice,
112112
std::ignore = hDevice;
113113
std::ignore = phNativeMem;
114114

115-
DIE_NO_IMPLEMENTATION
115+
DIE_NO_IMPLEMENTATION;
116116
}
117117

118118
UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle(
@@ -123,7 +123,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemBufferCreateWithNativeHandle(
123123
std::ignore = pProperties;
124124
std::ignore = phMem;
125125

126-
DIE_NO_IMPLEMENTATION
126+
DIE_NO_IMPLEMENTATION;
127127
}
128128

129129
UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreateWithNativeHandle(
@@ -137,7 +137,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageCreateWithNativeHandle(
137137
std::ignore = pProperties;
138138
std::ignore = phMem;
139139

140-
DIE_NO_IMPLEMENTATION
140+
DIE_NO_IMPLEMENTATION;
141141
}
142142

143143
UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
@@ -151,7 +151,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemGetInfo(ur_mem_handle_t hMemory,
151151
std::ignore = pPropValue;
152152
std::ignore = pPropSizeRet;
153153

154-
DIE_NO_IMPLEMENTATION
154+
DIE_NO_IMPLEMENTATION;
155155
}
156156

157157
UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory,
@@ -165,5 +165,5 @@ UR_APIEXPORT ur_result_t UR_APICALL urMemImageGetInfo(ur_mem_handle_t hMemory,
165165
std::ignore = pPropValue;
166166
std::ignore = pPropSizeRet;
167167

168-
DIE_NO_IMPLEMENTATION
168+
DIE_NO_IMPLEMENTATION;
169169
}

unified-runtime/source/adapters/native_cpu/program.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ urProgramCreateWithIL(ur_context_handle_t hContext, const void *pIL,
2626
std::ignore = pProperties;
2727
std::ignore = phProgram;
2828

29-
DIE_NO_IMPLEMENTATION
29+
DIE_NO_IMPLEMENTATION;
3030
}
3131

3232
static ur_result_t
@@ -206,7 +206,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetFunctionPointer(
206206
std::ignore = pFunctionName;
207207
std::ignore = ppFunctionPointer;
208208

209-
DIE_NO_IMPLEMENTATION
209+
DIE_NO_IMPLEMENTATION;
210210
}
211211

212212
UR_APIEXPORT ur_result_t UR_APICALL urProgramGetGlobalVariablePointer(
@@ -218,7 +218,7 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramGetGlobalVariablePointer(
218218
std::ignore = pGlobalVariableSizeRet;
219219
std::ignore = ppGlobalVariablePointerRet;
220220

221-
DIE_NO_IMPLEMENTATION
221+
DIE_NO_IMPLEMENTATION;
222222
}
223223

224224
UR_APIEXPORT ur_result_t UR_APICALL
@@ -264,7 +264,7 @@ urProgramGetBuildInfo(ur_program_handle_t hProgram, ur_device_handle_t hDevice,
264264
std::ignore = pPropValue;
265265
std::ignore = pPropSizeRet;
266266

267-
CONTINUE_NO_IMPLEMENTATION
267+
CONTINUE_NO_IMPLEMENTATION;
268268
}
269269

270270
UR_APIEXPORT ur_result_t UR_APICALL urProgramSetSpecializationConstants(
@@ -274,15 +274,15 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramSetSpecializationConstants(
274274
std::ignore = count;
275275
std::ignore = pSpecConstants;
276276

277-
DIE_NO_IMPLEMENTATION
277+
DIE_NO_IMPLEMENTATION;
278278
}
279279

280280
UR_APIEXPORT ur_result_t UR_APICALL urProgramGetNativeHandle(
281281
ur_program_handle_t hProgram, ur_native_handle_t *phNativeProgram) {
282282
std::ignore = hProgram;
283283
std::ignore = phNativeProgram;
284284

285-
DIE_NO_IMPLEMENTATION
285+
DIE_NO_IMPLEMENTATION;
286286
}
287287

288288
UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
@@ -294,5 +294,5 @@ UR_APIEXPORT ur_result_t UR_APICALL urProgramCreateWithNativeHandle(
294294
std::ignore = pProperties;
295295
std::ignore = phProgram;
296296

297-
DIE_NO_IMPLEMENTATION
297+
DIE_NO_IMPLEMENTATION;
298298
}

0 commit comments

Comments
 (0)