public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34985]  New: Warning "defined but not used" despite __attribute__((__used__))
@ 2008-01-26 20:07 sam at ravnborg dot org
  2008-01-26 20:48 ` [Bug c/34985] " rguenth at gcc dot gnu dot org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sam at ravnborg dot org @ 2008-01-26 20:07 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]

Exact gcc version (Fedora 8): gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33)

Following small code snippet:

static void remove_one(void);
static void __attribute__((__used__)) remove_one(void)
{
}

build with:
gcc -c -Wall test.c

produces following warning:
test.c:4: warning: ‘remove_one’ defined but not used

Removing the forward declaration (prototye) or
adding the attribute to the forward declaration make
the warning disappear.

I had expected the attribution on the function to take
precedence over the forward declaration.

Browsing the gcc manual did not reveal an answer and searching
the web / the bug database did not bring up an answer
so I decided to report it as a bug.

/Sam


-- 
           Summary: Warning "defined but not used" despite
                    __attribute__((__used__))
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sam at ravnborg dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

* [Bug c/34985] Warning "defined but not used" despite __attribute__((__used__))
  2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
@ 2008-01-26 20:48 ` rguenth at gcc dot gnu dot org
  2008-02-02 12:53 ` manu at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2008-01-26 20:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2008-01-26 20:09 -------
Confirmed.  Not a regression.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
      Known to fail|                            |4.3.0
   Last reconfirmed|0000-00-00 00:00:00         |2008-01-26 20:09:33
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

* [Bug c/34985] Warning "defined but not used" despite __attribute__((__used__))
  2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
  2008-01-26 20:48 ` [Bug c/34985] " rguenth at gcc dot gnu dot org
@ 2008-02-02 12:53 ` manu at gcc dot gnu dot org
  2008-07-29 10:02 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-02-02 12:53 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2008-02-02 12:52 -------
Patch here: http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00044.html

I miss the patch tracker :(


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org
OtherBugsDependingO|                            |33702
              nThis|                            |
         AssignedTo|unassigned at gcc dot gnu   |manu at gcc dot gnu dot org
                   |dot org                     |
             Status|NEW                         |ASSIGNED
           Keywords|                            |patch
   Last reconfirmed|2008-01-26 20:09:33         |2008-02-02 12:52:41
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

* [Bug c/34985] Warning "defined but not used" despite __attribute__((__used__))
  2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
  2008-01-26 20:48 ` [Bug c/34985] " rguenth at gcc dot gnu dot org
  2008-02-02 12:53 ` manu at gcc dot gnu dot org
@ 2008-07-29 10:02 ` manu at gcc dot gnu dot org
  2008-07-29 10:09 ` manu at gcc dot gnu dot org
  2008-12-29 14:50 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-07-29 10:02 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from manu at gcc dot gnu dot org  2008-07-29 10:01 -------
Subject: Bug 34985

Author: manu
Date: Tue Jul 29 10:00:25 2008
New Revision: 138235

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=138235
Log:
2008-07-29  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR 34985
        * c-decl.c (merge_decls): Merge USED flags.
cp/
        * decl.c (duplicate_decls): Merge USED flags.
testsuite/
        * gcc.dg/pr34985.c: New.
        * g++.dg/warn/pr34985.C: New.


Added:
    trunk/gcc/testsuite/g++.dg/warn/pr34985.C
    trunk/gcc/testsuite/gcc.dg/pr34985.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-decl.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

* [Bug c/34985] Warning "defined but not used" despite __attribute__((__used__))
  2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
                   ` (2 preceding siblings ...)
  2008-07-29 10:02 ` manu at gcc dot gnu dot org
@ 2008-07-29 10:09 ` manu at gcc dot gnu dot org
  2008-12-29 14:50 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: manu at gcc dot gnu dot org @ 2008-07-29 10:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2008-07-29 10:08 -------
Fixed in GCC 4.4


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

* [Bug c/34985] Warning "defined but not used" despite __attribute__((__used__))
  2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
                   ` (3 preceding siblings ...)
  2008-07-29 10:09 ` manu at gcc dot gnu dot org
@ 2008-12-29 14:50 ` pinskia at gcc dot gnu dot org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-12-29 14:50 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.4.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34985


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

end of thread, other threads:[~2008-12-29 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-26 20:07 [Bug c/34985] New: Warning "defined but not used" despite __attribute__((__used__)) sam at ravnborg dot org
2008-01-26 20:48 ` [Bug c/34985] " rguenth at gcc dot gnu dot org
2008-02-02 12:53 ` manu at gcc dot gnu dot org
2008-07-29 10:02 ` manu at gcc dot gnu dot org
2008-07-29 10:09 ` manu at gcc dot gnu dot org
2008-12-29 14:50 ` pinskia at gcc dot gnu dot org

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