blob: 75b49ef17c9888221fd3e6e566384081c5cf2eea [file] [log] [blame]
Chris Lattner27ceb9d2009-04-15 07:01:18 +00001// This should warn by default.
Daniel Dunbara5728872009-12-15 20:14:24 +00002// RUN: %clang_cc1 %s 2>&1 | grep "warning:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +00003// This should not emit anything.
Daniel Dunbara5728872009-12-15 20:14:24 +00004// RUN: %clang_cc1 %s -Wno-extra-tokens 2>&1 | not grep diagnostic
Chris Lattner27ceb9d2009-04-15 07:01:18 +00005
6// -Werror can map all warnings to error.
Daniel Dunbara5728872009-12-15 20:14:24 +00007// RUN: %clang_cc1 %s -Werror 2>&1 | grep "error:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +00008
9// -Werror can map this one warning to error.
Daniel Dunbara5728872009-12-15 20:14:24 +000010// RUN: %clang_cc1 %s -Werror=extra-tokens 2>&1 | grep "error:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +000011
Chris Lattner3fbbfcf2009-04-15 07:05:12 +000012// Mapping unrelated diags to errors doesn't affect this one.
Daniel Dunbara5728872009-12-15 20:14:24 +000013// RUN: %clang_cc1 %s -Werror=trigraphs 2>&1 | grep "warning:"
Chris Lattner3fbbfcf2009-04-15 07:05:12 +000014
Chris Lattner27ceb9d2009-04-15 07:01:18 +000015// This should stay a warning with -pedantic.
Daniel Dunbara5728872009-12-15 20:14:24 +000016// RUN: %clang_cc1 %s -pedantic 2>&1 | grep "warning:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +000017
18// This should emit an error with -pedantic-errors.
Daniel Dunbara5728872009-12-15 20:14:24 +000019// RUN: %clang_cc1 %s -pedantic-errors 2>&1 | grep "error:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +000020
21// This should emit a warning, because -Wfoo overrides -pedantic*.
Daniel Dunbara5728872009-12-15 20:14:24 +000022// RUN: %clang_cc1 %s -pedantic-errors -Wextra-tokens 2>&1 | grep "warning:"
Chris Lattner27ceb9d2009-04-15 07:01:18 +000023
24// This should emit nothing, because -Wno-extra-tokens overrides -pedantic*
Daniel Dunbara5728872009-12-15 20:14:24 +000025// RUN: %clang_cc1 %s -pedantic-errors -Wno-extra-tokens 2>&1 | not grep diagnostic
Chris Lattner27ceb9d2009-04-15 07:01:18 +000026
27#ifdef foo
28#endif bad // extension!
29
30int x;