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