blob: 8f05fbc76b560cf39e73d0c3b34ff93394ed1a4e [file] [log] [blame]
Chandler Carruth56e03112011-09-26 10:42:40 +00001// RUN: %clang_cc1 -fsyntax-only %s 2>&1 \
2// RUN: | FileCheck %s -check-prefix=BASE
3// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option %s 2>&1 \
4// RUN: | FileCheck %s -check-prefix=OPTION
Rafael Espindola96e78132013-07-04 16:16:58 +00005// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-option -Werror %s 2>&1 \
Chandler Carruth56e03112011-09-26 10:42:40 +00006// RUN: | FileCheck %s -check-prefix=OPTION_ERROR
7// RUN: %clang_cc1 -fsyntax-only -std=c89 -pedantic -fdiagnostics-show-option %s 2>&1 \
8// RUN: | FileCheck %s -check-prefix=OPTION_PEDANTIC
9// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category id %s 2>&1 \
10// RUN: | FileCheck %s -check-prefix=CATEGORY_ID
11// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-category name %s 2>&1 \
12// RUN: | FileCheck %s -check-prefix=CATEGORY_NAME
Rafael Espindola96e78132013-07-04 16:16:58 +000013// RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-show-option -fdiagnostics-show-category name -Werror %s 2>&1 \
Chandler Carruth56e03112011-09-26 10:42:40 +000014// RUN: | FileCheck %s -check-prefix=OPTION_ERROR_CATEGORY
15
16void test(int x, int y) {
17 if (x = y) ++x;
18 // BASE: {{.*}}: warning: {{[a-z ]+$}}
19 // OPTION: {{.*}}: warning: {{[a-z ]+}} [-Wparentheses]
20 // OPTION_ERROR: {{.*}}: error: {{[a-z ]+}} [-Werror,-Wparentheses]
21 // CATEGORY_ID: {{.*}}: warning: {{[a-z ]+}} [2]
22 // CATEGORY_NAME: {{.*}}: warning: {{[a-z ]+}} [Semantic Issue]
23 // OPTION_ERROR_CATEGORY: {{.*}}: error: {{[a-z ]+}} [-Werror,-Wparentheses,Semantic Issue]
24
25 // Leverage the fact that all these '//'s get warned about in C89 pedantic.
Ted Kremeneke8cf7d12012-07-07 05:53:30 +000026 // OPTION_PEDANTIC: {{.*}}: warning: {{[/a-z ]+}} [-Wcomment]
Chandler Carruth56e03112011-09-26 10:42:40 +000027}