Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Lexer / pragma-message.c
blobaca9f14fa2f6d5be353dcbeeff37742128d32bae
1 /* Test pragma message directive from
2 http://msdn.microsoft.com/en-us/library/x7dkzch2.aspx */
3 // message: Sends a string literal to the standard output without terminating
4 // the compilation.
5 // #pragma message(messagestring)
6 // OR
7 // #pragma message messagestring
8 //
9 // RUN: %clang_cc1 -fsyntax-only -verify -Werror %s
10 // RUN: %clang_cc1 -fsyntax-only -verify -Werror -W#pragma-messages %s
11 #define STRING2(x) #x
12 #define STRING(x) STRING2(x)
13 #pragma message(":O I'm a message! " STRING(__LINE__)) // expected-warning {{:O I'm a message! 13}}
14 #pragma message ":O gcc accepts this! " STRING(__LINE__) // expected-warning {{:O gcc accepts this! 14}}
16 #pragma message(invalid) // expected-error {{expected string literal in pragma message}}
18 // GCC supports a similar pragma, #pragma GCC warning (which generates a warning
19 // message) and #pragma GCC error (which generates an error message).
21 #pragma GCC warning(":O I'm a message! " STRING(__LINE__)) // expected-warning {{:O I'm a message! 21}}
22 #pragma GCC warning ":O gcc accepts this! " STRING(__LINE__) // expected-warning {{:O gcc accepts this! 22}}
24 #pragma GCC error(":O I'm a message! " STRING(__LINE__)) // expected-error {{:O I'm a message! 24}}
25 #pragma GCC error ":O gcc accepts this! " STRING(__LINE__) // expected-error {{:O gcc accepts this! 25}}
27 #define COMPILE_ERROR(x) _Pragma(STRING2(GCC error(x)))
28 COMPILE_ERROR("Compile error at line " STRING(__LINE__) "!"); // expected-error {{Compile error at line 28!}}
30 #pragma message // expected-error {{pragma message requires parenthesized string}}
31 #pragma GCC warning("" // expected-error {{pragma warning requires parenthesized string}}
32 #pragma GCC error(1) // expected-error {{expected string literal in pragma error}}