[Libclc-dev] [PATCH] Don't include <stddef.h>

Jeroen Ketema j.ketema at imperial.ac.uk
Fri Oct 17 16:05:50 PDT 2014


> On 17 Oct 2014, at 23:53, Matt Arsenault <arsenm2 at gmail.com> wrote:
> 
> 
> On Oct 17, 2014, at 3:50 PM, Jeroen Ketema <j.ketema at imperial.ac.uk <mailto:j.ketema at imperial.ac.uk>> wrote:
> 
>> 
>> That’s what I found, but that doesn’t mention stddef.h. So I don’t quite see why we cannot include stddef.
>> 
>> Jeroen
> 
> That seems clearly like an accident. OpenCL defines all of the standard library functions provided as “builtins”. There’s no need to include a header, and the implementation relying on system provided headers isn’t a great plan.

I think I always assumed that the clang/llvm version of stddef.h was picked up during compilation (which just defines, size_t, ptrdiff_t, and NULL; and which seems to be perfectly safe). However, this is apparently a misunderstanding from my part, as Jean-Sebastien mentions in his email that the standard FreeBSD version is picked up in his case. So, yes, I agree that ripping out the include is probably right thing to do.

Jeroen

> 
>> 
>>> On 17 Oct 2014, at 23:44, Matt Arsenault <arsenm2 at gmail.com <mailto:arsenm2 at gmail.com>> wrote:
>>> 
>>> 
>>> On Oct 17, 2014, at 3:41 PM, Jeroen Ketema <j.ketema at imperial.ac.uk <mailto:j.ketema at imperial.ac.uk>> wrote:
>>> 
>>>> 
>>>>> Including a standard or system header isn't allowed in OpenCL.
>>>> 
>>>> I’m not sure this is correct. Could you point me to the specific text that states this? In the OpenCL 1.2 spec I can only find is 6.9.f which does not mention stddef.h.
>>>> 
>>>> Thanks,
>>>> 
>>>> Jeroen
>>>> 
>>> 
>>> 
>>> 6.9.f states
>>> The library functions defined in the C99 standard headers assert.h, ctype.h, complex.h, errno.h, fenv.h, float.h, inttypes.h, limits.h, locale.h, setjmp.h, signal.h, stdarg.h, stdio.h, stdlib.h, string.h, tgmath.h, time.h, wchar.h and wctype.h are not available and cannot be included by a program. 
>>> 
>>> 
>> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20141018/f8d6cf04/attachment-0001.html>


More information about the Libclc-dev mailing list