brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.4 KiB · 5300e7a Raw
31 lines · c
1// RUN: %clang_cc1 -Weverything   -fsyntax-only -verify %s2 3// Test that the pragma overrides command line option -Weverythings,4 5// a diagnostic with DefaultIgnore. This is part of a group 'unused-macro'6// but -Weverything forces it7#define UNUSED_MACRO1 1 // expected-warning{{macro is not used}}8 9void foo(void) // expected-warning {{no previous prototype for function}}10// expected-note@-1{{declare 'static' if the function is not intended to be used outside of this translation unit}}11{12 // A diagnostic without DefaultIgnore, and not part of a group.13 (void) 'ab'; // expected-warning {{multi-character character constant}}14 15#pragma clang diagnostic warning "-Weverything" // Should not change anyhting.16#define UNUSED_MACRO2 1 // expected-warning{{macro is not used}}17 (void) 'cd'; // expected-warning {{multi-character character constant}}18 19#pragma clang diagnostic ignored "-Weverything" // Ignore warnings now.20#define UNUSED_MACRO2 1 // no warning21 (void) 'ef'; // no warning here22 23#pragma clang diagnostic warning "-Weverything" // Revert back to warnings.24#define UNUSED_MACRO3 1 // expected-warning{{macro is not used}}25 (void) 'gh'; // expected-warning {{multi-character character constant}}26 27#pragma clang diagnostic error "-Weverything"  // Give errors now.28#define UNUSED_MACRO4 1 // expected-error{{macro is not used}}29 (void) 'ij'; // expected-error {{multi-character character constant}}30}31