From owner-freebsd-questions Tue Feb 14 21:53:48 1995 Return-Path: questions-owner Received: (from root@localhost) by freefall.cdrom.com (8.6.9/8.6.6) id VAA05880 for questions-outgoing; Tue, 14 Feb 1995 21:53:48 -0800 Received: from virginia.edu (uvaarpa.Virginia.EDU [128.143.2.7]) by freefall.cdrom.com (8.6.9/8.6.6) with SMTP id VAA05874 for ; Tue, 14 Feb 1995 21:53:47 -0800 Received: from server.cs.virginia.edu by uvaarpa.virginia.edu id aa08789; 15 Feb 95 0:53 EST Received: from agate.cs.Virginia.EDU by uvacs.cs.virginia.edu (4.1/5.1.UVA) id AA26336; Wed, 15 Feb 95 00:52:55 EST Posted-Date: Wed, 15 Feb 1995 00:52:53 -0500 (EST) Received: by agate.cs.Virginia.EDU (4.1/SMI-2.0) id AA09459; Wed, 15 Feb 95 00:52:54 EST Date: Wed, 15 Feb 1995 00:52:53 -0500 (EST) From: "Adrian T. Filipi-Martin" Reply-To: adrian@virginia.edu To: FreeBSD Questions List Subject: g++ & header file problems in FreeBSD 2.0 Message-Id: Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: questions-owner@FreeBSD.org Precedence: bulk Hi everyone, In getting Nachos to compile under FreeBSD 2.0, I encountered a few problems. The first looks like a possible compiler bug. The second is just a warning, but it too may indicate a compiler problem. Initially, I was getting the following error form g++: > /usr/include/stdio.h:338: warning: declaration of `_p' shadows a > member of `this' It seems that g++ gets confused and cannot distinguish the _p argument from the _p member of the FILE struct (see diff below and /usr/include/stdio.h). By renaming _p to _fp, I got rid of the problem. Can anyone indicate whether this problem still exists with g++ 2.6.3? If so, should we fix the FreeBSD stdio.h to avoid this problem? I am willing to write up a bug report for the gcc/g++ developers if necessary. ---begin-diff------------ nachos@lorax> diff -c stdio.h.orig stdio.h *** stdio.h.orig Tue Nov 22 06:38:43 1994 --- stdio.h Tue Feb 14 21:51:17 1995 *************** *** 335,345 **** */ #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) #if defined(__GNUC__) && defined(__STDC__) ! static __inline int __sputc(int _c, FILE *_p) { ! if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) ! return (*_p->_p++ = _c); else ! return (__swbuf(_c, _p)); } #else /* --- 335,345 ---- */ #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) #if defined(__GNUC__) && defined(__STDC__) ! static __inline int __sputc(int _c, FILE *_fp) { ! if (--_fp->_w >= 0 || (_fp->_w >= _fp->_lbfsize && (char)_c != '\n')) ! return (*_fp->_p++ = _c); else ! return (__swbuf(_c, _fp)); } #else /* ---end-diff--------- Second, I get a number of seemingly bogus warnings from /usr/include/signal.h: > /usr/include/signal.h:52: warning: `int sigaction(int, const struct > sigaction *, struct sigaction *)' hides constructor for `struct sigaction' After looking at the headers, I can see why g++ complains (and gcc doesn't), but something tells me that it should not complain in this case, because it is a system provided header about which joe-user can do nothing. Any comments? cheers, Adrian adrian@virginia.edu ---->>>>| Support your local programmer, http://uvacs.cs.virginia.edu/~atf3r/ --->>>| STOP Software Patent Abuses NOW! Member: The League for -->>| info at ftp.uu.net:/doc/lpf, print Programming Freedom ->| "join.ps.Z" for an application