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
61 lines
3.2 KiB
C
61 lines
3.2 KiB
C
// RUN: %clang_cc1 -std=c11 -fsyntax-only -fsanitize=kcfi -verify %s
|
|
// RUN: %clang_cc1 -std=c89 -DKNR -fsyntax-only -fsanitize=kcfi -verify %s
|
|
|
|
#define __cfi_salt(S) __attribute__((cfi_salt(S)))
|
|
|
|
int bad1(void) __cfi_salt(); // expected-error{{'cfi_salt' attribute takes one argument}}
|
|
int bad2(void) __cfi_salt(42); // expected-error{{expected string literal as argument of 'cfi_salt' attribute}}
|
|
int bad3(void) __attribute__((cfi_salt("a", "b", "c"))); // expected-error{{'cfi_salt' attribute takes one argument}}
|
|
|
|
|
|
int foo(int a, int b) __cfi_salt("pepper"); // ok
|
|
int foo(int a, int b) __cfi_salt("pepper"); // ok
|
|
|
|
#ifndef KNR
|
|
typedef int (*bar_t)(void) __cfi_salt("pepper"); // ok
|
|
typedef int (*bar_t)(void) __cfi_salt("pepper"); // ok
|
|
#endif
|
|
|
|
// FIXME: Should we allow this?
|
|
// int b(void) __cfi_salt("salt 'n") __cfi_salt("pepper");
|
|
// bar_t bar_fn __cfi_salt("salt 'n");
|
|
|
|
int baz __cfi_salt("salt"); // expected-warning{{'cfi_salt' only applies to function types}}
|
|
|
|
int baz_fn(int a, int b) __cfi_salt("salt 'n"); // expected-note{{previous declaration is here}}
|
|
int baz_fn(int a, int b) __cfi_salt("pepper"); // expected-error{{conflicting types for 'baz_fn'}}
|
|
|
|
int mux_fn(int a, int b) __cfi_salt("salt 'n"); // expected-note{{previous declaration is here}}
|
|
int mux_fn(int a, int b) __cfi_salt("pepper") { // expected-error{{conflicting types for 'mux_fn'}}
|
|
return a * b;
|
|
}
|
|
|
|
typedef int qux_t __cfi_salt("salt"); // expected-warning{{'cfi_salt' only applies to function types}}
|
|
|
|
typedef int (*quux_t)(void) __cfi_salt("salt 'n"); // expected-note{{previous definition is here}}
|
|
typedef int (*quux_t)(void) __cfi_salt("pepper"); // expected-error{{typedef redefinition with different type}}
|
|
|
|
void func1(int a) __cfi_salt("pepper"); // expected-note{{previous declaration is here}}
|
|
void func1(int a) { } // expected-error{{conflicting types for 'func1'}}
|
|
void (*fp1)(int) = func1; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
|
|
|
|
void func2(int) [[clang::cfi_salt("test")]]; // expected-note{{previous declaration is here}}
|
|
void func2(int a) { } // expected-error{{conflicting types for 'func2'}}
|
|
void (*fp2)(int) = func2; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
|
|
|
|
void func3(int) __cfi_salt("pepper"); // ok
|
|
void func3(int a) __cfi_salt("pepper") { } // ok
|
|
void (* __cfi_salt("pepper") fp3)(int) = func3; // ok
|
|
void (*fp3_noattr)(int) = func3; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
|
|
|
|
void func4(int) [[clang::cfi_salt("test")]]; // ok
|
|
void func4(int a) [[clang::cfi_salt("test")]] { } // ok
|
|
void (* [[clang::cfi_salt("test")]] fp4)(int) = func4; // ok
|
|
void (*fp4_noattr)(int) = func4; // expected-error{{incompatible function pointer types initializing 'void (*)(int)' with an expression of type 'void (int)'}}
|
|
|
|
#ifdef KNR
|
|
// K&R C function without a prototype
|
|
void func() __attribute__((cfi_salt("pepper"))); // expected-error {{attribute only applies to non-K&R-style functions}}
|
|
void (*fp)() __attribute__((cfi_salt("pepper"))); // expected-error {{attribute only applies to non-K&R-style functions}}
|
|
#endif
|