From nobody  Tue Apr 29 12:40:05 1997
Received: (from nobody@localhost)
          by hub.freebsd.org (8.8.5/8.8.5) id MAA05042;
          Tue, 29 Apr 1997 12:40:05 -0700 (PDT)
Message-Id: <199704291940.MAA05042@hub.freebsd.org>
Date: Tue, 29 Apr 1997 12:40:05 -0700 (PDT)
From: j.loverso@opengroup.org
To: freebsd-gnats-submit@freebsd.org
Subject: __attribute__((__unused__)) doesn't work
X-Send-Pr-Version: www-1.0

>Number:         3419
>Category:       kern
>Synopsis:       __attribute__((__unused__)) doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr 29 12:50:01 PDT 1997
>Closed-Date:    Tue Apr 29 23:04:49 MEST 1997
>Last-Modified:  Tue Apr 29 23:05:37 MEST 1997
>Originator:     John LoVerso
>Release:        2.2.1
>Organization:
Open Group Research Inst
>Environment:
FreeBSD freebase.osf.org 2.2.1-RELEASE FreeBSD 2.2.1-RELEASE #0: Thu Mar 27 08:40:39 EST 1997     loverso@freebase.osf.org:/usr/src/sys/compile/USEFUL+snd  i386

>Description:
The system comes with GCC 2.7.2.1.  /usr/include/sys/cdefs.h says:

        #if __GNUC__ == 2 && __GNUC_MINOR__ >= 7 || __GNUC__ >= 3
        #define __dead
        #define __dead2         __attribute__((__noreturn__))
        #define __pure
        #define __pure2         __attribute__((__const__))
        #define __unused        __attribute__((__unused__))
        #endif

However,I tried to compile Berk DB 2.0.  It has code like this:
(starting at line 340)

        typedef struct _hoffpage {
                u_int8_t  type;         /*    00: Page type and delete flag. */
                u_int8_t  __unused[3];  /* 01-03: Padding, unused. */

When it gets compiled, it complains:

        ../dist/../include/db_page.h:342: parse error before `['
        ../dist/../include/db_page.h:342: warning: no semicolon at end of struct
 or union

It appears that  __attribute__((__unused__)) doesn't work.


I'm not sure which catagory this bug is in.  Is it kern?  (/usr/include/sys/cdef.h)
Is it GNU (gcc).  Is it misc?
>How-To-Repeat:
Try to compile DB 2.0

fetch ftp://ftp.sleepycat.com/pub/db.tar.gz
tar zxvf db.tar.gz
cd db-2.0.4/build.unix
../dist/configure
make

>Fix:
Fix GCC?
Fix /usr/include/sys/cdefs.h
>Release-Note:
>Audit-Trail:

From: j@uriah.heep.sax.de (J Wunsch)
To: j.loverso@opengroup.org
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/3419: __attribute__((__unused__)) doesn't work
Date: Tue, 29 Apr 1997 22:28:28 +0200

 As j.loverso@opengroup.org wrote:
 
 > However,I tried to compile Berk DB 2.0.  It has code like this:
 > (starting at line 340)
 > 
 >         typedef struct _hoffpage {
 >                 u_int8_t  type;         /*    00: Page type and delete flag. */
 >                 u_int8_t  __unused[3];  /* 01-03: Padding, unused. */
 
 This is broken code.  Names starting with an underscore are reserved
 for the implementation.  No userland program (and Berkeley DB is
 userland in this sense) has the right to use them.
 
 > It appears that  __attribute__((__unused__)) doesn't work.
 
 It does.  It's working in a totally different way than what you would
 expect, like:
 
 __unused void
 somefunc(void)
 {
 	/* this is unused */
 }
 
 > I'm not sure which catagory this bug is in.
 
 Ask the people at Berkeley. :-)
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Tue Apr 29 23:04:49 MEST 1997 
State-Changed-Why:  
Usage error for __attribute in Berkeley DB. 

>Unformatted:
