[comp.unix.xenix.sco] GCC with Xenix Include files

pgd@bbt.se (10/16/90)

In article <1990Oct14.161854@cs.yale.edu> fields-doug@cs.yale.edu (Doug Fields) writes:
>I have a problem. Does anyone have a set of include and include/sys files that
>are AOK with GCC and are compatible with Xenix/386 from SCO? I got the compiler
>to run fine, etc., but really now... It doesn't like my includes, especially
>curses.h!!!
>
>Perhaps I have to make GREATER use of the -traditional flag... But c'mon now...
>Did SCO really mess up their compiler and DevSys that bad???
>
>Always looking for great Xenix ports of GNU products...
>
If you update to 2.3.3 you will find that the include files, if
possible, are even more screwed up. That is, the same symbols are
defined in different include files, that you sometimes have to load
together.
The solution is to edit the include files (are you listening SCO?) in
the style of:
	#ifndef SIZE_T_DEFINED
	typedef unsigned int size_t;
	#define	SIZE_T_DEFINED
	#endif
whenever you get a name clash. I have found around half a dozen of
them so far...
When you are there, you can as well putin definitions of the following
kind also:
	#ifndef STDIO_INCLUDED
	#define	STDIO_INCLUDED
	The sco-supplied stdio.h
	#endif

After this, most include files work with gcc and without -traditional.

ronald@robobar.co.uk (Ronald S H Khoo) (10/17/90)

In article <1990Oct16.081629.106@bbt.se> pgd@bbt.se writes:

> The solution is to edit the include files (are you listening SCO?) in
> the style of:
>	#ifndef SIZE_T_DEFINED
>	typedef unsigned int size_t;
>	#define	SIZE_T_DEFINED
>	#endif

I prefer Chris Torek's solution which is much cleaner, because it means
that you only have to maintain the machine dependent typedefs in ONE file.
It goes something like this:  The vendor (in this case SCO and Microsoft,
I guess) creates a "system" include file for use by the other include files
which simply

	#define _TYPEDEF_SIZE_T	int

and so on for each of these multiply defined system types.  Then, in each
file which wants to typedef size_t

	#include <sys/whatever.h>

	...

	#ifdef  _TYPEDEF_SIZE_T
	typedef _TYPEDEF_SIZE_T size_t
	#undef  _TYPEDEF_SIZE_T
	#endif

I thought it was really neat when I saw it.  Now who's first to market? :-)

Steve's just suggested an even neater solution:  have a directory
/usr/include/typedef with files like size_t.h containing ONE of the
traditional

	#ifndef SIZE_T_DEFINED
	typedef unsigned int size_t;
	#define	SIZE_T_DEFINED
	#endif

per each.  And have thousands of #include <typedef/*.h> in your include
files.  Might slow compilations down a little, though :-)
I think, given UNIX, Chris's solution is probably more "practical" :-)
-- 
ronald@robobar.co.uk +44 81 991 1142 (O) +44 71 229 7741 (H)

seanf@sco.COM (Sean Fagan) (10/19/90)

In article <1990Oct16.081629.106@bbt.se> pgd@bbt.se writes:
>If you update to 2.3.3 you will find that the include files, if
>possible, are even more screwed up. 

I think that the 2.3.1 DS update has this fix; the unix DS certainly
does (and many, many of the header files are protected against multiple
inclusion).

>	#ifndef SIZE_T_DEFINED

That, btw, is illegal, according to ANSI.  We use

	#ifndef	_SIZE_T
	typedef	unsigned int size_t;
	#	define _SIZE_T
	#endif	/* _SIZE_T */

which is legal (namespace problems).

>	#ifndef STDIO_INCLUDED

For these, it's of the format

	#ifndef	_STDIO_H
	#	define	_STDIO_H
	/* stdio.h stuff */
	#endif	/* _STDIO_H */

As I said, most of the header files in 3.2 have this already.

-- 
-----------------+
Sean Eric Fagan  | "*Never* knock on Death's door:  ring the bell and 
seanf@sco.COM    |   run away!  Death hates that!"
uunet!sco!seanf  |     -- Dr. Mike Stratford (Matt Frewer, "Doctor, Doctor")
(408) 458-1422   | Any opinions expressed are my own, not my employers'.

pgd@bbt.se (10/19/90)

In article <8279@scolex.sco.COM> seanf (Sean Fagan) writes:
>
>In article <1990Oct16.081629.106@bbt.se> pgd@bbt.se writes:
>>If you update to 2.3.3 you will find that the include files, if
>>possible, are even more screwed up. 
>
>I think that the 2.3.1 DS update has this fix; the unix DS certainly
>does (and many, many of the header files are protected against multiple
>inclusion).
>
>>	#ifndef SIZE_T_DEFINED
>
>That, btw, is illegal, according to ANSI.  We use
>
>	#ifndef	_SIZE_T
>	typedef	unsigned int size_t;
>	#	define _SIZE_T
>	#endif	/* _SIZE_T */
>
>which is legal (namespace problems).
>
>>	#ifndef STDIO_INCLUDED
>
>For these, it's of the format
>
>	#ifndef	_STDIO_H
>	#	define	_STDIO_H
>	/* stdio.h stuff */
>	#endif	/* _STDIO_H */
>
>As I said, most of the header files in 3.2 have this already.

Ok, i had the 2.3.0 dev sys, and the 2.3.2 for the rest. Then I
upgraded to 2.3.2 with xnx155, and the result had name clashes in the
.h-files. The worst one was size_t, that is defined in
stdio.h, stdlib.h, string.h and time.h
I don't know the logic for that, but there result is that you cannot
include any if those files together. Maybe cc ignores equal multiple
typedefs of the same type?

There were a few other symbols also, but since i very soon fixed the
include files, i have forgot which ones, and as i don't have the
original ones on-line, i cannot say what i have made, and sco have made.

As for the names chosen, i just picked any that i felt were quite
unique, inspired by header files from another system (where this is
consistenly done). I don't feel it like my job to make xenix
ANSI-conformant.

All in all, i am happy that i could get xnx155, without guarantees,
even if it meant i had to do some hand hacking of the include files.
If SCO now (maybe)have fixed that problem, it means that all future
buyers will not have it.

Another point:
In sys/types.h you can find definitions for uchar_t, ulong_t and ushort.
Why this inconsistency. Why not uchar and ulong, or ushort_t?
This means that i constantly have to comment out/define typedefs in
programs that i try to compile on xenix.