annotate clang/test/SemaCXX/writable-strings-deprecated.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children c4bab56944e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -fsyntax-only -verify %s -DWARNING
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify %s -DWARNING
anatofuz
parents:
diff changeset
3 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated-writable-strings -verify %s
anatofuz
parents:
diff changeset
4 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-deprecated -Wdeprecated-increment-bool -verify %s
anatofuz
parents:
diff changeset
5 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -fwritable-strings -verify %s
anatofuz
parents:
diff changeset
6 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Wno-write-strings -verify %s
anatofuz
parents:
diff changeset
7 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=c++11-compat -verify %s -DERROR
anatofuz
parents:
diff changeset
8 // RUN: %clang_cc1 -fsyntax-only -std=c++98 -Werror=deprecated -Wno-error=deprecated-increment-bool -verify %s -DERROR
anatofuz
parents:
diff changeset
9 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -DWARNING
anatofuz
parents:
diff changeset
10 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -Wno-deprecated -Wdeprecated-increment-bool -DWARNING
anatofuz
parents:
diff changeset
11 // RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s -pedantic-errors -DERROR
anatofuz
parents:
diff changeset
12 // rdar://8827606
anatofuz
parents:
diff changeset
13
anatofuz
parents:
diff changeset
14 char *fun(void)
anatofuz
parents:
diff changeset
15 {
anatofuz
parents:
diff changeset
16 return "foo";
anatofuz
parents:
diff changeset
17 #if defined(ERROR)
anatofuz
parents:
diff changeset
18 #if __cplusplus >= 201103L
anatofuz
parents:
diff changeset
19 // expected-error@-3 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
anatofuz
parents:
diff changeset
20 #else
anatofuz
parents:
diff changeset
21 // expected-error@-5 {{conversion from string literal to 'char *' is deprecated}}
anatofuz
parents:
diff changeset
22 #endif
anatofuz
parents:
diff changeset
23 #elif defined(WARNING)
anatofuz
parents:
diff changeset
24 #if __cplusplus >= 201103L
anatofuz
parents:
diff changeset
25 // expected-warning@-9 {{ISO C++11 does not allow conversion from string literal to 'char *'}}
anatofuz
parents:
diff changeset
26 #else
anatofuz
parents:
diff changeset
27 // expected-warning@-11 {{conversion from string literal to 'char *' is deprecated}}
anatofuz
parents:
diff changeset
28 #endif
anatofuz
parents:
diff changeset
29 #endif
anatofuz
parents:
diff changeset
30 }
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 void test(bool b)
anatofuz
parents:
diff changeset
33 {
anatofuz
parents:
diff changeset
34 ++b; // expected-warning {{incrementing expression of type bool is deprecated}}
anatofuz
parents:
diff changeset
35 }