Files
TheRock/compiler/amd-llvm/clang/test/Sema/pragma-section.c
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

62 lines
4.4 KiB
C

// RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
#pragma const_seg(".my_const") // expected-note 2 {{#pragma entered here}}
extern const int a;
const int a = 1; // expected-note 2 {{declared here}}
#pragma data_seg(".my_const") // expected-note {{#pragma entered here}}
int b = 1; // expected-error {{'b' causes a section type conflict with 'a'}}
#pragma data_seg()
int c = 1;
__declspec(allocate(".my_const")) int d = 1; // expected-error {{'d' causes a section type conflict with 'a'}}
#pragma data_seg("\u") // expected-error {{\u used with no following hex digits}}
#pragma data_seg("a" L"b") // expected-warning {{expected non-wide string literal in '#pragma data_seg'}}
#pragma section(".my_seg", execute) // expected-note 2 {{#pragma entered her}}
__declspec(allocate(".my_seg")) int int_my_seg;
#pragma code_seg(".my_seg")
void fn_my_seg(void){}
__declspec(allocate(".bad_seg")) int int_bad_seg = 1; // expected-note {{declared here}}
#pragma code_seg(".bad_seg") // expected-note {{#pragma entered here}}
void fn_bad_seg(void){} // expected-error {{'fn_bad_seg' causes a section type conflict with 'int_bad_seg'}}
#pragma bss_seg // expected-warning {{missing '(' after '#pragma bss_seg' - ignoring}}
#pragma bss_seg(L".my_seg") // expected-warning {{expected push, pop or a string literal for the section name in '#pragma bss_seg' - ignored}}
#pragma bss_seg(1) // expected-warning {{expected push, pop or a string literal for the section name in '#pragma bss_seg' - ignored}}
#pragma bss_seg(push)
#pragma bss_seg(push, ".my_seg")
#pragma bss_seg(push, 1) // expected-warning {{expected a stack label or a string literal for the section name in '#pragma bss_seg'}}
#pragma bss_seg ".my_seg" // expected-warning {{missing '(' after '#pragma bss_seg' - ignoring}}
#pragma bss_seg(push, my_label, 1) // expected-warning {{expected a string literal for the section name in '#pragma bss_seg' - ignored}}
#pragma bss_seg(".my_seg", 1) // expected-warning {{missing ')' after '#pragma bss_seg' - ignoring}}
#pragma bss_seg(".my_seg" // expected-warning {{missing ')' after '#pragma bss_seg' - ignoring}}
#pragma section // expected-warning {{missing '(' after '#pragma section' - ignoring}}
#pragma section( // expected-warning {{expected a string literal for the section name in '#pragma section' - ignored}}
#pragma section(L".my_seg") // expected-warning {{expected a string literal for the section name in '#pragma section' - ignored}}
#pragma section(".my_seg" // expected-warning {{missing ')' after '#pragma section' - ignoring}}
#pragma section(".my_seg" 1 // expected-warning {{missing ')' after '#pragma section' - ignoring}}
#pragma section(".my_seg", // expected-warning {{expected action or ')' in '#pragma section' - ignored}}
#pragma section(".my_seg", read) // expected-error {{this causes a section type conflict with a prior #pragma section}}
#pragma section(".my_seg", bogus) // expected-warning {{unknown action 'bogus' for '#pragma section' - ignored}}
#pragma section(".my_seg", nopage) // expected-warning {{known but unsupported action 'nopage' for '#pragma section' - ignored}}
#pragma section(".my_seg", read, write) // expected-error {{this causes a section type conflict with a prior #pragma section}}
#pragma section(".my_seg", read, write, 1) // expected-warning {{expected action or ')' in '#pragma section' - ignored}}
#pragma bss_seg(".drectve") // expected-warning{{#pragma bss_seg(".drectve") has undefined behavior, use #pragma comment(linker, ...) instead}}
#pragma code_seg(".drectve") // expected-warning{{#pragma code_seg(".drectve") has undefined behavior, use #pragma comment(linker, ...) instead}}
#pragma const_seg(".drectve") // expected-warning{{#pragma const_seg(".drectve") has undefined behavior, use #pragma comment(linker, ...) instead}}
#pragma data_seg(".drectve") // expected-warning{{#pragma data_seg(".drectve") has undefined behavior, use #pragma comment(linker, ...) instead}}
#pragma code_seg(".my_seg")
// cl.exe doesn't warn on this, so match that.
// (Technically it ICEs on this particular example, but if it's on a class then
// it just doesn't warn.)
__declspec(code_seg(".drectve")) void drectve_fn(void) {}
// This shouldn't warn; mingw users likely want to use
// __attribute__((section(".drective")))
// const char LinkerFlags[] = "-export:foo -export:bar";
// for interop with gcc.
__attribute__((section(".drectve"))) int drectve_int;