Skip to content

Commit fc66097

Browse files
fweigllvmbot
authored andcommitted
opencl: Ensure printf symbol is not mangled. (#150210)
Fixes #122453. (cherry picked from commit a22d010)
1 parent ece4440 commit fc66097

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clang/lib/Headers/opencl-c-base.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,16 @@ template <typename _Tp> struct __remove_address_space<__constant _Tp> {
697697
#if defined(__OPENCL_CPP_VERSION__) || (__OPENCL_C_VERSION__ >= CL_VERSION_1_2)
698698
// OpenCL v1.2 s6.12.13, v2.0 s6.13.13 - printf
699699

700-
int printf(__constant const char* st, ...) __attribute__((format(printf, 1, 2)));
700+
#ifdef __OPENCL_CPP_VERSION__
701+
#define CLINKAGE extern "C"
702+
#else
703+
#define CLINKAGE
704+
#endif
705+
706+
CLINKAGE int printf(__constant const char *st, ...)
707+
__attribute__((format(printf, 1, 2)));
708+
709+
#undef CLINKAGE
701710
#endif
702711

703712
#ifdef cl_intel_device_side_avc_motion_estimation

0 commit comments

Comments
 (0)