From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3517 invoked by alias); 21 Jun 2002 20:56:04 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 3465 invoked by uid 71); 21 Jun 2002 20:56:01 -0000 Resent-Date: 21 Jun 2002 20:56:01 -0000 Resent-Message-ID: <20020621205601.3464.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, ghazi@caip.rutgers.edu Received: (qmail 1781 invoked by uid 61); 21 Jun 2002 20:54:12 -0000 Message-Id: <20020621205412.1779.qmail@sources.redhat.com> Date: Fri, 21 Jun 2002 14:49:00 -0000 From: ghazi@caip.rutgers.edu Reply-To: ghazi@caip.rutgers.edu To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c/7101: attribute unused not honored on static variable preceeded by extern declaration X-SW-Source: 2002-06/txt/msg00537.txt.bz2 List-Id: >Number: 7101 >Category: c >Synopsis: attribute unused not honored on static variable preceeded by extern declaration >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Jun 21 13:56:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Kaveh Ghazi >Release: gcc version 3.2 20020620 (experimental) >Organization: >Environment: probably all (but at least on sparc-sun-solaris2.7) >Description: I've written the following testcase suitable for installation as gcc.dc/unused-#.c when its been fixed. currently, if you compile this code you get 'defined but not used' warnings for all three variables. (Given the attributes, you should only get it for i1.) This is the cause of a warning from libobjc/encoding.c, where even though the `target_flags' variable has attribute unused set on it you still get this message: > libobjc/encoding.c:83: warning: `target_flags' defined Here's what the testcase below yields: > unused-5.c:8: warning: `i1' defined but not used > unused-5.c:9: warning: `i2' defined but not used > unused-5.c:10: warning: `i3' defined but not used /* { dg-do compile } */ /* { dg-options "-Wunused -O2" } */ #define UNUSED __attribute__ ((__unused__)) extern int i1, i2, i3; static int i1 = 0; /* { dg-warning "defined but not used" } */ static int UNUSED i2 = 0; static int i3 UNUSED = 0; >How-To-Repeat: >Fix: >Release-Note: >Audit-Trail: >Unformatted: