brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · a834d72 Raw
112 lines · c
1// RUN: %clang_cc1 -Wdeprecated %s -fsyntax-only -verify2 3// expected-error@+1{{expected (}}4#pragma clang deprecated5 6// expected-error@+1{{expected identifier}}7#pragma clang deprecated(48 9// expected-error@+1{{no macro named 'foo'}}10#pragma clang deprecated(foo)11 12#define bar 113// expected-note@+1{{macro marked 'deprecated' here}} 14#pragma clang deprecated(bar, "bar is deprecated use 1")15 16// expected-warning@+1{{macro 'bar' has been marked as deprecated: bar is deprecated use 1}}17#if bar18#endif19 20#define foo 121// expected-note@+8{{macro marked 'deprecated' here}} 22// expected-note@+7{{macro marked 'deprecated' here}} 23// expected-note@+6{{macro marked 'deprecated' here}} 24// expected-note@+5{{macro marked 'deprecated' here}} 25// expected-note@+4{{macro marked 'deprecated' here}} 26// expected-note@+3{{macro marked 'deprecated' here}} 27// expected-note@+2{{macro marked 'deprecated' here}} 28// expected-note@+1{{macro marked 'deprecated' here}} 29#pragma clang deprecated(foo)30 31// expected-error@+1{{expected )}}32#pragma clang deprecated(foo33 34// expected-warning@+1{{macro 'foo' has been marked as deprecated}}35#if foo36#endif37 38// expected-warning@+1{{macro 'foo' has been marked as deprecated}}39#if defined(foo)40#endif41 42// expected-warning@+1{{macro 'foo' has been marked as deprecated}}43#ifdef foo44#endif45 46// expected-warning@+1{{macro 'foo' has been marked as deprecated}}47#ifndef foo48#endif49 50int main(int argc, char** argv) {51// expected-error@+1{{no macro named 'main'}}52#pragma clang deprecated(main)53 54  // expected-warning@+1{{macro 'foo' has been marked as deprecated}}55  return foo;56}57 58#define frobble 159#pragma clang deprecated(frobble)60 61// not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}62#undef frobble // Expect no diagnostics here63 64// not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}65#define frobble 1 // How about here given that this was undefined?66 67// not-expected-warning@+1{{macro 'frobble' has been marked as deprecated}}68#if defined(frobble)69#endif70 71// Test that we diagnose on #elif.72#if 073#elif foo74// expected-warning@-1{{macro 'foo' has been marked as deprecated}}75#endif76 77 78// Test that we diagnose on #elifdef.79#ifdef baz80#elifdef foo81// expected-warning@-1{{macro 'foo' has been marked as deprecated}}82// expected-warning@-2{{use of a '#elifdef' directive is a C23 extension}}83#endif84 85// Test that we diagnose on #elifndef.86#ifdef baz87#elifndef foo88#endif89// expected-warning@-2{{macro 'foo' has been marked as deprecated}}90// expected-warning@-3{{use of a '#elifndef' directive is a C23 extension}}91 92// FIXME: These cases are currently not handled because clang doesn't expand93// conditions on skipped #elif* blocks. See the FIXME notes in94// Preprocessor::SkipExcludedConditionalBlock.95 96#ifdef frobble97// not-expected-warning@+2{{macro 'foo' has been marked as deprecated}}98// expected-warning@+1{{use of a '#elifndef' directive is a C23 extension}}99#elifndef foo100#endif101 102#ifdef frobble103// not-expected-warning@+2{{macro 'foo' has been marked as deprecated}}104// expected-warning@+1{{use of a '#elifdef' directive is a C23 extension}}105#elifdef foo106#endif107 108#if 1109// not-expected-warning@+1{{macro 'foo' has been marked as deprecated}}110#elif foo111#endif112