[Patch]OpenCL size_t and ptrdiff_t as builtin types

Douglas Gregor dgregor at apple.com
Fri Feb 8 16:35:55 PST 2013


On Feb 6, 2013, at 12:13 PM, "Benyei, Guy" <guy.benyei at intel.com> wrote:

> Thanks Joey.
> Any other comments about this fix, or should I go and commit it?

The patch itself is clearly incomplete. What are the promotion rules for size_t and ptrdiff_t, and how does overloading work for them? Where are the tests to verify that size_t and ptrdiff_t actually behave as they should?

However, that's not relevant right now. What matters is the reason for making such a change in the first place. Only two reasons were given:

  1) OpenCL restricts the use of size_t and ptrdiff_t for kernel arguments. However, that restriction could trivially be enforced by looking at the sugar that Clang maintains on the type.

  2) OpenCL makes size_t and ptrdiff_t keywords. Even if that were true, it is not actually relevant. If they are supposed to be keywords, we could add them as keywords and map them down to a synthesized typedef of the appropriate underlying type.

So we're left with a *drastic* change to the type system with no reasonable justification.

	- Doug

> Thanks
>   Guy Benyei
> 
> -----Original Message-----
> From: Joey Gouly [mailto:Joey.Gouly at arm.com] 
> Sent: Tuesday, February 05, 2013 16:35
> To: Benyei, Guy; cfe-commits at cs.uiuc.edu
> Subject: RE: [Patch]OpenCL size_t and ptrdiff_t as builtin types
> 
> Hi Guy,
> 
> This patch looks good to me.
> 
> I changed the code a bit around your changes in lib/Sema/SemaDecl.cpp, but it will be easy to fix.
> 
> Thanks,
> Joey
> 
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Benyei, Guy
> Sent: 05 February 2013 13:11
> To: cfe-commits at cs.uiuc.edu
> Subject: RE: [Patch]OpenCL size_t and ptrdiff_t as builtin types
> 
> Any comments on this patch?
> 
> Thanks
>   Guy Benyei
> 
> 
> From: cfe-commits-bounces at cs.uiuc.edu [mailto:cfe-commits-bounces at cs.uiuc.edu] On Behalf Of Benyei, Guy
> Sent: Wednesday, January 30, 2013 22:46
> To: cfe-commits at cs.uiuc.edu
> Subject: [Patch]OpenCL size_t and ptrdiff_t as builtin types
> 
> Hello,
> Attached a patch that makes OpenCL size_t and ptrdiff_t types Clang builtin types.
> In OpenCL size_t is not a library define, but an actual keyword, a type that is available without special includes, and it also has some specific restriction.
> 
> Please review
> 
> Thanks
>    Guy Benyei
> 
> 
> 
> 
> -- IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium.  Thank you.
> 
> ---------------------------------------------------------------------
> Intel Israel (74) Limited
> 
> This e-mail and any attachments may contain confidential material for
> the sole use of the intended recipient(s). Any review or distribution
> by others is strictly prohibited. If you are not the intended
> recipient, please contact the sender and delete all copies.
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits




More information about the cfe-commits mailing list