diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-07 06:39:04 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-06-07 06:39:04 +0000 |
commit | e1c8f1c586d8879584089e0f35bae491164de9b8 (patch) | |
tree | d6bdaa5091ac13eeb83382f918486bf5eb98b1f4 /gcc/doc | |
parent | b633be6df2f4c62590ba87a05c103f07a249fd5c (diff) | |
download | gcc-e1c8f1c586d8879584089e0f35bae491164de9b8.tar.gz |
./:
* doc/extend.texi (Attribute Syntax): Document that C++ labels on
empty statements can now have attributes.
cp/:
* parser.c (cp_parser_label_for_labeled_statement): Support
attribute on labels if immediately followed by semicolon.
* semantics.c (finish_label_stmt): Return new label.
* pt.c (tsubst_expr): Handle attributes for LABEL_EXPR.
testsuite/:
* gcc.dg/Wunused-label-1.c: New test case.
* g++.dg/warn/Wunused-label-1.C: New test case.
* g++.dg/warn/Wunused-label-2.C: New test case.
* g++.dg/warn/Wunused-label-3.C: New test case.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@148242 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/doc')
-rw-r--r-- | gcc/doc/extend.texi | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 98df9d59447..df900fd46b1 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -3440,11 +3440,13 @@ feature is intended for code generated by programs which contains labels that may be unused but which is compiled with @option{-Wall}. It would not normally be appropriate to use in it human-written code, though it could be useful in cases where the code that jumps to the label is -contained within an @code{#ifdef} conditional. GNU C++ does not permit -such placement of attribute lists, as it is permissible for a -declaration, which could begin with an attribute list, to be labelled in -C++. Declarations cannot be labelled in C90 or C99, so the ambiguity -does not arise there. +contained within an @code{#ifdef} conditional. GNU C++ only permits +attributes on labels if the attribute specifier is immediately +followed by a semicolon (i.e., the label applies to an empty +statement). If the semicolon is missing, C++ label attributes are +ambiguous, as it is permissible for a declaration, which could begin +with an attribute list, to be labelled in C++. Declarations cannot be +labelled in C90 or C99, so the ambiguity does not arise there. An attribute specifier list may appear as part of a @code{struct}, @code{union} or @code{enum} specifier. It may go either immediately |