Commit 36b29d7d by Geoffrey Keating Committed by Geoffrey Keating

toplev.c (check_global_declarations): Suppress not-used warning for volatile variables.

2003-05-05  Geoffrey Keating  <geoffk@apple.com>

	* toplev.c (check_global_declarations): Suppress not-used warning
	for volatile variables.

Index: testsuite/ChangeLog
2003-05-05  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/unused-5.c: New test.

From-SVN: r66493
parent 9e5f281f
2003-05-05 Geoffrey Keating <geoffk@apple.com>
* toplev.c (check_global_declarations): Suppress not-used warning
for volatile variables.
2003-05-05 Olivier Hainque <hainque@act-europe.fr> 2003-05-05 Olivier Hainque <hainque@act-europe.fr>
* expr.c (expand_expr, case BIT_FIELD_REF): Refine the test forcing * expr.c (expand_expr, case BIT_FIELD_REF): Refine the test forcing
......
2003-05-05 Geoffrey Keating <geoffk@apple.com>
* gcc.dg/unused-5.c: New test.
2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> 2003-05-05 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
PR c++/10496 PR c++/10496
......
/* { dg-do compile } */
/* { dg-options "-Wunused" } */
/* { dg-final { scan-assembler "string_to_look_for" } } */
/* 'volatile' variables get output and don't produce a warning about being
unused. */
static volatile char string[]
= "string_to_look_for"; /* { dg-bogus "not used" } */
...@@ -2132,6 +2132,8 @@ check_global_declarations (vec, len) ...@@ -2132,6 +2132,8 @@ check_global_declarations (vec, len)
&& ! TREE_USED (DECL_NAME (decl)) && ! TREE_USED (DECL_NAME (decl))
&& ! DECL_EXTERNAL (decl) && ! DECL_EXTERNAL (decl)
&& ! TREE_PUBLIC (decl) && ! TREE_PUBLIC (decl)
/* A volatile variable might be used in some non-obvious way. */
&& ! TREE_THIS_VOLATILE (decl)
/* Global register variables must be declared to reserve them. */ /* Global register variables must be declared to reserve them. */
&& ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl)) && ! (TREE_CODE (decl) == VAR_DECL && DECL_REGISTER (decl))
/* Otherwise, ask the language. */ /* Otherwise, ask the language. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment