mirror of git://gcc.gnu.org/git/gcc.git
c-cppbuiltin.c: Move __cpp_attribute_deprecated to the C++11 section.
gcc/c-family: 2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net> * c-family/c-cppbuiltin.c: Move __cpp_attribute_deprecated to the C++11 section. gcc/cp: 2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net> * cp/parser.c: Allow [[deprecated]] for C++11. Issue a pedwarn. gcc/testsuite: 2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net> * g++.dg/cpp1y/attr-deprecated-neg.C: Attribute no longer ignored. * g++.dg/cpp1y/feat-cxx11-neg.C: Comment out __cpp_attribute_deprecated test. * g++.dg/cpp1y/feat-cxx11.C: Add __cpp_attribute_deprecated test. From-SVN: r215957
This commit is contained in:
parent
fbf833b776
commit
2a8ef76700
|
|
@ -1,3 +1,8 @@
|
||||||
|
2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net>
|
||||||
|
|
||||||
|
* c-family/c-cppbuiltin.c: Move __cpp_attribute_deprecated to the
|
||||||
|
C++11 section.
|
||||||
|
|
||||||
2014-10-03 Marc Glisse <marc.glisse@inria.fr>
|
2014-10-03 Marc Glisse <marc.glisse@inria.fr>
|
||||||
|
|
||||||
PR c++/54427
|
PR c++/54427
|
||||||
|
|
|
||||||
|
|
@ -828,6 +828,7 @@ c_cpp_builtins (cpp_reader *pfile)
|
||||||
cpp_define (pfile, "__cpp_rvalue_reference=200610");
|
cpp_define (pfile, "__cpp_rvalue_reference=200610");
|
||||||
cpp_define (pfile, "__cpp_variadic_templates=200704");
|
cpp_define (pfile, "__cpp_variadic_templates=200704");
|
||||||
cpp_define (pfile, "__cpp_alias_templates=200704");
|
cpp_define (pfile, "__cpp_alias_templates=200704");
|
||||||
|
cpp_define (pfile, "__cpp_attribute_deprecated=201309");
|
||||||
}
|
}
|
||||||
if (cxx_dialect > cxx11)
|
if (cxx_dialect > cxx11)
|
||||||
{
|
{
|
||||||
|
|
@ -841,7 +842,6 @@ c_cpp_builtins (cpp_reader *pfile)
|
||||||
//cpp_define (pfile, "__cpp_aggregate_nsdmi=201304");
|
//cpp_define (pfile, "__cpp_aggregate_nsdmi=201304");
|
||||||
cpp_define (pfile, "__cpp_variable_templates=201304");
|
cpp_define (pfile, "__cpp_variable_templates=201304");
|
||||||
cpp_define (pfile, "__cpp_digit_separators=201309");
|
cpp_define (pfile, "__cpp_digit_separators=201309");
|
||||||
cpp_define (pfile, "__cpp_attribute_deprecated=201309");
|
|
||||||
//cpp_define (pfile, "__cpp_sized_deallocation=201309");
|
//cpp_define (pfile, "__cpp_sized_deallocation=201309");
|
||||||
/* We'll have to see where runtime arrays wind up.
|
/* We'll have to see where runtime arrays wind up.
|
||||||
Let's put it in C++14 for now. */
|
Let's put it in C++14 for now. */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net>
|
||||||
|
|
||||||
|
* cp/parser.c: Allow [[deprecated]] for C++11. Issue a pedwarn.
|
||||||
|
|
||||||
2014-10-06 Paolo Carlini <paolo.carlini@oracle.com>
|
2014-10-06 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/55250
|
PR c++/55250
|
||||||
|
|
|
||||||
|
|
@ -22204,8 +22204,14 @@ cp_parser_std_attribute (cp_parser *parser)
|
||||||
if (is_attribute_p ("noreturn", attr_id))
|
if (is_attribute_p ("noreturn", attr_id))
|
||||||
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
|
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
|
||||||
/* C++14 deprecated attribute is equivalent to GNU's. */
|
/* C++14 deprecated attribute is equivalent to GNU's. */
|
||||||
else if (cxx_dialect >= cxx14 && is_attribute_p ("deprecated", attr_id))
|
else if (cxx_dialect >= cxx11 && is_attribute_p ("deprecated", attr_id))
|
||||||
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
|
{
|
||||||
|
if (cxx_dialect == cxx11)
|
||||||
|
pedwarn (token->location, OPT_Wpedantic,
|
||||||
|
"%<deprecated%> is a C++14 feature;"
|
||||||
|
" use %<gnu::deprecated%>");
|
||||||
|
TREE_PURPOSE (TREE_PURPOSE (attribute)) = get_identifier ("gnu");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now parse the optional argument clause of the attribute. */
|
/* Now parse the optional argument clause of the attribute. */
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,9 @@
|
||||||
|
2014-10-06 Edward Smith-Rowland <3dw4rd@verizon.net>
|
||||||
|
|
||||||
|
* g++.dg/cpp1y/attr-deprecated-neg.C: Attribute no longer ignored.
|
||||||
|
* g++.dg/cpp1y/feat-cxx11-neg.C: Comment out __cpp_attribute_deprecated test.
|
||||||
|
* g++.dg/cpp1y/feat-cxx11.C: Add __cpp_attribute_deprecated test.
|
||||||
|
|
||||||
2014-10-06 Paolo Carlini <paolo.carlini@oracle.com>
|
2014-10-06 Paolo Carlini <paolo.carlini@oracle.com>
|
||||||
|
|
||||||
PR c++/55250
|
PR c++/55250
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,24 @@
|
||||||
// { dg-do compile { target c++11_only } }
|
// { dg-do compile { target c++11_only } }
|
||||||
|
// { dg-options "-pedantic" }
|
||||||
|
|
||||||
class [[deprecated]] A // { dg-warning "attribute directive ignored" }
|
class [[deprecated]] A // { dg-warning "'deprecated' is a C..14 feature" }
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
[[deprecated]]
|
[[deprecated]] // { dg-warning "'deprecated' is a C..14 feature" }
|
||||||
int
|
int
|
||||||
foo(int n) // { dg-warning "attribute directive ignored" }
|
foo(int n)
|
||||||
{
|
{
|
||||||
return 42 + n;
|
return 42 + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
class [[deprecated("B has been superceded by C")]] B // { dg-warning "attribute directive ignored" }
|
class [[deprecated("B has been superceded by C")]] B // { dg-warning "'deprecated' is a C..14 feature" }
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
[[deprecated("bar is unsafe; use foobar instead")]]
|
[[deprecated("bar is unsafe; use foobar instead")]] // { dg-warning "'deprecated' is a C..14 feature" }
|
||||||
int
|
int
|
||||||
bar(int n) // { dg-warning "attribute directive ignored" }
|
bar(int n)
|
||||||
{
|
{
|
||||||
return 42 + n - 1;
|
return 42 + n - 1;
|
||||||
}
|
}
|
||||||
|
|
@ -47,12 +48,12 @@ foobar(int n)
|
||||||
int
|
int
|
||||||
main()
|
main()
|
||||||
{
|
{
|
||||||
A aaa;
|
A aaa; // { dg-warning "is deprecated" }
|
||||||
int n = foo(12);
|
int n = foo(12); // { dg-warning "is deprecated" }
|
||||||
|
|
||||||
B bbb;
|
B bbb; // { dg-warning "is deprecated" }
|
||||||
int m = bar(666);
|
int m = bar(666); // { dg-warning "is deprecated" }
|
||||||
|
|
||||||
C ccc;
|
C ccc; // { dg-warning "is deprecated" "" { target { c++14 } } }
|
||||||
int l = foobar(8);
|
int l = foobar(8); // { dg-warning "is deprecated" "" { target { c++14 } } }
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,10 @@
|
||||||
# error "__cpp_digit_separators" // { dg-error "error" }
|
# error "__cpp_digit_separators" // { dg-error "error" }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __cpp_attribute_deprecated
|
// Attribute [[deprecated]] is allowed in C++11 as an extension (with pedwarn).
|
||||||
# error "__cpp_attribute_deprecated" // { dg-error "error" }
|
//#ifndef __cpp_attribute_deprecated
|
||||||
#endif
|
//# error "__cpp_attribute_deprecated"
|
||||||
|
//#endif
|
||||||
|
|
||||||
#ifndef __cpp_runtime_arrays
|
#ifndef __cpp_runtime_arrays
|
||||||
# error "__cpp_runtime_arrays" // { dg-error "error" }
|
# error "__cpp_runtime_arrays" // { dg-error "error" }
|
||||||
|
|
|
||||||
|
|
@ -79,3 +79,9 @@
|
||||||
#elif __cpp_binary_literals != 201304
|
#elif __cpp_binary_literals != 201304
|
||||||
# error "__cpp_binary_literals != 201304"
|
# error "__cpp_binary_literals != 201304"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __cpp_attribute_deprecated
|
||||||
|
# error "__cpp_attribute_deprecated"
|
||||||
|
#elif __cpp_attribute_deprecated != 201309
|
||||||
|
# error "__cpp_attribute_deprecated != 201309"
|
||||||
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue