Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 1 | // This should warn by default. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 2 | // RUN: %clang_cc1 %s 2>&1 | grep "warning:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 3 | // This should not emit anything. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 4 | // RUN: %clang_cc1 %s -Wno-extra-tokens 2>&1 | not grep diagnostic |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 5 | |
| 6 | // -Werror can map all warnings to error. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 7 | // RUN: %clang_cc1 %s -Werror 2>&1 | grep "error:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 8 | |
| 9 | // -Werror can map this one warning to error. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 10 | // RUN: %clang_cc1 %s -Werror=extra-tokens 2>&1 | grep "error:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 11 | |
Chris Lattner | 3fbbfcf | 2009-04-15 07:05:12 +0000 | [diff] [blame] | 12 | // Mapping unrelated diags to errors doesn't affect this one. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 13 | // RUN: %clang_cc1 %s -Werror=trigraphs 2>&1 | grep "warning:" |
Chris Lattner | 3fbbfcf | 2009-04-15 07:05:12 +0000 | [diff] [blame] | 14 | |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 15 | // This should stay a warning with -pedantic. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 16 | // RUN: %clang_cc1 %s -pedantic 2>&1 | grep "warning:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 17 | |
| 18 | // This should emit an error with -pedantic-errors. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 19 | // RUN: %clang_cc1 %s -pedantic-errors 2>&1 | grep "error:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 20 | |
| 21 | // This should emit a warning, because -Wfoo overrides -pedantic*. |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 22 | // RUN: %clang_cc1 %s -pedantic-errors -Wextra-tokens 2>&1 | grep "warning:" |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 23 | |
| 24 | // This should emit nothing, because -Wno-extra-tokens overrides -pedantic* |
Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 25 | // RUN: %clang_cc1 %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic |
Chris Lattner | 27ceb9d | 2009-04-15 07:01:18 +0000 | [diff] [blame] | 26 | |
| 27 | #ifdef foo |
| 28 | #endif bad // extension! |
| 29 | |
| 30 | int x; |