Files
derek.holloway 7502bf64a4
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
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

83 lines
2.7 KiB
C

// RUN: %clang_cc1 -verify -fsyntax-only %s
typedef __SIZE_TYPE__ size_t;
typedef struct {
void *ptr;
size_t n;
} span;
span returns_span (void) __attribute((malloc_span)); // no-warning
typedef struct {
size_t n;
void *ptr;
} span2;
span2 returns_span2 (void) __attribute((malloc_span)); // no-warning
typedef struct {
void *ptr;
void *ptr2;
} span3;
span3 returns_span3 (void) __attribute((malloc_span)); // no-warning
typedef struct {
void *ptr;
int n;
} span4;
span4 returns_span4 (void) __attribute((malloc_span)); // no-warning
typedef struct incomplete_span incomplete_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{returned type is incomplete}}
incomplete_span returns_incomplete_span (void) __attribute((malloc_span));
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{returned type is not a struct type}}
int *returns_int_ptr (void) __attribute((malloc_span));
typedef struct {
void *ptr;
size_t n;
size_t n2;
} too_long_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{returned struct has 3 fields, expected 2}}
too_long_span returns_too_long_span (void) __attribute((malloc_span));
// Function pointers are not allowed.
typedef struct {
int (*func_ptr)(void);
size_t n;
} func_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{returned struct fields are not a supported combination}}
func_span returns_func_span (void) __attribute((malloc_span));
// Integer should not be an enum.
enum some_enum { some_value, other_value };
typedef struct {
void *ptr;
enum some_enum field;
} enum_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{2nd field is expected to be an integer}}
enum_span returns_enum_span (void) __attribute((malloc_span));
// Bit integers are also not supported.
typedef struct {
void *ptr;
_BitInt(16) n;
} bit_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{2nd field is expected to be an integer}}
bit_span returns_bit_span (void) __attribute((malloc_span));
// Integer must be at least as big as int.
typedef struct {
void *ptr;
short n;
} short_span;
// expected-warning@+2 {{attribute only applies to functions that return span-like structures}}
// expected-note@+1 {{2nd field of span-like type is not a wide enough integer (minimum width: 32)}}
short_span returns_short_span (void) __attribute((malloc_span));