diff options
| author | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-20 16:09:27 +0000 |
|---|---|---|
| committer | zack <zack@138bc75d-0d04-0410-961f-82ee72b054a4> | 2000-04-20 16:09:27 +0000 |
| commit | 24d8c4e40388e2be4e9f1873f70385e458706386 (patch) | |
| tree | 36bd10e47a2198434af77623ce8e77ff074823a0 | |
| parent | da9f46e601cb8603f20bedbdc0574ecbbbb3695a (diff) | |
| download | ppe42-gcc-24d8c4e40388e2be4e9f1873f70385e458706386.tar.gz ppe42-gcc-24d8c4e40388e2be4e9f1873f70385e458706386.zip | |
* c-common.c (decl_attributes) [A_ALIAS]: Set TREE_USED on the
object pointed to.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@33284 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/ChangeLog | 5 | ||||
| -rw-r--r-- | gcc/c-common.c | 2 | ||||
| -rw-r--r-- | gcc/testsuite/gcc.dg/20000419-2.c | 17 |
3 files changed, 24 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d863072038f..970c789d308 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2000-04-20 Zack Weinberg <zack@wolery.cumb.org> + + * c-common.c (decl_attributes) [A_ALIAS]: Set TREE_USED on the + object pointed to. + Thu Apr 20 14:19:18 MET DST 2000 Jan Hubicka <jh@suse.cz> * loop.c (emit_iv_add_mult): Simplify it's input and emit diff --git a/gcc/c-common.c b/gcc/c-common.c index 386721a66d4..32b2ede864b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -981,6 +981,8 @@ decl_attributes (node, attributes, prefix_attributes) break; } id = get_identifier (TREE_STRING_POINTER (id)); + /* This counts as a use of the object pointed to. */ + TREE_USED (id) = 1; if (TREE_CODE (decl) == FUNCTION_DECL) DECL_INITIAL (decl) = error_mark_node; diff --git a/gcc/testsuite/gcc.dg/20000419-2.c b/gcc/testsuite/gcc.dg/20000419-2.c new file mode 100644 index 00000000000..05e4729572c --- /dev/null +++ b/gcc/testsuite/gcc.dg/20000419-2.c @@ -0,0 +1,17 @@ +/* A static function with a global alias should not get 'defined but + not used' warnings. Exposed by Linux kernel. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +extern void do_something (void); +extern void do_something_else (void); + +static int +init_foobar(void) /* { dg-bogus "defined but not used" "not used warning" } */ +{ + do_something(); + do_something_else(); + return 0; +} + +int init_module(void) __attribute__((alias("init_foobar"))); |

