public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: ghazi@caip.rutgers.edu
To: gcc-gnats@gcc.gnu.org
Subject: c/7101: attribute unused not honored on static variable preceeded by extern declaration
Date: Fri, 21 Jun 2002 14:49:00 -0000	[thread overview]
Message-ID: <20020621205412.1779.qmail@sources.redhat.com> (raw)


>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:


             reply	other threads:[~2002-06-21 20:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-21 14:49 ghazi [this message]
2003-01-08  2:02 bangerth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020621205412.1779.qmail@sources.redhat.com \
    --to=ghazi@caip.rutgers.edu \
    --cc=gcc-gnats@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).