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
80 lines
3.2 KiB
C
80 lines
3.2 KiB
C
// RUN: %clang_cc1 -ffreestanding -verify=expected,c2x -std=c2x -Wpre-c2x-compat %s
|
|
// RUN: %clang_cc1 -ffreestanding -verify=expected,c17 -std=c17 %s
|
|
|
|
/* WG14 N2934: yes
|
|
* Revise spelling of keywords v7
|
|
*/
|
|
|
|
thread_local struct S { // c2x-warning {{'thread_local' is incompatible with C standards before C23}} \
|
|
c2x-error 0+ {{thread-local storage is not supported for the current target}} \
|
|
c17-error {{unknown type name 'thread_local'}}
|
|
bool b; // c2x-warning {{'bool' is incompatible with C standards before C23}} \
|
|
c17-error {{unknown type name 'bool'}}
|
|
} s;
|
|
|
|
static_assert(alignof(int) != 0, ""); // c2x-warning {{'static_assert' is incompatible with C standards before C23}} \
|
|
c2x-warning {{'alignof' is incompatible with C standards before C23}} \
|
|
c17-error 2 {{type specifier missing, defaults to 'int'; ISO C99 and later do not support implicit int}} \
|
|
c17-error {{expected ')'}} \
|
|
c17-note {{to match this '('}}
|
|
|
|
#include <stdalign.h>
|
|
|
|
// C17 and earlier must have __alignas_is_defined and __alignof_is_defined,
|
|
// but C2x and later must not.
|
|
#if __STDC_VERSION__ <= 201710L
|
|
#if __alignas_is_defined != 1
|
|
#error "alignas should be defined"
|
|
#endif
|
|
#if __alignof_is_defined != 1
|
|
#error "alignof should be defined"
|
|
#endif
|
|
#else
|
|
#ifdef __alignas_is_defined
|
|
#error "alignas should not be defined"
|
|
#endif
|
|
#ifdef __alignof_is_defined
|
|
#error "alignof should not be defined"
|
|
#endif
|
|
#endif
|
|
|
|
#include <stdbool.h>
|
|
|
|
// C17 and earlier must have bool defined as a macro, but C2x and later should
|
|
// not (at least in Clang's implementation; it's permissible for bool to be a
|
|
// macro in general, as it could expand to _Bool).
|
|
#if __STDC_VERSION__ <= 201710L
|
|
#ifndef bool
|
|
#error "bool should be defined"
|
|
#endif
|
|
#else
|
|
#ifdef bool
|
|
#error "bool should not be defined"
|
|
#endif
|
|
#endif
|
|
|
|
// Ensure we correctly parse the alignas keyword in a specifier-qualifier-list.
|
|
// This is different than in C++ where alignas is an actual attribute rather
|
|
// than a specifier.
|
|
struct GH81472 {
|
|
char alignas(8) a1; // c2x-warning {{'alignas' is incompatible with C standards before C23}}
|
|
alignas(8) char a2; // c2x-warning {{'alignas' is incompatible with C standards before C23}}
|
|
char _Alignas(8) a3;
|
|
_Alignas(8) char a4;
|
|
char a5 alignas(8); // expected-error {{expected ';' at end of declaration list}}
|
|
char a6 _Alignas(8); // expected-error {{expected ';' at end of declaration list}}
|
|
};
|
|
|
|
// Ensure we reject alignas as an attribute specifier. This code is accepted in
|
|
// C++ mode but should be rejected in C.
|
|
// FIXME: this diagnostic could be improved
|
|
struct alignas(8) Reject1 { // expected-error {{declaration of anonymous struct must be a definition}} \
|
|
expected-warning {{declaration does not declare anything}}
|
|
int a;
|
|
};
|
|
|
|
struct _Alignas(8) Reject2 { // expected-error {{declaration of anonymous struct must be a definition}} \
|
|
expected-warning {{declaration does not declare anything}}
|
|
int a;
|
|
};
|