From:	CRDGW2::CRDGW2::MRGATE::"SMTP::PREP.AI.MIT.EDU::HELP-GCC-REQUEST"  2-FEB-1991 19:03:33.98
To:	MRGATE::"ARISIA::EVERHART"
CC:	
Subj:	Re: gcc and SunOs 4.1

Received:  by crdgw1.ge.com (5.57/GE 1.80)
	 id AA24904; Sat, 2 Feb 91 18:42:10 EST
Received: by life.ai.mit.edu (4.1/AI-4.10) id AA21635; Wed, 30 Jan 91 15:38:51 EST
Return-Path: <help-gcc-request@prep.ai.mit.edu>
Received: from aeneas.MIT.EDU by life.ai.mit.edu (4.1/AI-4.10) id AA21568; Wed, 30 Jan 91 15:37:04 EST
Received: from tut.cis.ohio-state.edu by aeneas.MIT.EDU (5.61/4.7) id AA24363; Wed, 30 Jan 91 15:35:15 -0500
Received: by tut.cis.ohio-state.edu (5.61-kk/5.910130)
	id AA26216; Wed, 30 Jan 91 15:31:44 -0500
Received: from USENET by tut.cis.ohio-state.edu with netnews
	for help-gcc@prep.ai.mit.edu (help-gcc@prep.ai.mit.edu)
	(contact usenet@tut.cis.ohio-state.edu if you have questions)
Date: 30 Jan 91 04:43:05 GMT
From: oakhill!oakhill!abair@cs.utexas.edu  (Alan Bair)
Organization: SSDT, Motorola Inc., Austin, Texas.
Subject: Re: gcc and SunOs 4.1
Message-Id: <ABAIR.91Jan29224305@turbinia.sps.mot.com>
References: <RJC.91Jan28004810@brodie.uk.ac.ed.cstr>
Sender: help-gcc-request@prep.ai.mit.edu
To: help-gcc@prep.ai.mit.edu

In article <MLEISHER.91Jan28083940@thrinakia.nmsu.edu> mleisher@nmsu.edu (Mark Leisher) writes:


   In article <RJC.91Jan28004810@brodie.uk.ac.ed.cstr> rjc@uk.ac.ed.cstr (Richard Caley) writes:


      There seem to be major type clashes between gcc (specifically
      stddefs.h, but possibly also internaly) and the Sun supplied header
      files for SunOs 4.1

      All of the errors seem to localise to the sun header sys/systypes.h
      which defines things like size_t in a way which clashes with
      stddefs.h. This makes life dificult when trying to compile anything
      even vaguely ANSIised. 

   Try using "fixincludes".

I ran into the same include typing mismatch and tried "fixincludes", did not
help.  So I moved the Sun sys/stdtypes.h into the gcc-include directory and
modified to match the gcc typing.  Here is my version of sys/stdtypes.h

-----------
/* ARB 01/16/91 Fix for size_t & ptrdiff_t declaration mismatch
 *              This is a copy of the Sun stdtypes.h file.
 *              gcc will look here first.
 *              Include gcc's stddef, where the types are declared.
 */

/*	@(#)stdtypes.h 1.6 90/01/04 SMI	*/

/*
 * Suppose you have an ANSI C or POSIX thingy that needs a typedef
 * for thingy_t.  Put it here and include this file wherever you
 * define the thingy.  This is used so that we don't have size_t in
 * N (N > 1) different places and so that we don't have to have
 * types.h included all the time and so that we can include this in
 * the lint libs instead of termios.h which conflicts with ioctl.h.
 */
#ifndef	__sys_stdtypes_h
#define	__sys_stdtypes_h

typedef	int		sigset_t;	/* signal mask - may change */

typedef	unsigned int	speed_t;	/* tty speeds */
typedef	unsigned long	tcflag_t;	/* tty line disc modes */
typedef	unsigned char	cc_t;		/* tty control char */
typedef	int		pid_t;		/* process id */

typedef	unsigned short	mode_t;		/* file mode bits */
typedef	short		nlink_t;	/* links to a file */

typedef	long		clock_t;	/* units=ticks (typically 60/sec) */
typedef	long		time_t;		/* value = secs since epoch */

#if 0
/* ARB Sun's version */
typedef	int		size_t;		/* ??? */
typedef int		ptrdiff_t;	/* result of subtracting two pointers */
#else
/* ARB Include stddef.h from gcc to get size_t & ptrdiff_t */
#include <stddef.h>
#endif

typedef	unsigned short	wchar_t;	/* big enough for biggest char set */

#endif	/* !__sys_stdtypes_h */

------------

This has worked fine on both Sun3 OS4.0.3 & 4.1 and Sun4 OS4.1.
I had actually asked about when I first found it, but never got
any replies, though our News server was having problems.  Hope this
helps others with the same problem.
--
Alan Bair                 SSDT (formerly SPS CAD)
Motorola, Inc.            Logic Simulation & Test
Austin, Texas             abair@turbinia.sps.mot.com
