Files
TheRock/compiler/amd-llvm/clang/test/SemaCXX/attr-suppress.cpp
T
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

65 lines
2.0 KiB
C++

// RUN: %clang_cc1 -std=c++11 -fsyntax-only %s -verify
[[gsl::suppress("globally")]];
namespace N {
[[gsl::suppress("in-a-namespace")]];
}
[[gsl::suppress("readability-identifier-naming")]] void f_() {
int *p;
[[gsl::suppress("type", "bounds")]] {
p = reinterpret_cast<int *>(7);
}
[[gsl::suppress]] int x; // expected-error {{'gsl::suppress' attribute takes at least 1 argument}}
[[gsl::suppress()]] int y; // expected-error {{'gsl::suppress' attribute takes at least 1 argument}}
int [[gsl::suppress("r")]] z; // expected-error {{'gsl::suppress' attribute cannot be applied to types}}
[[gsl::suppress(f_)]] float f; // expected-error {{expected string literal as argument of 'suppress' attribute}}
}
union [[gsl::suppress("type.1")]] U {
int i;
float f;
};
// This doesn't really suppress anything but why not?
[[clang::suppress]];
namespace N {
[[clang::suppress("in-a-namespace")]];
} // namespace N
[[clang::suppress]] int global = 42;
[[clang::suppress]] void foo() {
[[clang::suppress]] int *p;
[[clang::suppress]] int a = 0; // no-warning
[[clang::suppress()]] int b = 1; // no-warning
[[clang::suppress("a")]] int c = a + b; // no-warning
[[clang::suppress("a", "b")]] b = c - a; // no-warning
[[clang::suppress("a", "b")]] if (b == 10) a += 4; // no-warning
[[clang::suppress]] while (true) {} // no-warning
[[clang::suppress]] switch (a) { // no-warning
default:
c -= 10;
}
int [[clang::suppress("r")]] z;
// expected-error@-1 {{'clang::suppress' attribute cannot be applied to types}}
[[clang::suppress(foo)]] float f;
// expected-error@-1 {{expected string literal as argument of 'suppress' attribute}}
}
class [[clang::suppress("type.1")]] V {
int i;
float f;
};
// FIXME: There's no good reason why we shouldn't support this case.
// But it doesn't look like clang generally supports such attributes yet.
class W : [[clang::suppress]] public V { // expected-error{{'clang::suppress' attribute cannot be applied to a base specifier}}
};