Bug 21427

Summary: g++ barfs on anonymous i386 sigjmp_buf structure
Product: Base System Reporter: earl_chew <earl_chew>
Component: i386Assignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 4.0-RELEASE   
Hardware: Any   
OS: Any   

Description earl_chew 2000-09-20 19:20:00 UTC
The definition in machine/setjmp.h for i386 is:

typedef struct { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
typedef struct { int _jb[_JBLEN + 1]; } jmp_buf[1];

g++ complains when it cannot resolve the name of the structure.

Fix: 

typedef struct _sigjmp_buf { int _sjb[_JBLEN + 1]; } sigjmp_buf[1];
typedef struct _jmp_buf { int _jb[_JBLEN + 1]; } jmp_buf[1];
How-To-Repeat: The following C++ program:

#include <setjmp.h>

sigjmp_buf& foo();

produces the following message:

foo.cc:3: non-local function `struct {anonymous} (& foo())[1]' uses anonymous ty
pe
Comment 1 earl_chew 2000-09-20 19:28:16 UTC
An additional problem with i386 machine/setjmp.h is that doesn't
have #inclusion guards to prevent problems with multiple inclusions.

Something like:

#ifndef _MACHINE_SETJMP_H
#define _MACHINE_SETJMP_H
...

#endif

Earl
-- 
>----------------------------------------------------------------------+
> Earl Chew                              http://www.agilent.com        |
> Agilent Technologies                   mailto:earl_chew@agilent.com  |
> Advanced Networks Division             Tel:   +1 604 454 3411        |
> 2500-4710 Kingsway                     Fax:   +1 604 454 3401        |
> Burnaby BC V5H 4M2 Canada                                            |
>----------------------------------------------------------------------+
Comment 2 Bruce Evans freebsd_committer freebsd_triage 2000-10-06 12:58:26 UTC
State Changed
From-To: open->closed

Equivalent to PR 16170.  Fixed in -current.  Will be fixed in 
RELENG_4 in a few days.  Doesn't affect RELENG_3.
Comment 3 Bruce Evans 2000-10-06 13:03:36 UTC
On Wed, 20 Sep 2000, Earl Chew wrote:

>  An additional problem with i386 machine/setjmp.h is that doesn't
>  have #inclusion guards to prevent problems with multiple inclusions.

This can be considered as a feature.  <machine/setjmp.h> should only
be included by <setjmp.h> and there is an inclusion in the latter.

Bruce
Comment 4 andy 2000-10-19 05:41:07 UTC
I hit this today with 4.1-STABLE.  The last update to the PR was Oct.06
(almost two weeks). Any ETA's on MFCs BDE? (TLA-itis!)
--
Andy Newman, Principal Software Engineer, Silverbrook Research
Comment 5 Bruce Evans 2000-10-27 10:18:36 UTC
On Wed, 18 Oct 2000, Andy Newman wrote:

>  I hit this today with 4.1-STABLE.  The last update to the PR was Oct.06
>  (almost two weeks). Any ETA's on MFCs BDE? (TLA-itis!)

Done.  So it should be fixed in 4.2.

Bruce