public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/7101: attribute unused not honored on static variable preceeded by extern declaration
@ 2003-01-08  2:02 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-01-08  2:02 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, ghazi, nobody

Synopsis: attribute unused not honored on static variable preceeded by extern declaration

State-Changed-From-To: open->analyzed
State-Changed-By: bangerth
State-Changed-When: Tue Jan  7 18:02:48 2003
State-Changed-Why:
    Confirmed. Is indeed platform independent.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7101


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c/7101: attribute unused not honored on static variable preceeded by extern declaration
@ 2002-06-21 14:49 ghazi
  0 siblings, 0 replies; 2+ messages in thread
From: ghazi @ 2002-06-21 14:49 UTC (permalink / raw)
  To: gcc-gnats


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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-01-08  2:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-08  2:02 c/7101: attribute unused not honored on static variable preceeded by extern declaration bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-06-21 14:49 ghazi

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).