Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Feb 1995 00:52:53 -0500 (EST)
From:      "Adrian T. Filipi-Martin" <atf3r@agate.cs.virginia.edu>
To:        FreeBSD Questions List <questions@FreeBSD.org>
Subject:   g++ & header file problems in FreeBSD 2.0
Message-ID:  <Pine.SUN.3.90.950215002535.8637C-100000@agate.cs.Virginia.EDU>

next in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.SUN.3.90.950215002535.8637C-100000>