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

Jeroen Ketema j.ketema at imperial.ac.uk
Fri Oct 17 15:34:19 PDT 2014


This means we loose support for ptrdiff_t (typedef __PTRDIFF_TYPE__ ptrdiff_t;), which is an OpenCL required type.

Moreover, we loose NULL in this way. Although NULL is not strictly required, it’s useful to have around.

Jeroen

> On 17 Oct 2014, at 23:19, Jean-Sébastien Pédron <dumbbell at FreeBSD.org> wrote:
> 
> Including a standard or system header isn't allowed in OpenCL.
> 
> The type "size_t" needs to be explicitely defined now.
> ---
> generic/include/clc/clctypes.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/generic/include/clc/clctypes.h b/generic/include/clc/clctypes.h
> index ca1372d..f2b7d88 100644
> --- a/generic/include/clc/clctypes.h
> +++ b/generic/include/clc/clctypes.h
> @@ -1,12 +1,12 @@
> /* 6.1.1 Built-in Scalar Data Types */
> 
> -#include <stddef.h>
> -
> typedef unsigned char uchar;
> typedef unsigned short ushort;
> typedef unsigned int uint;
> typedef unsigned long ulong;
> 
> +typedef unsigned int size_t;
> +
> #define __stdint_join3(a,b,c) a ## b ## c
> 
> #define  __intn_t(n) __stdint_join3(__INT, n, _TYPE__)
> -- 
> 2.1.0
> 
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev





More information about the Libclc-dev mailing list