From: tmcconne@sedona.intel.com (Tom McConnell)
Subject: gcc-2.3.2 / NCR-3350 SVR4.02 <netinet/in.h> bug
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 22 Dec 1992 02:56:31 GMT

  Howdy.

  I have finished porting gcc-2.3.2 to the NCR-3350, and used it to compile
X11R5p21 and libg++-2.3. This report concerns the <netinet/in.h> include file.

    Cheers,

    Tom McConnell

 Tom McConnell          |     Internet: tmcconne@sedona.intel.com
 Intel, Corp. C3-91     |     Phone: (602)-554-8229
 5000 W. Chandler Blvd. | The opinions expressed are my own. No one in 
 Chandler, AZ  85226    | their right mind would claim them.

Problem: <netinet/in.h> defines some external functions who declare 
        "struct sockaddr" without a previous definition.

Program: float.c

/* Test in.h */
#include <stdio.h>
#include <netinet/in.h>
main()
{
    printf("test in.h \n");
}

Example compile:

gcc -v    -c in.c -o in.o
Reading specs from /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/specs
gcc version 2.3.2
 /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/cpp -lang-c -v -undef -D__GNUC__=2
 -Di386 -Dunix -D__svr4__ -D__i386__ -D__unix__ -D__svr4__ -D__i386 -D__unix
 -D__svr4__ -Asystem(unix) -Acpu(i386) -Amachine(i386) in.c /var/tmp/cca003SE.i
GNU CPP version 2.3.2 (i386 System V Release 4)
 /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/cc1 /var/tmp/cca003SE.i -quiet
 -dumpbase in.c -version -o /var/tmp/cca003SE.s
GNU C version 2.3.2 (i386 System V Release 4) compiled by GNU C version 2.3.2.
In file included from in.c:3:
/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/include/netinet/in.h:221: warning:
 `struct sockaddr' declared inside parameter list
/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/include/netinet/in.h:221: warning:
 its scope is only this definition or declaration,
/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/include/netinet/in.h:221: warning:
 which is probably not what you want.
/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/include/netinet/in.h:222: warning:
 `struct sockaddr' declared inside parameter list
 /usr/ccs/bin/as -V -Qy -o in.o /var/tmp/cca003SE.s
as: Standard C Development Environment  (SCDE) 5.0  04/19/90
rm -f in
gcc -v -g -o in in.o
Reading specs from /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/specs
gcc version 2.3.2
 /usr/ccs/bin/ld -V -Y P,/usr/ccs/lib:/usr/lib -Qy -o in /usr/ccs/lib/crt1.o
 /usr/ccs/lib/crti.o /usr/ccs/lib/values-Xa.o
 /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/crtbegin.o
 -L/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2 -L/usr/ccs/bin -L/usr/ccs/lib
 -L/stor/gnu/iAWS/lib in.o -lgcc -lc
 /stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/crtend.o /usr/ccs/lib/crtn.o -lgcc
ld: Standard C Development Environment  (SCDE) 5.0  04/19/90

Analysis: This section of <netinet/in.h> appears to be for kernels only.

Solution: Add an "#ifdef _KERNEL" around the affected area in <netinet/in.h>.

Patch:
This patch file was created on Tue Dec 22 09:38:19 MST 1992.

The top level directory was /a/stor/gnu/iAWS/lib/gcc-lib/ncr3000/2.3.2/include


*** ./netinet/in.h_orig	Tue Dec 22 09:20:29 1992
--- ./netinet/in.h	Sun Dec 20 20:59:48 1992
***************
*** 199,202 ****
--- 199,203 ----
  #endif
  
+ #ifdef _KERNEL
  #ifdef INKERNEL
  
***************
*** 225,228 ****
--- 226,230 ----
  
  #endif	/* INKERNEL */
+ #endif /* _KERNEL */
  #undef	_PROTO
  

Newsgroups: gnu.gcc.bug