aboutsummaryrefslogtreecommitdiff
path: root/test/Sema/attr-deprecated.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:02:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:02:28 +0000
commit7442d6faa2719e4e7d33a7021c406c5a4facd74d (patch)
treec72b9241553fc9966179aba84f90f17bfa9235c3 /test/Sema/attr-deprecated.c
parentb52119637f743680a99710ce5fdb6646da2772af (diff)
Vendor import of clang trunk r300422:vendor/clang/clang-trunk-r300422
Diffstat (limited to 'test/Sema/attr-deprecated.c')
-rw-r--r--test/Sema/attr-deprecated.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/test/Sema/attr-deprecated.c b/test/Sema/attr-deprecated.c
index 8566a0e94362..89c06860fb4e 100644
--- a/test/Sema/attr-deprecated.c
+++ b/test/Sema/attr-deprecated.c
@@ -1,10 +1,12 @@
// RUN: %clang_cc1 %s -verify -fsyntax-only
+// RUN: %clang_cc1 %s -std=c89 -verify -fsyntax-only
+// RUN: %clang_cc1 %s -std=c99 -verify -fsyntax-only
int f() __attribute__((deprecated)); // expected-note 2 {{'f' has been explicitly marked deprecated here}}
-void g() __attribute__((deprecated));
-void g(); // expected-note {{'g' has been explicitly marked deprecated here}}
+void g() __attribute__((deprecated));// expected-note {{'g' has been explicitly marked deprecated here}}
+void g();
-extern int var __attribute__((deprecated)); // expected-note {{'var' has been explicitly marked deprecated here}}
+extern int var __attribute__((deprecated)); // expected-note 2 {{'var' has been explicitly marked deprecated here}}
int a() {
int (*ptr)() = f; // expected-warning {{'f' is deprecated}}
@@ -17,13 +19,13 @@ int a() {
}
// test if attributes propagate to variables
-extern int var; // expected-note {{'var' has been explicitly marked deprecated here}}
+extern int var;
int w() {
return var; // expected-warning {{'var' is deprecated}}
}
-int old_fn() __attribute__ ((deprecated));
-int old_fn(); // expected-note {{'old_fn' has been explicitly marked deprecated here}}
+int old_fn() __attribute__ ((deprecated));// expected-note {{'old_fn' has been explicitly marked deprecated here}}
+int old_fn();
int (*fn_ptr)() = old_fn; // expected-warning {{'old_fn' is deprecated}}
int old_fn() {
@@ -44,8 +46,8 @@ void test1(struct foo *F) {
typedef struct foo foo_dep __attribute__((deprecated)); // expected-note 12 {{'foo_dep' has been explicitly marked deprecated here}}
foo_dep *test2; // expected-warning {{'foo_dep' is deprecated}}
-struct __attribute__((deprecated,
- invalid_attribute)) bar_dep ; // expected-warning {{unknown attribute 'invalid_attribute' ignored}} expected-note 2 {{'bar_dep' has been explicitly marked deprecated here}}
+struct __attribute__((deprecated, // expected-note 2 {{'bar_dep' has been explicitly marked deprecated here}}
+ invalid_attribute)) bar_dep ; // expected-warning {{unknown attribute 'invalid_attribute' ignored}}
struct bar_dep *test3; // expected-warning {{'bar_dep' is deprecated}}
@@ -121,11 +123,12 @@ struct test22 {
__attribute((deprecated)) foo_dep e, f;
};
-typedef int test23_ty __attribute((deprecated));
+typedef int test23_ty __attribute((deprecated));
// Redefining a typedef is a C11 feature.
#if __STDC_VERSION__ <= 199901L
// expected-note@-3 {{'test23_ty' has been explicitly marked deprecated here}}
#else
-typedef int test23_ty; // expected-note {{'test23_ty' has been explicitly marked deprecated here}}
+// expected-note@-5 {{'test23_ty' has been explicitly marked deprecated here}}
+typedef int test23_ty;
#endif
test23_ty test23_v; // expected-warning {{'test23_ty' is deprecated}}