c-common.c (decl_attributes): Allow applying attribute `unused' on a LABEL_DECL.
* c-common.c (decl_attributes): Allow applying attribute `unused' on a LABEL_DECL. * c-parse.in (label): Parse attributes after a label, and call `decl_attributes' to handle them. * gansidecl.h (ATTRIBUTE_UNUSED_LABEL): Define. * genrecog.c (OUTPUT_LABEL, write_tree_1, write_tree): When generating labels, mark them with ATTRIBUTE_UNUSED_LABEL. * invoke.texi: Note that labels can be marked `unused'. From-SVN: r24478
This commit is contained in:
parent
fbc7f4a22d
commit
736b02fdfa
@ -1,3 +1,18 @@
|
||||
Mon Jan 4 10:30:33 1999 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
|
||||
|
||||
* c-common.c (decl_attributes): Allow applying attribute `unused'
|
||||
on a LABEL_DECL.
|
||||
|
||||
* c-parse.in (label): Parse attributes after a label, and call
|
||||
`decl_attributes' to handle them.
|
||||
|
||||
* gansidecl.h (ATTRIBUTE_UNUSED_LABEL): Define.
|
||||
|
||||
* genrecog.c (OUTPUT_LABEL, write_tree_1, write_tree): When
|
||||
generating labels, mark them with ATTRIBUTE_UNUSED_LABEL.
|
||||
|
||||
* invoke.texi: Note that labels can be marked `unused'.
|
||||
|
||||
Sun Jan 3 23:32:18 PST 1999 Jeff Law (law@cygnus.com)
|
||||
|
||||
* version.c: Bump for snapshot.
|
||||
|
@ -521,7 +521,8 @@ decl_attributes (node, attributes, prefix_attributes)
|
||||
TREE_USED (type) = 1;
|
||||
else if (TREE_CODE (decl) == PARM_DECL
|
||||
|| TREE_CODE (decl) == VAR_DECL
|
||||
|| TREE_CODE (decl) == FUNCTION_DECL)
|
||||
|| TREE_CODE (decl) == FUNCTION_DECL
|
||||
|| TREE_CODE (decl) == LABEL_DECL)
|
||||
TREE_USED (decl) = 1;
|
||||
else
|
||||
warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name));
|
||||
|
1226
gcc/c-parse.c
1226
gcc/c-parse.c
File diff suppressed because it is too large
Load Diff
@ -2214,12 +2214,15 @@ label: CASE expr_no_commas ':'
|
||||
error_with_decl (duplicate, "this is the first default label");
|
||||
}
|
||||
position_after_white_space (); }
|
||||
| identifier ':'
|
||||
| identifier ':' maybe_attribute
|
||||
{ tree label = define_label (input_filename, lineno, $1);
|
||||
stmt_count++;
|
||||
emit_nop ();
|
||||
if (label)
|
||||
expand_label (label);
|
||||
{
|
||||
expand_label (label);
|
||||
decl_attributes (label, $3, NULL_TREE);
|
||||
}
|
||||
position_after_white_space (); }
|
||||
;
|
||||
|
||||
|
@ -2019,12 +2019,15 @@ label: CASE expr_no_commas ':'
|
||||
error_with_decl (duplicate, "this is the first default label");
|
||||
}
|
||||
position_after_white_space (); }
|
||||
| identifier ':'
|
||||
| identifier ':' maybe_attribute
|
||||
{ tree label = define_label (input_filename, lineno, $1);
|
||||
stmt_count++;
|
||||
emit_nop ();
|
||||
if (label)
|
||||
expand_label (label);
|
||||
{
|
||||
expand_label (label);
|
||||
decl_attributes (label, $3, NULL_TREE);
|
||||
}
|
||||
position_after_white_space (); }
|
||||
;
|
||||
|
||||
|
@ -38,6 +38,14 @@ Boston, MA 02111-1307, USA. */
|
||||
# define __attribute__(x)
|
||||
#endif
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED_LABEL
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 92)
|
||||
# define ATTRIBUTE_UNUSED_LABEL
|
||||
# else
|
||||
# define ATTRIBUTE_UNUSED_LABEL ATTRIBUTE_UNUSED
|
||||
# endif /* GNUC < 2.92 */
|
||||
#endif /* ATTRIBUTE_UNUSED_LABEL */
|
||||
|
||||
#ifndef ATTRIBUTE_UNUSED
|
||||
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
|
||||
#endif /* ATTRIBUTE_UNUSED */
|
||||
|
@ -51,6 +51,9 @@ Boston, MA 02111-1307, USA. */
|
||||
#include "rtl.h"
|
||||
#include "obstack.h"
|
||||
|
||||
#define OUTPUT_LABEL(INDENT_STRING, LABEL_NUMBER) \
|
||||
printf("%sL%d: ATTRIBUTE_UNUSED_LABEL\n", (INDENT_STRING), (LABEL_NUMBER))
|
||||
|
||||
static struct obstack obstack;
|
||||
struct obstack *rtl_obstack = &obstack;
|
||||
|
||||
@ -1103,7 +1106,7 @@ write_tree_1 (tree, prevpos, afterward, type)
|
||||
printf ("\n");
|
||||
if (tree && tree->subroutine_number == 0)
|
||||
{
|
||||
printf (" L%d:\n", tree->number);
|
||||
OUTPUT_LABEL (" ", tree->number);
|
||||
tree->label_needed = 0;
|
||||
}
|
||||
|
||||
@ -1239,7 +1242,7 @@ write_tree_1 (tree, prevpos, afterward, type)
|
||||
|
||||
if (p->label_needed && (p->retest_mode || p->retest_code))
|
||||
{
|
||||
printf ("%sL%d:\n", indents[indent - 2], p->number);
|
||||
OUTPUT_LABEL (indents[indent - 2], p->number);
|
||||
p->label_needed = 0;
|
||||
}
|
||||
|
||||
@ -1330,7 +1333,7 @@ write_tree_1 (tree, prevpos, afterward, type)
|
||||
/* Now that most mode and code tests have been done, we can write out
|
||||
a label for an inner node, if we haven't already. */
|
||||
if (p->label_needed)
|
||||
printf ("%sL%d:\n", indents[indent - 2], p->number);
|
||||
OUTPUT_LABEL (indents[indent - 2], p->number);
|
||||
|
||||
inner_indent = indent;
|
||||
|
||||
@ -1563,7 +1566,7 @@ write_tree (tree, prevpos, afterward, initial, type)
|
||||
|
||||
if (! initial && tree->subroutine_number > 0)
|
||||
{
|
||||
printf (" L%d:\n", tree->number);
|
||||
OUTPUT_LABEL (" ", tree->number);
|
||||
|
||||
if (afterward)
|
||||
{
|
||||
|
@ -1340,7 +1340,7 @@ In order to get a warning about an unused function parameter, you must
|
||||
specify both @samp{-W} and @samp{-Wunused}.
|
||||
|
||||
To suppress this warning for an expression, simply cast it to void. For
|
||||
unused variables and parameters, use the @samp{unused} attribute
|
||||
unused variables, parameters and labels, use the @samp{unused} attribute
|
||||
(@pxref{Variable Attributes}).
|
||||
|
||||
@item -Wuninitialized
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -2128,12 +2128,15 @@ label: CASE expr_no_commas ':'
|
||||
error_with_decl (duplicate, "this is the first default label");
|
||||
}
|
||||
position_after_white_space (); }
|
||||
| identifier ':'
|
||||
| identifier ':' maybe_attribute
|
||||
{ tree label = define_label (input_filename, lineno, $1);
|
||||
stmt_count++;
|
||||
emit_nop ();
|
||||
if (label)
|
||||
expand_label (label);
|
||||
{
|
||||
expand_label (label);
|
||||
decl_attributes (label, $3, NULL_TREE);
|
||||
}
|
||||
position_after_white_space (); }
|
||||
;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user