[Libclc-dev] [PATCH 1/1] Avoid ambiguity in calling atom_add functions.

Tom Stellard via Libclc-dev libclc-dev at lists.llvm.org
Thu Sep 8 13:19:20 PDT 2016


On Wed, Sep 07, 2016 at 10:55:15AM -0400, Jan Vesely via Libclc-dev wrote:
> clang (since r280553) allows pointer casts in function overloads,
> so we need to disambiguate the second argument.
> 
LGTM.

> clang might be smarter about overloads in the future
> (see https://reviews.llvm.org/D24113), but let's be safe in libclc anyway.
> 
> Signed-off-by: Jan Vesely <jan.vesely at rutgers.edu>
> ---
>  generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl | 2 +-
>  generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl | 2 +-
>  generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl  | 2 +-
>  generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl  | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl b/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> index a74158d..cc24d2f 100644
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> +++ b/generic/lib/cl_khr_global_int32_base_atomics/atom_dec.cl
> @@ -2,7 +2,7 @@
>  
>  #define IMPL(TYPE) \
>  _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(global TYPE *p) { \
> -  return atom_sub(p, 1); \
> +  return atom_sub(p, (TYPE)1); \
>  }
>  
>  IMPL(int)
> diff --git a/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl b/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> index 1404b5a..9193ae3 100644
> --- a/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> +++ b/generic/lib/cl_khr_global_int32_base_atomics/atom_inc.cl
> @@ -2,7 +2,7 @@
>  
>  #define IMPL(TYPE) \
>  _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(global TYPE *p) { \
> -  return atom_add(p, 1); \
> +  return atom_add(p, (TYPE)1); \
>  }
>  
>  IMPL(int)
> diff --git a/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl b/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> index d22c333..cfb3d80 100644
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> +++ b/generic/lib/cl_khr_local_int32_base_atomics/atom_dec.cl
> @@ -2,7 +2,7 @@
>  
>  #define IMPL(TYPE) \
>  _CLC_OVERLOAD _CLC_DEF TYPE atom_dec(local TYPE *p) { \
> -  return atom_sub(p, 1); \
> +  return atom_sub(p, (TYPE)1); \
>  }
>  
>  IMPL(int)
> diff --git a/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl b/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> index 4ba0d06..8ea4738 100644
> --- a/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> +++ b/generic/lib/cl_khr_local_int32_base_atomics/atom_inc.cl
> @@ -2,7 +2,7 @@
>  
>  #define IMPL(TYPE) \
>  _CLC_OVERLOAD _CLC_DEF TYPE atom_inc(local TYPE *p) { \
> -  return atom_add(p, 1); \
> +  return atom_add(p, (TYPE)1); \
>  }
>  
>  IMPL(int)
> -- 
> 2.7.4
> 
> _______________________________________________
> Libclc-dev mailing list
> Libclc-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/libclc-dev


More information about the Libclc-dev mailing list