Skip to content

Commit 8500738

Browse files
authored
[libspirv] Avoid macro redefinition (#18670)
The macro __CLC_FUNCTION is special and is used in CLC headers. Defining it here in an implementation file - nextafter.cl - for another purpose then including half_nextafter.inc which pulls in the SPIR-V headers results in a macro redefinition, which is warned about. Sicne the name isn't important and is local to this one file, this commit just changes the macro definition to fix the issue.
1 parent 89f6a39 commit 8500738

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

libclc/libspirv/lib/ptx-nvidiacl/math/nextafter.cl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@
1111
#include <clc/utils.h>
1212
#include <libspirv/spirv.h>
1313

14-
#define __CLC_FUNCTION __spirv_ocl_nextafter
14+
#define __SPIRV_FUNCTION __spirv_ocl_nextafter
1515
#define __CLC_BUILTIN __nv_nextafter
1616
#define __CLC_BUILTIN_F __CLC_XCONCAT(__CLC_BUILTIN, f)
1717
#define __CLC_BUILTIN_D __CLC_BUILTIN
1818

19-
_CLC_DEFINE_BINARY_BUILTIN(float, __CLC_FUNCTION, __CLC_BUILTIN_F, float, float)
19+
_CLC_DEFINE_BINARY_BUILTIN(float, __SPIRV_FUNCTION, __CLC_BUILTIN_F, float,
20+
float)
2021

2122
#ifndef __FLOAT_ONLY
2223

2324
#ifdef cl_khr_fp64
2425

2526
#pragma OPENCL EXTENSION cl_khr_fp64 : enable
2627

27-
_CLC_DEFINE_BINARY_BUILTIN(double, __CLC_FUNCTION, __CLC_BUILTIN_D, double,
28+
_CLC_DEFINE_BINARY_BUILTIN(double, __SPIRV_FUNCTION, __CLC_BUILTIN_D, double,
2829
double)
2930

3031
#endif

0 commit comments

Comments
 (0)