[Libclc-dev] Let get_work_dim take exactly 0 arguments

Jeroen Ketema via Libclc-dev libclc-dev at lists.llvm.org
Sun Oct 1 11:12:48 PDT 2017


Thanks for the review.

I think it's allowed because it’s perfectly valid C, and I’m actually not aware of any
restrictions in the spec that stop you from writing this. It’s a bit odd though not to
get an error message when you pass an argument to get_work_dim.

Jeroen

P.S. I will check in this patch and the other myself, but it might take a bit, because
I’m somewhat behind the tip of the tree at the moment.

> On 1 Oct 2017, at 20:04, Jan Vesely <jan.vesely at rutgers.edu> wrote:
> 
> On Sun, 2017-10-01 at 19:23 +0200, Jeroen Ketema via Libclc-dev wrote:
>> Without void, an arbitrary number of arguments is allowed to be
>> passed (per the C standard). This does not seem to be the intention
>> of the specification of this function.
> 
> I'm surprised CLC would allow programs to call functions without proper
> prototype.
> LGTM.
> Reviewed-by: Jan Vesely <jan.vesely at rutgers.edu <mailto:jan.vesely at rutgers.edu>>
> 
> Jan
> 
>> 
>> Index: amdgcn/lib/workitem/get_work_dim.cl
>> ===================================================================
>> --- amdgcn/lib/workitem/get_work_dim.cl	(revision 312402)
>> +++ amdgcn/lib/workitem/get_work_dim.cl	(working copy)
>> @@ -1,6 +1,6 @@
>> #include <clc/clc.h>
>> 
>> -_CLC_DEF uint get_work_dim()
>> +_CLC_DEF uint get_work_dim(void)
>> {
>> 	__attribute__((address_space(2))) uint * ptr =
>> 		(__attribute__((address_space(2))) uint *)
>> Index: generic/include/clc/workitem/get_work_dim.h
>> ===================================================================
>> --- generic/include/clc/workitem/get_work_dim.h	(revision 312402)
>> +++ generic/include/clc/workitem/get_work_dim.h	(working copy)
>> @@ -1 +1 @@
>> -_CLC_DECL uint get_work_dim();
>> +_CLC_DECL uint get_work_dim(void);
>> Index: r600/lib/workitem/get_work_dim.cl
>> ===================================================================
>> --- r600/lib/workitem/get_work_dim.cl	(revision 312402)
>> +++ r600/lib/workitem/get_work_dim.cl	(working copy)
>> @@ -1,6 +1,6 @@
>> #include <clc/clc.h>
>> 
>> -_CLC_DEF uint get_work_dim()
>> +_CLC_DEF uint get_work_dim(void)
>> {
>> 	__attribute__((address_space(7))) uint * ptr =
>> 		(__attribute__((address_space(7))) uint *)
>> 
>> _______________________________________________
>> Libclc-dev mailing list
>> Libclc-dev at lists.llvm.org <mailto:Libclc-dev at lists.llvm.org>
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev <http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev>
> 
> -- 
> Jan Vesely <jan.vesely at rutgers.edu <mailto:jan.vesely at rutgers.edu>>

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


More information about the Libclc-dev mailing list