1 // RUN: %clang_cc1 -verify -fsyntax-only -Wshadow -Wold-style-cast %s 2 3 // Test that macro expansions from system headers don't trigger 'syntactic' 4 // warnings that are not actionable. 5 6 #ifdef IS_SYSHEADER 7 #pragma clang system_header 8 9 #define SANITY(a) (a / 0) 10 11 #define SHADOW(a) __extension__({ int v = a; v; }) 12 13 #define OLD_STYLE_CAST(a) ((int) (a)) 14 15 #else 16 17 #define IS_SYSHEADER 18 #include __FILE__ 19 testSanity()20void testSanity() { 21 // Validate that the test is set up correctly 22 int i = SANITY(0); // expected-warning {{division by zero is undefined}} 23 } 24 PR16093()25void PR16093() { 26 // no -Wshadow in system macro expansion 27 int i = SHADOW(SHADOW(1)); 28 } 29 PR18147()30void PR18147() { 31 // no -Wold_style_cast in system macro expansion 32 int i = OLD_STYLE_CAST(0); 33 } 34 35 #endif 36