CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
85 lines
2.9 KiB
Common Lisp
85 lines
2.9 KiB
Common Lisp
// RUN: %clang_cc1 %s -cl-std=CL1.0 -verify -pedantic -fsyntax-only -triple spir-unknown-unknown
|
|
// RUN: %clang_cc1 %s -cl-std=CL1.0 -verify -pedantic -fsyntax-only -triple spir-unknown-unknown -DFUNCPTREXT
|
|
// RUN: %clang_cc1 %s -cl-std=CL1.0 -verify -pedantic -fsyntax-only -triple spir-unknown-unknown -DVARARGEXT
|
|
|
|
#ifdef FUNCPTREXT
|
|
#pragma OPENCL EXTENSION __cl_clang_function_pointers : enable
|
|
#endif
|
|
#ifdef VARARGEXT
|
|
#pragma OPENCL EXTENSION __cl_clang_variadic_functions : enable
|
|
#endif
|
|
|
|
// Variadic functions
|
|
void vararg_f(int, ...);
|
|
#ifndef VARARGEXT
|
|
// expected-error@-2 {{invalid prototype, variadic arguments are not allowed in OpenCL}}
|
|
#endif
|
|
void __vararg_f(int, ...);
|
|
typedef void (*vararg_fptr_t)(int, ...);
|
|
#ifndef VARARGEXT
|
|
// expected-error@-2 {{invalid prototype, variadic arguments are not allowed in OpenCL}}
|
|
#endif
|
|
#ifndef FUNCPTREXT
|
|
// expected-error@-5 {{pointers to functions are not allowed}}
|
|
#endif
|
|
int printf(__constant const char *st, ...);
|
|
#ifndef VARARGEXT
|
|
// expected-error@-2 {{invalid prototype, variadic arguments are not allowed in OpenCL}}
|
|
#endif
|
|
|
|
// Struct type with function pointer field
|
|
typedef struct s
|
|
{
|
|
void (*f)(struct s *self, int *i);
|
|
#ifndef FUNCPTREXT
|
|
// expected-error@-2 {{pointers to functions are not allowed}}
|
|
#endif
|
|
} s_t;
|
|
|
|
//Function pointer
|
|
void foo(void*);
|
|
#ifdef FUNCPTREXT
|
|
//expected-note@-2{{passing argument to parameter here}}
|
|
#endif
|
|
|
|
// Expect no diagnostics for an empty parameter list.
|
|
void bar();
|
|
|
|
void bar()
|
|
{
|
|
// declaring a function pointer is an error
|
|
void (*fptr)(int);
|
|
#ifndef FUNCPTREXT
|
|
// expected-error@-2 {{pointers to functions are not allowed}}
|
|
#endif
|
|
|
|
// taking the address of a function is an error
|
|
foo((void*)foo);
|
|
#ifndef FUNCPTREXT
|
|
// expected-error@-2{{taking address of function is not allowed}}
|
|
#else
|
|
// FIXME: Functions should probably be in the address space defined by the
|
|
// implementation. It might make sense to put them into the Default address
|
|
// space that is bind to a physical segment by the target rather than fixing
|
|
// it to any of the concrete OpenCL address spaces during parsing.
|
|
// expected-error@-8{{casting 'void (*)(__private void *__private)' to type '__private void *' changes address space}}
|
|
#endif
|
|
|
|
foo(&foo);
|
|
#ifndef FUNCPTREXT
|
|
// expected-error@-2{{taking address of function is not allowed}}
|
|
#else
|
|
// expected-error@-4{{passing 'void (*)(__private void *__private)' to parameter of type '__private void *' changes address space of pointer}}
|
|
#endif
|
|
|
|
// FIXME: If we stop rejecting the line below a bug (PR49315) gets
|
|
// hit due to incorrectly handled pointer conversion.
|
|
#ifndef FUNCPTREXT
|
|
// initializing an array with the address of functions is an error
|
|
void* vptrarr[2] = {foo, &foo}; // expected-error{{taking address of function is not allowed}} expected-error{{taking address of function is not allowed}}
|
|
#endif
|
|
|
|
// just calling a function is correct
|
|
foo(0);
|
|
}
|