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
67 lines
2.5 KiB
C
67 lines
2.5 KiB
C
// RUN: %clang_cc1 -verify=expected,all -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c23 %s -Wpre-c23-compat
|
|
// RUN: %clang_cc1 -verify=pedantic,all -triple x86_64-unknown-linux-gnu -fsyntax-only -std=c17 %s -pedantic
|
|
|
|
#include <limits.h>
|
|
|
|
#define GET_TYPE_INT(x) _Generic(x, \
|
|
char: 1,\
|
|
unsigned char: 2,\
|
|
signed char: 3,\
|
|
short: 4,\
|
|
unsigned short: 5,\
|
|
int: 6,\
|
|
unsigned int: 7,\
|
|
long: 8,\
|
|
unsigned long: 9,\
|
|
long long: 10,\
|
|
unsigned long long: 11,\
|
|
default: 0xFF\
|
|
)\
|
|
|
|
enum x {
|
|
a = INT_MAX,
|
|
b = ULLONG_MAX, // expected-warning {{enumerator value which exceeds the range of 'int' is incompatible with C standards before C23}}
|
|
// pedantic-warning@-1 {{enumerator value which exceeds the range of 'int' is a C23 extension}}
|
|
a_type = GET_TYPE_INT(a),
|
|
b_type = GET_TYPE_INT(b)
|
|
};
|
|
|
|
_Static_assert(GET_TYPE_INT(a) == GET_TYPE_INT(b), "ok");
|
|
|
|
extern enum x e_a;
|
|
extern __typeof(b) e_a;
|
|
extern __typeof(a) e_a;
|
|
|
|
enum a {
|
|
a0 = 0xFFFFFFFFFFFFFFFFULL // expected-warning {{enumerator value which exceeds the range of 'int' is incompatible with C standards before C23}}
|
|
// pedantic-warning@-1 {{enumerator value which exceeds the range of 'int' is a C23 extension}}
|
|
};
|
|
|
|
_Bool e (void) {
|
|
return a0;
|
|
}
|
|
|
|
int f (void) {
|
|
return a0; // expected-warning {{implicit conversion from 'enum a' to 'int' changes value from 18446744073709551615 to -1}}
|
|
// pedantic-warning@-1 {{implicit conversion from 'unsigned long' to 'int' changes value from 18446744073709551615 to -1}}
|
|
}
|
|
|
|
unsigned long g (void) {
|
|
return a0;
|
|
}
|
|
|
|
unsigned long long h (void) {
|
|
return a0;
|
|
}
|
|
|
|
enum big_enum {
|
|
big_enum_a = LONG_MAX, // expected-warning {{enumerator value which exceeds the range of 'int' is incompatible with C standards before C23}}
|
|
// pedantic-warning@-1 {{enumerator value which exceeds the range of 'int' is a C23 extension}}
|
|
big_enum_b = a + 1, // expected-warning {{enumerator value which exceeds the range of 'int' is incompatible with C standards before C23}}
|
|
// pedantic-warning@-1 {{enumerator value which exceeds the range of 'int' is a C23 extension}}
|
|
big_enum_c = ULLONG_MAX // expected-warning {{enumerator value which exceeds the range of 'int' is incompatible with C standards before C23}}
|
|
// pedantic-warning@-1 {{enumerator value which exceeds the range of 'int' is a C23 extension}}
|
|
};
|
|
|
|
_Static_assert(GET_TYPE_INT(big_enum_a) == GET_TYPE_INT(big_enum_b), "ok");
|