aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/extend.texi
diff options
context:
space:
mode:
authorLubos Lunak <l.lunak@suse.cz>2013-07-14 01:16:18 +0200
committerJason Merrill <jason@gcc.gnu.org>2013-07-13 19:16:18 -0400
commit2a99e5e633fb1faddeb8c8ce7b1429dedebb033b (patch)
tree0170fc55d95b627aec9918256ba3cf861f269fd3 /gcc/doc/extend.texi
parent286e8fc16fb582ee1cb3869aafb87309542a55ec (diff)
downloadgcc-2a99e5e633fb1faddeb8c8ce7b1429dedebb033b.zip
gcc-2a99e5e633fb1faddeb8c8ce7b1429dedebb033b.tar.gz
gcc-2a99e5e633fb1faddeb8c8ce7b1429dedebb033b.tar.bz2
re PR c++/55203 (No unused warning for variables of non-trivial types)
PR c++/55203 c-family/ * c-common.c (c_common_attribute_table): Add warn_unused. (handle_warn_unused_attribute): New. cp/ * init.c (build_aggr_init): Check for warn_unused attribute. * decl.c (poplevel): Likewise. From-SVN: r200941
Diffstat (limited to 'gcc/doc/extend.texi')
-rw-r--r--gcc/doc/extend.texi17
1 files changed, 17 insertions, 0 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi
index 1c85a3e..721c9b1 100644
--- a/gcc/doc/extend.texi
+++ b/gcc/doc/extend.texi
@@ -16377,6 +16377,23 @@ only be applied to classes declared within an @code{extern "Java"} block.
Calls to methods declared in this interface are dispatched using GCJ's
interface table mechanism, instead of regular virtual table dispatch.
+@item warn_unused
+@cindex @code{warn_unused} attribute
+
+For C++ types with non-trivial constructors and/or destructors it is
+impossible for the compiler to determine whether a variable of this
+type is truly unused if it is not referenced. This type attribute
+informs the compiler that variables of this type should be warned
+about if they appear to be unused, just like variables of fundamental
+types.
+
+This attribute is appropriate for types which just represent a value,
+such as @code{std::string}; it is not appropriate for types which
+control a resource, such as @code{std::mutex}.
+
+This attribute is also accepted in C, but it is unnecessary because C
+does not have constructors or destructors.
+
@end table
See also @ref{Namespace Association}.