diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C | 59 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C | 59 |
5 files changed, 133 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 50ec68d0..c17e19d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2013-10-23 Edward Smith-Rowland <3dw4rd@verizon.net> + + Implement C++14 [[deprecated]] modulo [[gnu::deprecated]] bugs. + * parser.c (cp_parser_std_attribute): Interpret [[deprecated]] + as [[gnu::deprecated]]. + 2013-10-22 Paolo Carlini <paolo.carlini@oracle.com> PR c++/58816 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 10a7b96..c5d19a4 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -21426,6 +21426,9 @@ cp_parser_std_attribute (cp_parser *parser) /* C++11 noreturn attribute is equivalent to GNU's. */ if (is_attribute_p ("noreturn", attr_id)) TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu"); + /* C++14 deprecated attribute is equivalent to GNU's. */ + else if (cxx_dialect >= cxx1y && is_attribute_p ("deprecated", attr_id)) + TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu"); } /* Now parse the optional argument clause of the attribute. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28a379e..f71e314 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2013-10-23 Edward Smith-Rowland <3dw4rd@verizon.net> + + Implement C++14 [[deprecated]] modulo [[gnu::deprecated]] bugs. + * g++.dg/cpp1y/attr-deprecated.C: New. + * g++.dg/cpp1y/attr-deprecated-neg.C: New. + 2013-10-23 Tobias Burnus <burnus@net-b.de> PR fortran/58793 diff --git a/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C new file mode 100644 index 0000000..b2f0e12 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options -std=c++11 } + +class [[deprecated]] A // { dg-warning "attribute directive ignored" } +{ +}; + +[[deprecated]] +int +foo(int n) // { dg-warning "attribute directive ignored" } +{ + return 42 + n; +} + +class [[deprecated("B has been superceded by C")]] B // { dg-warning "attribute directive ignored" } +{ +}; + +[[deprecated("bar is unsafe; use foobar instead")]] +int +bar(int n) // { dg-warning "attribute directive ignored" } +{ + return 42 + n - 1; +} + +#if __cplusplus > 201103L + +// Deprecate C for C++14 onwards. +class [[deprecated]] C; + +// Deprecate foobar for C++14 onwards. +[[deprecated]] +int +foobar(int n); + +#endif + +class C +{ +}; + +int +foobar(int n) +{ + return 43 + n - 1; +} + +int +main() +{ + A aaa; + int n = foo(12); + + B bbb; + int m = bar(666); + + C ccc; + int l = foobar(8); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C new file mode 100644 index 0000000..8cd09c7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C @@ -0,0 +1,59 @@ +// { dg-do compile } +// { dg-options -std=c++1y } + +class [[deprecated]] A +{ +}; + +[[deprecated]] +int +foo(int n) +{ + return 42 + n; +} + +class [[deprecated("B has been superceded by C")]] B +{ +}; + +[[deprecated("bar is unsafe; use foobar instead")]] +int +bar(int n) +{ + return 42 + n - 1; +} + +#if __cplusplus > 201103L + +// Deprecate C for C++14 onwards. +class [[deprecated]] C; + +// Deprecate foobar for C++14 onwards. +[[deprecated]] +int +foobar(int n); + +#endif + +class C +{ +}; + +int +foobar(int n) +{ + return 43 + n - 1; +} + +int +main() +{ + A aaa; // { dg-warning "is deprecated" } + int n = foo(12); // { dg-warning "is deprecated" } + + B bbb; // { dg-warning "is deprecated" "B has been superceded by C" } + int m = bar(666); // { dg-warning "is deprecated" "bar is unsafe; use foobar instead" } + + C ccc; // { dg-warning "is deprecated" } + int l = foobar(8); // { dg-warning "is deprecated" } +} |