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

Jan Vesely jan.vesely at rutgers.edu
Sun Nov 16 12:44:55 PST 2014


On Sun, 2014-11-16 at 12:33 -0600, Aaron Watry wrote:
> The only thing that I'm questioning here is that for radeonsi and newer
> nvidia chips, cards can have more than 4gb of memory, and I believe that
> the global address space for SI can/does include 64-bit pointers...  Sadly,
> I am not in a position where I can check at the moment.

I think this is OK. stddef.h (the clang one) includes the same lines, so
there really isn't any change in this regard.

bit more details:
clang uses
DefineType("__SIZE_TYPE__", TI.getSizeType(), Builder); [0]:683
DefineType("__PTRDIFF_TYPE__", TI.getPtrDiffType(0), Builder); [0]:677
to define those types

by default SizeType is set to unsigned long, and PtrDiffType to signed
long [1]:27
both can be overridden by R600TargetInfo if needed.

NVPTX target overrides both SizeType and PtrDiffType to unsigned long
long [2]:1475


the patch LGTM as well

jan

[0]tools/clang/lib/Frontend/InitPreprocessor.cpp
[1]tools/clang/lib/Basic/TargetInfo.cpp
[2]tools/clang/lib/Basic/Targets.cpp

> 
> --Aaron
> On Nov 16, 2014 11:06 AM, "Jeroen Ketema" <j.ketema at imperial.ac.uk> wrote:
> 
> >
> > I’ll happily commit, but it would be good to get someone else’s feedback
> > on this besides mine.
> >
> > Jeroen
> >
> > > On 02 Nov 2014, at 10:31, Jean-Sébastien Pédron <dumbbell at FreeBSD.org>
> > wrote:
> > >
> > > On 20.10.2014 12:03, Jeroen Ketema wrote:
> > >>> On 18 Oct 2014, at 12:12, 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.
> > >>>
> > >>> v2: Use __SIZE_TYPE__ instead of unsigned int.
> > >>> v3: Define ptrdiff_t and NULL.
> > >>> ---
> > >>> generic/include/clc/clctypes.h | 7 +++++--
> > >>> 1 file changed, 5 insertions(+), 2 deletions(-)
> > >>>
> > >>> diff --git a/generic/include/clc/clctypes.h
> > b/generic/include/clc/clctypes.h
> > >>> index ca1372d..2e3db60 100644
> > >>> --- a/generic/include/clc/clctypes.h
> > >>> +++ b/generic/include/clc/clctypes.h
> > >>> @@ -1,12 +1,13 @@
> > >>> /* 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 __SIZE_TYPE__ size_t;
> > >>> +typedef __PTRDIFF_TYPE__ ptrdiff_t;
> > >>> +
> > >>> #define __stdint_join3(a,b,c) a ## b ## c
> > >>>
> > >>> #define  __intn_t(n) __stdint_join3(__INT, n, _TYPE__)
> > >>> @@ -84,3 +85,5 @@ typedef __attribute__((ext_vector_type(4))) double
> > double4;
> > >>> typedef __attribute__((ext_vector_type(8))) double double8;
> > >>> typedef __attribute__((ext_vector_type(16))) double double16;
> > >>> #endif
> > >>> +
> > >>> +#define NULL ((void *)0)
> > >>> --
> > >>> 2.1.0
> > >>
> > >> LGTM.
> > >>
> > >> Jeroen
> > >
> > > If the patch is fine, can someone please commit it? :)
> > >
> > > --
> > > Jean-Sébastien Pédron
> > >
> > > _______________________________________________
> > > Libclc-dev mailing list
> > > Libclc-dev at pcc.me.uk
> > > http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev
> >
> >
> > _______________________________________________
> > Libclc-dev mailing list
> > Libclc-dev at pcc.me.uk
> > http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev
> >
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at pcc.me.uk
> http://www.pcc.me.uk/cgi-bin/mailman/listinfo/libclc-dev

-- 
Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/libclc-dev/attachments/20141116/5af14231/attachment.sig>


More information about the Libclc-dev mailing list