Since the problem stems from the files that contain the macros including standard C headers I am trying to reproduce the scenario with this minimal kernel:
#include <string.h>
__kernel void prueba() {
int a = 1;
}
Since aoc cannot find string.h I compile this kernel with:
aoc -I /usr/include -march=emulator min_example.cl
Then aoc outputs it cannot find stdef.h, so I include a new directory:
aoc -I /usr/include -I /usr/include/linux -march=emulator min_example.cl
Then 21 errors are generated. Among them:
In file included from /usr/include/string.h:633:
/usr/include/bits/string2.h:972:3: error: OpenCL does not support the 'register' storage class specifier
register size_t __result = 0;
/usr/include/bits/string2.h:1128:25: error: use of undeclared identifier 'NULL'
return *__s == '\0' ? NULL : (char *) (size_t) __s;
Any idea of what is going on here?
Edit:
It seems OpenCL 1.0 will not allow including string.h, among other C99 headers (https://www.khronos.org/registry/OpenCL/sdk/1.0/docs/man/xhtml/restrictions.html). Does this apply to the OpenCL version leveraged by Intel FPGA SDK for OpenCL?
Edit2:
According to https://www.intel.com/content/dam/www/programmable/us/en/pdfs/literature/hb/opencl-sdk/aocl_programming_guide.pdf (A.1.2 p.193) Intel FPGA SDK for OpenCL has this restriction.