Implement C++14 [[deprecated]] modulo [[gnu::deprecated]] bugs.
gcc/cp: 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]]. gcc/testsuite: 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. From-SVN: r203955
This commit is contained in:
parent
1099e56939
commit
fe15a1a7eb
5 changed files with 133 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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
|
||||
|
|
59
gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C
Normal file
59
gcc/testsuite/g++.dg/cpp1y/attr-deprecated-neg.C
Normal file
|
@ -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);
|
||||
}
|
59
gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C
Normal file
59
gcc/testsuite/g++.dg/cpp1y/attr-deprecated.C
Normal file
|
@ -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" }
|
||||
}
|
Loading…
Add table
Reference in a new issue