aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
authorH.J. Lu <hjl@gcc.gnu.org>2009-05-08 11:44:50 -0700
committerH.J. Lu <hjl@gcc.gnu.org>2009-05-08 11:44:50 -0700
commit9b86d6bb25587db93a322bf5778e9892aaa8b776 (patch)
tree3d22aee346c9c7a9e1f97b4a70e8968a3e82e462 /gcc/doc/extend.texi
parent82ad047f00d42f4cdb4ae2ee163f46d74db35f76 (diff)
downloadgcc-9b86d6bb25587db93a322bf5778e9892aaa8b776.zip
gcc-9b86d6bb25587db93a322bf5778e9892aaa8b776.tar.gz
gcc-9b86d6bb25587db93a322bf5778e9892aaa8b776.tar.bz2
re PR c/36892 (Support __attribute__((deprecated("text string"))))
gcc/ 2009-05-08 H.J. Lu <hongjiu.lu@intel.com> Andrew Morrow <acm@google.com> PR c/36892 * c-common.c (c_common_attribute_table): Permit deprecated attribute to take an optional argument. (handle_deprecated_attribute): If the optional argument to __attribute__((deprecated)) is not a string ignore the attribute and emit a warning. * c-decl.c (grokdeclarator): Updated warn_deprecated_use call. * c-typeck.c (build_component_ref): Likewise. (build_external_ref): Likewise. * toplev.c (warn_deprecated_use): Add an attribute argument. Emit the message associated with __attribute__((deprecated)). * toplev.h (warn_deprecated_use): Updated. * doc/extend.texi: Document new optional parameter to __attribute__((deprecated)) gcc/cp/ 2009-05-08 H.J. Lu <hongjiu.lu@intel.com> PR c/36892 * call.c (build_call_a): Updated warn_deprecated_use call. (build_over_call): Likewise. * decl.c (grokdeclarator): Likewise. (grokparms): Likewise. * semantics.c (finish_id_expression): Likewise. * typeck.c (build_class_member_access_expr): Likewise. (finish_class_member_access_expr): Likewise. gcc/testsuite/ 2009-05-08 H.J. Lu <hongjiu.lu@intel.com> PR c/36892 * g++.dg/warn/deprecated-6.C: New. * gcc.dg/deprecated-4.c: Likewise. * gcc.dg/deprecated-5.c: Likewise. * gcc.dg/deprecated-6.c: Likewise. From-SVN: r147293
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi15
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 43bebf9..6b626e2 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -2065,6 +2065,7 @@ objects (@pxref{C++ Attributes}).
These attributes are not currently implemented for Objective-C@.
@item deprecated
+@itemx deprecated (@var{msg})
@cindex @code{deprecated} attribute.
The @code{deprecated} attribute results in a warning if the function
is used anywhere in the source file. This is useful when identifying
@@ -2080,7 +2081,9 @@ int old_fn ();
int (*fn_ptr)() = old_fn;
@end smallexample
-results in a warning on line 3 but not line 2.
+results in a warning on line 3 but not line 2. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for variables and
types (@pxref{Variable Attributes}, @pxref{Type Attributes}.)
@@ -3845,6 +3848,7 @@ These attributes override the default chosen by the
@option{-fno-common} and @option{-fcommon} flags respectively.
@item deprecated
+@itemx deprecated (@var{msg})
@cindex @code{deprecated} attribute
The @code{deprecated} attribute results in a warning if the variable
is used anywhere in the source file. This is useful when identifying
@@ -3860,7 +3864,9 @@ extern int old_var;
int new_fn () @{ return old_var; @}
@end smallexample
-results in a warning on line 3 but not line 2.
+results in a warning on line 3 but not line 2. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for functions and
types (@pxref{Function Attributes}, @pxref{Type Attributes}.)
@@ -4490,6 +4496,7 @@ not referenced, but contain constructors and destructors that have
nontrivial bookkeeping functions.
@item deprecated
+@itemx deprecated (@var{msg})
The @code{deprecated} attribute results in a warning if the type
is used anywhere in the source file. This is useful when identifying
types that are expected to be removed in a future version of a program.
@@ -4512,7 +4519,9 @@ T3 z __attribute__ ((deprecated));
results in a warning on line 2 and 3 but not lines 4, 5, or 6. No
warning is issued for line 4 because T2 is not explicitly
deprecated. Line 5 has no warning because T3 is explicitly
-deprecated. Similarly for line 6.
+deprecated. Similarly for line 6. The optional msg
+argument, which must be a string, will be printed in the warning if
+present.
The @code{deprecated} attribute can also be used for functions and
variables (@pxref{Function Attributes}, @pxref{Variable Attributes}.)