pragma-section.c 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // RUN: %clang_cc1 -fsyntax-only -verify -fms-extensions %s -triple x86_64-pc-win32
  2. #pragma const_seg(".my_const") // expected-note 2 {{#pragma entered here}}
  3. extern const int a;
  4. const int a = 1; // expected-note 2 {{declared here}}
  5. #pragma data_seg(".my_const") // expected-note {{#pragma entered here}}
  6. int b = 1; // expected-error {{'b' causes a section type conflict with 'a'}}
  7. #pragma data_seg()
  8. int c = 1;
  9. __declspec(allocate(".my_const")) int d = 1; // expected-error {{'d' causes a section type conflict with 'a'}}
  10. #pragma data_seg("\u") // expected-error {{\u used with no following hex digits}}
  11. #pragma data_seg("a" L"b") // expected-warning {{expected non-wide string literal in '#pragma data_seg'}}
  12. #pragma section(".my_seg", execute) // expected-note 2 {{#pragma entered her}}
  13. __declspec(allocate(".my_seg")) int int_my_seg;
  14. #pragma code_seg(".my_seg")
  15. void fn_my_seg(void){}
  16. __declspec(allocate(".bad_seg")) int int_bad_seg = 1; // expected-note {{declared here}}
  17. #pragma code_seg(".bad_seg") // expected-note {{#pragma entered here}}
  18. void fn_bad_seg(void){} // expected-error {{'fn_bad_seg' causes a section type conflict with 'int_bad_seg'}}
  19. #pragma bss_seg // expected-warning {{missing '(' after '#pragma bss_seg' - ignoring}}
  20. #pragma bss_seg(L".my_seg") // expected-warning {{expected push, pop or a string literal for the section name in '#pragma bss_seg' - ignored}}
  21. #pragma bss_seg(1) // expected-warning {{expected push, pop or a string literal for the section name in '#pragma bss_seg' - ignored}}
  22. #pragma bss_seg(push)
  23. #pragma bss_seg(push, ".my_seg")
  24. #pragma bss_seg(push, 1) // expected-warning {{expected a stack label or a string literal for the section name in '#pragma bss_seg'}}
  25. #pragma bss_seg ".my_seg" // expected-warning {{missing '(' after '#pragma bss_seg' - ignoring}}
  26. #pragma bss_seg(push, my_label, 1) // expected-warning {{expected a string literal for the section name in '#pragma bss_seg' - ignored}}
  27. #pragma bss_seg(".my_seg", 1) // expected-warning {{missing ')' after '#pragma bss_seg' - ignoring}}
  28. #pragma bss_seg(".my_seg" // expected-warning {{missing ')' after '#pragma bss_seg' - ignoring}}
  29. #pragma section // expected-warning {{missing '(' after '#pragma section' - ignoring}}
  30. #pragma section( // expected-warning {{expected a string literal for the section name in '#pragma section' - ignored}}
  31. #pragma section(L".my_seg") // expected-warning {{expected a string literal for the section name in '#pragma section' - ignored}}
  32. #pragma section(".my_seg" // expected-warning {{missing ')' after '#pragma section' - ignoring}}
  33. #pragma section(".my_seg" 1 // expected-warning {{missing ')' after '#pragma section' - ignoring}}
  34. #pragma section(".my_seg", // expected-warning {{expected action or ')' in '#pragma section' - ignored}}
  35. #pragma section(".my_seg", read) // expected-error {{this causes a section type conflict with a prior #pragma section}}
  36. #pragma section(".my_seg", bogus) // expected-warning {{unknown action 'bogus' for '#pragma section' - ignored}}
  37. #pragma section(".my_seg", nopage) // expected-warning {{known but unsupported action 'nopage' for '#pragma section' - ignored}}
  38. #pragma section(".my_seg", read, write) // expected-error {{this causes a section type conflict with a prior #pragma section}}
  39. #pragma section(".my_seg", read, write, 1) // expected-warning {{expected action or ')' in '#pragma section' - ignored}}