Skip to content

Commit b9d6ed5

Browse files
committed
utils/opencl: include hdrs only if needed
much of the headers isn't needed when ndef HAVE_OPENCL
1 parent 61e2461 commit b9d6ed5

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/utils/opencl.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,7 @@
4141

4242
#include "opencl.h"
4343

44-
#include <assert.h>
45-
#include <stdio.h>
46-
#include <string.h>
47-
48-
#include "compat/strings.h" // for strcasecmp
49-
#include "debug.h" // for MSG
50-
#include "host.h" // for get_commandline_param
51-
#include "utils/macros.h" // for ARR_COUNT, SHORT_STR
52-
#include "utils/color_out.h" // for TBOLD
44+
#include "host.h" // for ADD_TO_PARAM, get_commandline_param
5345

5446
#define MOD_NAME "[OpenCL] "
5547
#define PARAM_NAME "opencl-device"
@@ -59,6 +51,14 @@ ADD_TO_PARAM(PARAM_NAME, PARAM_HELP);
5951

6052
#ifdef HAVE_OPENCL
6153
#include <CL/cl.h>
54+
#include <assert.h>
55+
#include <stdio.h>
56+
#include <string.h>
57+
58+
#include "compat/strings.h" // for strcasecmp
59+
#include "debug.h" // for MSG
60+
#include "utils/macros.h" // for ARR_COUNT, SHORT_STR
61+
#include "utils/color_out.h" // for TBOLD
6262

6363
#define CHECK_OPENCL(cmd, errmsg, erraction) \
6464
if ((cmd) != CL_SUCCESS) { \
@@ -303,7 +303,8 @@ opencl_get_device(void **platform_id, void **device_id)
303303
return false;
304304
}
305305

306-
#else
306+
#else // !defined HAVE_OPENCL
307+
#include "debug.h" // for MSG
307308
void
308309
list_opencl_devices(bool full)
309310
{
@@ -317,4 +318,4 @@ opencl_get_device(void **platform_id, void **device_id)
317318
MSG(ERROR, "OpenCL support not compiled in!\n");
318319
return false;
319320
}
320-
#endif
321+
#endif // defined HAVE_OPENCL

0 commit comments

Comments
 (0)