1 // Check for warnings 2 // RUN: not %clang --warning-suppression-mappings=foo.txt -fsyntax-only %s 2>&1 | FileCheck -check-prefix MISSING_MAPPING %s 3 // RUN: not %clang -cc1 --warning-suppression-mappings=foo.txt -fsyntax-only %s 2>&1 | FileCheck -check-prefix MISSING_MAPPING %s 4 // MISSING_MAPPING: error: no such file or directory: 'foo.txt' 5 6 // Check that it's no-op when diagnostics aren't enabled. 7 // RUN: %clang -cc1 -Wno-everything -Werror --warning-suppression-mappings=%S/Inputs/suppression-mapping.txt -fsyntax-only %s 2>&1 | FileCheck -check-prefix WARNINGS_DISABLED --allow-empty %s 8 // WARNINGS_DISABLED-NOT: warning: 9 // WARNINGS_DISABLED-NOT: error: 10 11 // RUN: %clang -cc1 -verify -Wformat=2 -Wunused --warning-suppression-mappings=%S/Inputs/suppression-mapping.txt -fsyntax-only %s 12 13 __attribute__((__format__ (__printf__, 1, 2))) 14 void format_err(const char* const pString, ...); 15 16 namespace { 17 void foo() { 18 const char *x; 19 format_err(x); // Warning suppressed here. 20 const char *y; // expected-warning{{unused variable 'y'}} 21 } 22 } 23 24 #line 42 "foo/bar.h" 25 namespace { 26 void bar() { // expected-warning{{unused function 'bar'}} 27 const char *x; 28 format_err(x); // expected-warning{{format string is not a string literal (potentially insecure)}} \ 29 // expected-note{{treat the string as an argument to avoid this}} 30 } 31 } 32