GCC 1.39 patches for SCO UNIX, plus extras
Chip Salzenberg
chip at tct.uucp
Tue Feb 12 09:27:16 AEST 1991
The enclosed patches are a port of GCC 1.39 to SCO UNIX.
I appreciate RMS's addition of a SCO configuration file and other
patches to GCC 1.39. However, there were a few things overlooked
which are addressed herein, such as STRUCT_RETURN_CALLER_POP in
tm-i386sco.h. Also, RMS isn't going to add the Microsloth "#pragma
pack()" to mainstream GCC, so it is still a custom add-on. (GCC 2.0
will have a keyword to indicate packing, so all is not lost. :-))
NON-SCO USERS: You will be interested in the patch to stmt.c; it is
the GCC side of a G++ bug fix.
NON-SCO USERS OF SYSTEM V: You will want to use the patch to symout.c
to use getcwd() instead of getwd().
SCO USERS: At the end of the patches is a sharchive containing three
files you'll need to build GCC:
Makefile-sco A copy of my Makefile; uses "rcc" to compile GCC.
pragma.c Support for structure packing ("#pragma pack").
packtest.c Regression test for "#pragma pack".
Thanks again to Steve Bleazard for the original "#pragma pack"
support, done for a Xenix/386 port: he's a brave man. And, of course,
thanks to RMS for an excellent compiler.
Index: tm-i386sco.h
***************
*** 17,21 ****
#undef LIB_SPEC
#define LIB_SPEC \
! "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} libintl.a%s -lc"
/* Specify predefined symbols in preprocessor. */
--- 17,21 ----
#undef LIB_SPEC
#define LIB_SPEC \
! "%{p:-L/usr/lib/libp}%{pg:-L/usr/lib/libp} -lintl -lc"
/* Specify predefined symbols in preprocessor. */
***************
*** 31,32 ****
--- 31,43 ----
#define NO_DOLLAR_IN_LABEL
+
+ /* SCO's libraries are compiled with Microsoft C, which requires the
+ caller to pop the extra argument passed to functions that return
+ structures. */
+
+ #define STRUCT_RETURN_CALLER_POP
+
+ /* SCO's use of Microsoft C requires us to support #pragma pack(),
+ which controls structure packing, until GCC 2.0 is released. */
+
+ #define PRAGMA_PACK
Index: gcc.c
***************
*** 300,304 ****
%{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
%{y*} %{!A:%{!nostdlib:%S}} \
! %{L*} %o %{!nostdlib:gnulib%s %{g:-lg} %L gnulib%s %{!A:%E}}\n }}}}";
/* Accumulate a command (program name and args), and run it. */
--- 300,304 ----
%{A} %{d} %{e*} %{N} %{n} %{r} %{s} %{S} %{T*} %{t} %{u*} %{X} %{x} %{z}\
%{y*} %{!A:%{!nostdlib:%S}} \
! %{L*} -L%A %o %{!nostdlib:%{g:-lg} gnulib%s %L gnulib%s %{!A:%E}}\n }}}}";
/* Accumulate a command (program name and args), and run it. */
***************
*** 1199,1202 ****
--- 1199,1207 ----
case 0:
fatal ("Invalid specification! Bug in cc.");
+
+ case 'A':
+ obstack_grow (&obstack, standard_startfile_prefix,
+ strlen (standard_startfile_prefix));
+ break;
case 'b':
Index: stmt.c
***************
*** 1429,1432 ****
--- 1429,1437 ----
block = block->next;
+ /* Only use `last_insn' if there are cleanups which must be run. */
+
+ if (block || cleanup_label != 0)
+ last_insn = get_last_insn ();
+
/* If yes, use a goto to return, since that runs cleanups. */
Index: stor-layout.c
***************
*** 499,502 ****
--- 499,506 ----
layout_decl (field, var_size ? size_unit : const_size);
+ #ifdef PRAGMA_PACK
+ if (pragma_pack_seen())
+ DECL_ALIGN(field) = MIN(pragma_align_val(), DECL_ALIGN(field));
+ #endif
desired_align = DECL_ALIGN (field);
Index: symout.c
***************
*** 1243,1247 ****
buffer.filedir = (char *) next_address;
#ifdef USG
! strcpy (dir, getcwd (dir, MAXNAMLEN));
#else
#ifndef VMS
--- 1243,1251 ----
buffer.filedir = (char *) next_address;
#ifdef USG
! {
! extern char *getcwd();
! if (getcwd (dir, MAXNAMLEN) == 0)
! strcpy (dir, ".");
! }
#else
#ifndef VMS
Index: version.c
***************
*** 1 ****
! char *version_string = "1.39";
--- 1,9 ----
! #include "config.h"
!
! char *version_string =
! #ifdef PRAGMA_PACK
! "1.39 (#pragma pack)"
! #else
! "1.39"
! #endif
! ;
Index: c-parse.y
***************
*** 1794,1799 ****
&& getc (finput) == 'm'
&& getc (finput) == 'a'
! && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
goto skipline;
}
--- 1794,1843 ----
&& getc (finput) == 'm'
&& getc (finput) == 'a'
! && ((c = getc (finput)) == ' ' || c == '\t'))
! {
! #ifdef PRAGMA_PACK
! int i;
!
! while ((c = getc (finput)) == ' ' || c == '\t')
! ;
! ungetc (c, finput);
! for (i = 0; i < 32; ++i) /* arbitrary pragma directive size */
! {
! if ((c = getc (finput)) < 'a' || c > 'z')
! {
! ungetc (c, finput);
! break;
! }
! token_buffer[i] = c;
! }
! token_buffer[i] = '\0';
!
! if (strcmp(token_buffer, "pack") != 0)
! goto skipline;
!
! if ((c = getc (finput)) != '(')
! {
! ungetc (c, finput);
! error ("invalid #pragma pack");
! goto skipline;
! }
!
! if ((c = getc (finput)) == '1' || c == '2' || c == '4')
! {
! pragma_pack (c - '0');
! c = getc (finput);
! }
! else
! pragma_pack_default ();
!
! if (c != ')')
! {
! ungetc (c, finput);
! error ("invalid #pragma pack");
! goto skipline;
! }
! #endif
goto skipline;
+ }
}
Index: c-parse.tab.c
***************
*** 750,753 ****
--- 750,754 ----
#ifdef __GNUC__
+ #undef alloca
#define alloca __builtin_alloca
#else /* Not GNU C. */
***************
*** 3023,3028 ****
&& getc (finput) == 'm'
&& getc (finput) == 'a'
! && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
goto skipline;
}
--- 3024,3073 ----
&& getc (finput) == 'm'
&& getc (finput) == 'a'
! && ((c = getc (finput)) == ' ' || c == '\t'))
! {
! #ifdef PRAGMA_PACK
! int i;
!
! while ((c = getc (finput)) == ' ' || c == '\t')
! ;
! ungetc (c, finput);
! for (i = 0; i < 32; ++i) /* arbitrary pragma directive size */
! {
! if ((c = getc (finput)) < 'a' || c > 'z')
! {
! ungetc (c, finput);
! break;
! }
! token_buffer[i] = c;
! }
! token_buffer[i] = '\0';
!
! if (strcmp(token_buffer, "pack") != 0)
! goto skipline;
!
! if ((c = getc (finput)) != '(')
! {
! ungetc (c, finput);
! error ("invalid #pragma pack");
! goto skipline;
! }
!
! if ((c = getc (finput)) == '1' || c == '2' || c == '4')
! {
! pragma_pack (c - '0');
! c = getc (finput);
! }
! else
! pragma_pack_default ();
!
! if (c != ')')
! {
! ungetc (c, finput);
! error ("invalid #pragma pack");
! goto skipline;
! }
! #endif
goto skipline;
+ }
}
////////////////////////
// NEW FILES FOLLOW //
////////////////////////
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: Makefile-sco pragma.c packtest.c
# Wrapped by chip at tct on Mon Feb 11 17:24:45 1991
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'Makefile-sco' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'Makefile-sco'\"
else
echo shar: Extracting \"'Makefile-sco'\" \(28005 characters\)
sed "s/^X//" >'Makefile-sco' <<'END_OF_FILE'
X# Makefile for GNU C compiler.
X# Copyright (C) 1987, 1988 Free Software Foundation, Inc.
X
X#This file is part of GNU CC.
X
X#GNU CC is free software; you can redistribute it and/or modify
X#it under the terms of the GNU General Public License as published by
X#the Free Software Foundation; either version 1, or (at your option)
X#any later version.
X
X#GNU CC is distributed in the hope that it will be useful,
X#but WITHOUT ANY WARRANTY; without even the implied warranty of
X#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
X#GNU General Public License for more details.
X
X#You should have received a copy of the GNU General Public License
X#along with GNU CC; see the file COPYING. If not, write to
X#the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
X
X
X# Variables that exist for you to override.
X# See below for how to change them for certain systems.
X
XCFLAGS = -O $(XCFLAGS)
XCC = cc
XBISON = bison
XBISONFLAGS = -v
X# This should be the version of ar to use with output from GCC.
XAR = ar
XSHELL = /bin/sh
X# on sysV, define this as cp.
XINSTALL = install -c
X# Directory not specified here so that, if a GNU ranlib
X# is earlier in the path, it will be used.
X# That is likely to be true on systems that have the GNU ar
X# installed earlier in the path.
XRANLIB = ranlib
X
X# Compiler to use for compiling gnulib.
X# OLDCC should not be the GNU C compiler.
XOLDCC = cc
X
X# CFLAGS for use with OLDCC, for compiling gnulib.
X# NOTE: -O does not work on some Unix systems!
X# On them, you must take it out.
XCCLIBFLAGS=-O
X
X# This should be the version of ar to use with output from $(OLDCC).
XOLDAR = ar
X
X# CFLAGS for use with OLDCC, for compiling hard-params.
XHARD_PARAMS_FLAGS= $(RCCFLAGS)
X
X# Directory where sources are, from where we are.
Xsrcdir = .
X# Directory in which to put the executable for the command `gcc'
Xbindir = $(prefix)/u/local/bin
X# Directory in which to put the subprograms used by the compiler.
Xlibdir = $(prefix)/u/local/lib
X# Directory in which to put man pages.
Xmandir = $(prefix)/u/local/man/man.C
X# Number to put in man-page filename.
Xmanext = C
X
X# Additional system libraries to link with.
XCLIB=
X
X# Change this to a null string if obstacks are installed in the
X# system library.
XOBSTACK=obstack.o
X
X# Directory to link to, when using the target `maketest'.
XDIR = ../gcc
X
X# End of variables for you to override.
X
X
X# Variables you should change for certain systems.
X
X# These are what you would need on HPUX:
X# CFLAGS = -Wc,-Ns2000 -Wc,-Ne700 -Wc,-Np300
X# If you are using the GNU assembler and linker on HPUX,
X# add -I../hp-include to CFLAGS.
X# -g is desirable in CFLAGS, but a compiler bug in HPUX version 5
X# bites whenever tree.def, rtl.def or machmode.def is included
X# (ie., on every source file).
X# If you have a floating point accelerator, you might want -lsetjmp as well.
X# CCLIBFLAGS = -Wc,-Ns2000 -Wc,-Ne700 -O
X# HARD_PARAMS_FLAGS = -Wc,-Ns2000 -Wc,-Ne700
X# INSTALL = cp
X# For CCLIBFLAGS you might want to specify the switch that
X# forces only 68000 instructions to be used.
X# If using the GNU assembler and linker, set AR to the GNU ar program,
X# wherever that is.
X# To get a working alloca, you may need to get alloca.s from Emacs
X# and assemble it into alloca.o rather than using alloca.c.
X
X# On the Sequent, you may need to set CCLIBFLAG to empty.
X
X# On the 3b1, this line may help you compile gnulib
X# if you already have a prior version of gcc installed.
X# CCLIBFLAGS = -B/usr/local/lib/gcc- -tp -Wp,-traditional
X
X# On SysV from SCO, uncomment these lines as well as those for SysV in general.
X# You might also want to remove limits.h from the definition of USER_H,
X# since the one that comes with the system is good for POSIX.
XRANLIB = :
XCC = rcc
XOLDCC = rcc
XRCCFLAGS = -Dunix -Di386 -DM_UNIX -DM_I386
X# Uncomment the following lines if CC is rcc.
XXCFLAGS = $(RCCFLAGS)
XCLIB = -lPW
X
X# On a 386 running an ISC system, uncomment the following lines.
X# You also need to add -D_POSIX_SOURCE to CFLAGS
X# when compiling with GCC.
X# INSTALL = cp
X# CLIB = -lPW -lcposix
X
X# If you are making gcc for the first time, and if you are compiling it with
X# a non-gcc compiler, and if your system doesn't have a working alloca() in any
X# of the standard libraries (as is true for HP/UX or Genix),
X# then un-comment the following line when compiling with the system's cc:
X# ALLOCA = alloca.o
X# But don't do that if compiling using GCC.
X
X# If your system has a working alloca in /lib/libPW.a,
X# un-comment the following line. Note that -lPW doesn't work on HPUX or IRIX.
X# CLIB= -lPW
X
X# On SysV R4, when compiling with PCC, you can get alloca as follows:
X# CLIB = -lc /usr/ucblib/libucb.a
X# -lc is needed because if libucb.a were searched before libc.a,
X# you would get an incompatible stdio package that won't work.
X
X# On the NCR Tower 32 running SVR3, says ra at intsys.no :
X# Do *not* enable optimization in CFLAGS when using the native cc, because:
X# a) The optimizer seems to loop when invoked with -O2.
X# b) The -O1 level does stack/frame pointer optimizations that make the
X# assembler alloca in libPW.a fail, and the C alloca eats *lots* of memory.
X# c) gcc will eventually be recompiled with itself, so all this doesn't matter.
X# CFLAGS = -g -O0
X# HARD_PARAMS_FLAGS = -O0
X# CCLIBFLAGS = -O2
X# CLIB = -lmalloc -lPW
X
X# On a pyramid, you need to uncomment the following line:
X# CLIB = -lc /usr/.attlib/libPW.a
X
X# If your system's malloc() routine fails for any reason (as it does on
X# certain versions of Genix), try getting the files
X# malloc.c and getpagesize.h from GNU Emacs and un-comment the following line:
X# MALLOC = malloc.o
X
X# To build gcc for Apollo 68K machines you must be running at least SR10.2
X# with the 6.7 version of the C compiler. Use 'apollo68' as the argument to
X# config.gcc, then go into a bsd4.3 environment and use this:
X# CFLAGS = -g -O -Acpu,3000 -Arun,bsd4.3 -Asys,any -Anansi $(XCFLAGS)
X# CCLIBFLAGS = -O -Acpu,3000 -Arun,bsd4.3 -Asys,any -Anansi
X# HARD_PARAMS_FLAGS= -Anansi
X# (Says vasta at apollo.com.)
X
X
X# Dependency on obstack, alloca, malloc or whatever library facilities
X# are not installed in the system libraries.
XLIBDEPS= $(OBSTACK) $(ALLOCA) $(MALLOC)
X
X# How to link with both our special library facilities
X# and the system's installed libraries.
XLIBS = $(OBSTACK) $(ALLOCA) $(MALLOC) $(CLIB)
X
X# Specify the directories to be searched for header files.
X# Both . and srcdir are used, in that order,
X# so that tm.h and config.h will be found in the compilation
X# subdirectory rather than in the source directory.
XINCLUDES = -I. -I$(srcdir) -I$(srcdir)/config
XSUBDIR_INCLUDES = -I.. -I../$(srcdir) -I../$(srcdir)/config
X
X# Always use -I$(srcdir)/config when compiling.
X.c.o:
X $(CC) -c $(CFLAGS) $(CPPFLAGS) $(INCLUDES) $<
X
X# Language-specific object files for C.
XC_OBJS = c-parse.tab.o c-decl.o c-typeck.o c-convert.o
X
X# Language-specific object files for C++.
X# (These are not yet released.)
XCPLUS_OBJS = cplus-parse.o cplus-decl.o cplus-typeck.o \
X cplus-cvt.o cplus-search.o cplus-lex.o \
X cplus-class.o cplus-init.o cplus-method.o
X
X# Language-independent object files.
XOBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
X rtl.o rtlanal.o expr.o stmt.o expmed.o explow.o optabs.o varasm.o \
X symout.o dbxout.o sdbout.o emit-rtl.o insn-emit.o \
X integrate.o jump.o cse.o loop.o flow.o stupid.o combine.o \
X regclass.o local-alloc.o global-alloc.o reload.o reload1.o caller-save.o \
X insn-peep.o final.o recog.o insn-recog.o insn-extract.o insn-output.o \
X pragma.o getcwd.o
X
X# Files to be copied away after each stage in building.
XSTAGE_GCC=gcc
XSTAGESTUFF = *.o insn-flags.h insn-config.h insn-codes.h \
X insn-output.c insn-recog.c insn-emit.c insn-extract.c insn-peep.c \
X stamp-flags stamp-config stamp-codes \
X stamp-output stamp-recog stamp-emit stamp-extract stamp-peep \
X genemit genoutput genrecog genextract genflags gencodes genconfig genpeep \
X cc1 cpp cccp # cc1plus
X
X# Members of gnulib.
XLIBFUNCS = _eprintf _builtin_new _builtin_New _builtin_del _bb \
X _umulsi3 _mulsi3 _udivsi3 _divsi3 _umodsi3 _modsi3 \
X _lshrsi3 _lshlsi3 _ashrsi3 _ashlsi3 \
X _divdf3 _muldf3 _negdf2 _adddf3 _subdf3 _cmpdf2 \
X _fixunsdfsi _fixdfsi _floatsidf _truncdfsf2 _extendsfdf2 \
X _addsf3 _negsf2 _subsf3 _cmpsf2 _mulsf3 _divsf3
X
X# Library members defined in gnulib2.c.
XLIB2FUNCS = _adddi3 _subdi3 _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 \
X _anddi3 _iordi3 _xordi3 _lshrdi3 _lshldi3 _ashldi3 _ashrdi3 _one_cmpldi2 \
X _bdiv _cmpdi2 _ucmpdi2 _fixunsdfdi _fixdfdi _floatdidf _varargs
X
X# Header files that are made available to programs compiled with gcc.
X# FOR SCO UNIX: limits.h has been removed
XUSER_H = stddef.h assert.h va-i860.h va-mips.h va-pyr.h va-sparc.h \
X va-spur.h proto.h # limits.h
X
X# The files that "belong" in CONFIG_H are deliberately omitted
X# because having them there would not be useful in actual practice.
X# All they would do is cause complete recompilation every time
X# one of the machine description files is edited.
X# That may or may not be what one wants to do.
X# If it is, rm *.o is an easy way to do it.
X# CONFIG_H = config.h tm.h
XCONFIG_H =
XRTL_H = rtl.h rtl.def machmode.def
XTREE_H = tree.h real.h tree.def machmode.def
XCPLUS_TREE_H = $(TREE_H) cplus-tree.h c-tree.h
X
X# Note that dependencies on obstack.h are not written
X# because that file is not part of GCC.
X# Dependencies on gvarargs.h are not written
X# because all that file does, when not compiling with GCC,
X# is include the system varargs.h.
X
Xall: config.status gnulib gcc cc1 cpp float.h gnulib2 libg # cc1plus
X
X# Use this instead of `all' if you need to convert the libraries
X# before you can use the compiler.
X# Don't forget to do `make gnulib2' before installation.
Xall-libconvert: config.status gnulib gcc cc1 cpp float.h libg # cc1plus
X
Xlang-c: config.status gnulib gcc cc1 cpp gnulib2 libg
X# lang-cplus: config.status gnulib gcc cc1plus cpp gnulib2 libg
X
Xconfig.status:
X @echo You must configure gcc. Look at the INSTALL file for details.
X @false
X
Xdoc: $(srcdir)/cpp.info $(srcdir)/gplus.info $(srcdir)/gcc.info
X
Xcompilations: ${OBJS}
X
Xgcc: gcc.o version.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o gccnew gcc.o version.o $(LIBS)
X# Go via `gccnew' to avoid `file busy' if $(CC) is `gcc'.
X mv gccnew gcc
X
Xcc1: $(C_OBJS) $(OBJS) $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o cc1 $(C_OBJS) $(OBJS) $(LIBS)
X
Xcc1plus: $(CPLUS_OBJS) $(OBJS) $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o cc1plus $(CPLUS_OBJS) $(OBJS) $(LIBS)
X
X# Make sure there is some libg.a to be found,
X# in case compiling with a GCC that was built but not installed.
Xlibg:
X if [ ! -f /lib/libg.a -a ! -f /usr/lib/libg.a ]; \
X then ar rc libg.a; else true; fi
X
X#Library of arithmetic subroutines
X# Don't compile this with gcc!
X# (That would cause most arithmetic functions to call themselves.)
Xgnulib: gnulib.c $(CONFIG_H) config.status
X -rm -f stamp-gnulib2
X rm -f tmpgnulib gnulib; \
X for name in $(LIBFUNCS); \
X do \
X echo $${name}; \
X rm -f $${name}.c; \
X cp $(srcdir)/gnulib.c $${name}.c; \
X $(OLDCC) $(CCLIBFLAGS) $(INCLUDES) -c -DL$${name} $${name}.c; \
X $(OLDAR) qc tmpgnulib $${name}.o; \
X rm -f $${name}.[co]; \
X done
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ;then $(RANLIB) tmpgnulib; else true; fi
X# Actually build it in tmpgnulib above, then rename now,
X# so that gnulib itself remains nonexistent if compilation is aborted.
X mv tmpgnulib gnulib
X# On HPUX, if you are working with the GNU assembler and linker,
X# the previous two command lines must be replaced with the following line.
X# No change is needed here if you are using the HPUX assembler and linker.
X# ../hp-bin/hpxt tmpgnulib gnulib
X
Xgnulib2: stamp-gnulib2;
Xstamp-gnulib2: gnulib2.c gnulib cc1 gcc cpp $(CONFIG_H)
X for name in $(LIB2FUNCS); \
X do \
X echo $${name}; \
X ./gcc -B./ -fstrength-reduce -O $(INCLUDES) $(GNULIB2_CFLAGS) -c -DL$${name} $(srcdir)/gnulib2.c -o $${name}.o; \
X $(AR) rc gnulib $${name}.o; \
X rm -f $${name}.o; \
X done
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then $(RANLIB) gnulib; else true; fi
X# On HPUX, if you are working with the GNU assembler and linker,
X# the previous line must be commented out.
X# No change is needed here if you are using the HPUX assembler and linker.
X touch stamp-gnulib2
X
Xfloat.h:
X# Originally, we used `make' rather than $(MAKE), to avoid propagating
X# a CC=gcc command option. However, since hard-params is now made
X# with $(OLDCC) explicitly, this is no longer important.
X# However, $(MAKE) fails on some systems where it isn't defined.
X# `make' has the disadvantage of sometimes running the system's make,
X# instead of GNU make. And the system's make might not support VPATH.
X# However, the compilation of hard-params should not need to use VPATH,
X# due to the explicit use of `$(srcdir)'.
X make hard-params
X -./hard-params -f > float.h
X
X# Compile hard-params with standard cc. It avoids some headaches.
Xhard-params: hard-params.o
X $(OLDCC) $(HARD_PARAMS_FLAGS) $(LDFLAGS) hard-params.o -o $@
Xhard-params.o: $(srcdir)/hard-params.c
X -cp $(srcdir)/hard-params.c . > /dev/null 2>&1
X $(OLDCC) $(HARD_PARAMS_FLAGS) $(CPPFLAGS) -DNO_SC -c hard-params.c
X
X# C language specific files.
X
Xc-parse.tab.o : $(srcdir)/c-parse.tab.c $(CONFIG_H) $(TREE_H) c-parse.h c-tree.h input.h
X $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.tab.c
X$(srcdir)/c-parse.tab.c : $(srcdir)/c-parse.y
X $(BISON) $(BISONFLAGS) $(srcdir)/c-parse.y -o $@
X
Xc-decl.o : c-decl.c $(CONFIG_H) $(TREE_H) c-tree.h c-parse.h flags.h
Xc-typeck.o : c-typeck.c $(CONFIG_H) $(TREE_H) c-tree.h flags.h
Xc-convert.o : c-convert.c $(CONFIG_H) $(TREE_H)
X
X# C++ language specific files.
X
Xcplus-parse.o : $(srcdir)/cplus-parse.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
X $(CC) -c $(CFLAGS) $(INCLUDES) \
X -DPARSE_OUTPUT=\"$(PWD)/cplus-parse.output\" \
X `echo $(srcdir)/cplus-parse.c | sed 's,^\./,,'`
X
X$(srcdir)/cplus-parse.h $(srcdir)/cplus-parse.c : $(srcdir)/cplus-parse.y
X @echo expect 49 shift/reduce conflicts and 4 reduce/reduce conflicts
X $(BISON) $(BISONFLAGS) -d -o $(srcdir)/cplus-parse.c $(srcdir)/cplus-parse.y
X
Xcplus-lex.o : cplus-lex.c $(CONFIG_H) $(CPLUS_TREE_H) $(srcdir)/cplus-parse.h
Xcplus-decl.o : cplus-decl.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
Xcplus-typeck.o : cplus-typeck.c $(CONFIG_H) $(CPLUS_TREE_H) flags.h
Xcplus-class.o : cplus-class.c $(CONFIG_H) $(CPLUS_TREE_H)
Xcplus-init.o : cplus-init.c $(CONFIG_H) $(CPLUS_TREE_H)
Xcplus-method.o : cplus-method.c $(CONFIG_H) $(CPLUS_TREE_H)
Xcplus-cvt.o : cplus-cvt.c $(CONFIG_H) $(CPLUS_TREE_H)
Xcplus-search.o : cplus-search.c $(CONFIG_H) $(CPLUS_TREE_H)
Xnew-method.o : new-method.c $(CONFIG_H) $(CPLUS_TREE_H)
X
X# Language-independent files.
X
Xgcc.o: gcc.c $(CONFIG_H) gvarargs.h obstack.h
X $(CC) $(CFLAGS) $(INCLUDES) \
X -DSTANDARD_STARTFILE_PREFIX=\"$(libdir)/\" \
X -DSTANDARD_EXEC_PREFIX=\"$(libdir)/gcc-\" -c \
X `echo $(srcdir)/gcc.c | sed 's,^\./,,'`
X
Xversion.o: version.c
Xobstack.o: obstack.c
X
Xtree.o : tree.c $(CONFIG_H) $(TREE_H) flags.h
Xprint-tree.o : print-tree.c $(CONFIG_H) $(TREE_H)
Xstor-layout.o : stor-layout.c $(CONFIG_H) $(TREE_H) $(RTL_H)
Xfold-const.o : fold-const.c $(CONFIG_H) $(TREE_H)
Xtoplev.o : toplev.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h input.h
X
Xrtl.o : rtl.c $(CONFIG_H) $(RTL_H)
X
Xrtlanal.o : rtlanal.c $(CONFIG_H) $(RTL_H)
X
Xvarasm.o : varasm.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h expr.h \
X insn-codes.h hard-reg-set.h
Xstmt.o : stmt.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
X insn-flags.h insn-config.h insn-codes.h expr.h regs.h hard-reg-set.h recog.h
Xexpr.o : expr.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
X insn-flags.h insn-codes.h expr.h insn-config.h recog.h typeclass.h
Xexpmed.o : expmed.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
X insn-flags.h insn-codes.h expr.h insn-config.h recog.h
Xexplow.o : explow.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h insn-codes.h
Xoptabs.o : optabs.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h \
X insn-flags.h insn-codes.h expr.h insn-config.h recog.h
Xsymout.o : symout.c $(CONFIG_H) $(TREE_H) $(RTL_H) symseg.h gdbfiles.h
Xdbxout.o : dbxout.c $(CONFIG_H) $(TREE_H) $(RTL_H) flags.h
Xsdbout.o : sdbout.c $(CONFIG_H) $(TREE_H) $(RTL_H)
X
Xemit-rtl.o : emit-rtl.c $(CONFIG_H) $(RTL_H) regs.h insn-config.h real.h
X
Xintegrate.o : integrate.c $(CONFIG_H) $(RTL_H) $(TREE_H) flags.h expr.h \
X insn-flags.h insn-codes.h
X
Xjump.o : jump.c $(CONFIG_H) $(RTL_H) flags.h regs.h
Xstupid.o : stupid.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h
X
Xcse.o : cse.c $(CONFIG_H) $(RTL_H) regs.h hard-reg-set.h flags.h real.h
Xloop.o : loop.c $(CONFIG_H) $(RTL_H) insn-config.h insn-codes.h \
X regs.h hard-reg-set.h recog.h flags.h expr.h
Xflow.o : flow.c $(CONFIG_H) $(RTL_H) basic-block.h regs.h hard-reg-set.h
Xcombine.o : combine.c $(CONFIG_H) $(RTL_H) flags.h \
X insn-config.h regs.h basic-block.h recog.h
Xregclass.o : regclass.c $(CONFIG_H) $(RTL_H) hard-reg-set.h flags.h \
X basic-block.h regs.h insn-config.h recog.h
Xlocal-alloc.o : local-alloc.c $(CONFIG_H) $(RTL_H) flags.h basic-block.h regs.h \
X hard-reg-set.h insn-config.h recog.h
Xglobal-alloc.o : global-alloc.c $(CONFIG_H) $(RTL_H) flags.h \
X basic-block.h regs.h hard-reg-set.h insn-config.h
X
Xreload.o : reload.c $(CONFIG_H) $(RTL_H) flags.h \
X reload.h recog.h hard-reg-set.h insn-config.h regs.h
Xreload1.o : reload1.c $(CONFIG_H) $(RTL_H) flags.h \
X reload.h regs.h hard-reg-set.h insn-config.h basic-block.h recog.h
Xcaller-save.o : caller-save.c $(CONFIG_H) $(RTL_H) flags.h \
X reload.h regs.h hard-reg-set.h insn-config.h basic-block.h recog.h
Xfinal.o : final.c $(CONFIG_H) $(RTL_H) flags.h regs.h recog.h conditions.h \
X gdbfiles.h insn-config.h real.h output.h
Xrecog.o : recog.c $(CONFIG_H) $(RTL_H) \
X regs.h recog.h hard-reg-set.h insn-config.h real.h
X
X# Normally this target is not used; but it is used if you
X# define ALLOCA=alloca.o. In that case, you must get a suitable alloca.c
X# from the GNU Emacs distribution.
X# Note some machines won't allow $(CC) without -S on this source file.
Xalloca.o: alloca.c
X $(CC) $(CFLAGS) -S `echo $(srcdir)/alloca.c | sed 's,^\./,,'`
X as alloca.s -o alloca.o
X
X# Now the source files that are generated from the machine description.
X
X.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
X insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c
X
X# The following pair of rules has this effect:
X# genconfig is run only if the md has changed since genconfig was last run;
X# but the file insn-config.h is touched only when its contents actually change.
X
X# Each of the other insn-* files is handled by a similar pair of rules.
X
Xinsn-config.h: stamp-config ;
Xstamp-config : md genconfig $(srcdir)/move-if-change
X ./genconfig md > tmp-config.h
X $(srcdir)/move-if-change tmp-config.h insn-config.h
X touch stamp-config
X
Xinsn-flags.h: stamp-flags ;
Xstamp-flags : md genflags $(srcdir)/move-if-change
X ./genflags md > tmp-flags.h
X $(srcdir)/move-if-change tmp-flags.h insn-flags.h
X touch stamp-flags
X
Xinsn-codes.h: stamp-codes ;
Xstamp-codes : md gencodes $(srcdir)/move-if-change
X ./gencodes md > tmp-codes.h
X $(srcdir)/move-if-change tmp-codes.h insn-codes.h
X touch stamp-codes
X
Xinsn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) expr.h real.h insn-codes.h \
X insn-config.h insn-flags.h
X $(CC) $(CFLAGS) $(INCLUDES) -c insn-emit.c
X
Xinsn-emit.c: stamp-emit ;
Xstamp-emit : md genemit $(srcdir)/move-if-change
X ./genemit md > tmp-emit.c
X $(srcdir)/move-if-change tmp-emit.c insn-emit.c
X touch stamp-emit
X
Xinsn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h real.h recog.h
X $(CC) $(CFLAGS) $(INCLUDES) -c insn-recog.c
X
Xinsn-recog.c: stamp-recog ;
Xstamp-recog : md genrecog $(srcdir)/move-if-change
X ./genrecog md > tmp-recog.c
X $(srcdir)/move-if-change tmp-recog.c insn-recog.c
X touch stamp-recog
X
Xinsn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H)
X $(CC) $(CFLAGS) $(INCLUDES) -c insn-extract.c
X
Xinsn-extract.c: stamp-extract ;
Xstamp-extract : md genextract $(srcdir)/move-if-change
X ./genextract md > tmp-extract.c
X $(srcdir)/move-if-change tmp-extract.c insn-extract.c
X touch stamp-extract
X
Xinsn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) regs.h real.h
X $(CC) $(CFLAGS) $(INCLUDES) -c insn-peep.c
X
Xinsn-peep.c: stamp-peep ;
Xstamp-peep : md genpeep $(srcdir)/move-if-change
X ./genpeep md > tmp-peep.c
X $(srcdir)/move-if-change tmp-peep.c insn-peep.c
X touch stamp-peep
X
Xinsn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) regs.h real.h conditions.h \
X hard-reg-set.h insn-config.h insn-flags.h output.h aux-output.c
X $(CC) $(CFLAGS) $(INCLUDES) -c insn-output.c
X
Xinsn-output.c: stamp-output ;
Xstamp-output : md genoutput $(srcdir)/move-if-change
X ./genoutput md > tmp-output.c
X $(srcdir)/move-if-change tmp-output.c insn-output.c
X touch stamp-output
X
X# Now the programs that generate those files.
X# $(CONFIG_H) is omitted from the deps of the gen*.o
X# because these programs don't really depend on anything
X# about the target machine. They do depend on config.h itself,
X# since that describes the host machine.
X
Xgenconfig : genconfig.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genconfig genconfig.o rtl.o $(LIBS)
X
Xgenconfig.o : genconfig.c $(RTL_H) config.h
X
Xgenflags : genflags.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genflags genflags.o rtl.o $(LIBS)
X
Xgenflags.o : genflags.c $(RTL_H) config.h
X
Xgencodes : gencodes.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o gencodes gencodes.o rtl.o $(LIBS)
X
Xgencodes.o : gencodes.c $(RTL_H) config.h
X
Xgenemit : genemit.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genemit genemit.o rtl.o $(LIBS)
X
Xgenemit.o : genemit.c $(RTL_H) config.h
X
Xgenrecog : genrecog.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genrecog genrecog.o rtl.o $(LIBS)
X
Xgenrecog.o : genrecog.c $(RTL_H) config.h
X
Xgenextract : genextract.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genextract genextract.o rtl.o $(LIBS)
X
Xgenextract.o : genextract.c $(RTL_H) config.h
X
Xgenpeep : genpeep.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genpeep genpeep.o rtl.o $(LIBS)
X
Xgenpeep.o : genpeep.c $(RTL_H) config.h
X
Xgenoutput : genoutput.o rtl.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o genoutput genoutput.o rtl.o $(LIBS)
X
Xgenoutput.o : genoutput.c $(RTL_H) config.h
X
X# Making the preprocessor
Xcpp: cccp
X -rm -f cpp
X ln cccp cpp
Xcccp: cccp.o cexp.o version.o $(LIBDEPS)
X $(CC) $(CFLAGS) $(LDFLAGS) -o cccp cccp.o cexp.o version.o $(LIBS)
Xcexp.o: $(srcdir)/cexp.c $(CONFIG_H)
X $(CC) $(CFLAGS) $(CPPFLAGS) $(INCLUDES) -c $(srcdir)/cexp.c
X$(srcdir)/cexp.c: $(srcdir)/cexp.y
X $(BISON) -o $(srcdir)/cexp.c $(srcdir)/cexp.y
Xcccp.o: cccp.c $(CONFIG_H)
X $(CC) $(CFLAGS) $(INCLUDES) \
X -DGCC_INCLUDE_DIR=\"$(libdir)/gcc-include\" \
X -DGPLUSPLUS_INCLUDE_DIR=\"$(libdir)/g++-include\" \
X -c `echo $(srcdir)/cccp.c | sed 's,^\./,,'`
X
X$(srcdir)/cpp.info: $(srcdir)/cpp.texinfo
X makeinfo `echo $(srcdir)/cpp.texinfo | sed 's,^\./,,'`
X
X$(srcdir)/gplus.info: $(srcdir)/gplus.texinfo
X makeinfo `echo $(srcdir)/gplus.texinfo | sed 's,^\./,,'`
X
X$(srcdir)/gcc.info: $(srcdir)/gcc.texinfo
X makeinfo `echo $(srcdir)/gcc.texinfo | sed 's,^\./,,'`
X
X# gnulib is not deleted because deleting it would be inconvenient
X# for most uses of this target.
Xclean:
X -rm -f $(STAGESTUFF) $(STAGE_GCC)
X# Delete the temp files made in the course of building gnulib.
X -rm -f tmpgnulib
X for name in $(LIBFUNCS); do rm -f $${name}.c; done
X -rm -f stamp-*.[ch] tmp-*
X -rm -f *.s *.s[0-9] *.co *.greg *.lreg *.combine *.flow *.cse *.jump *.rtl *.tree *.loop *.dbr *.jump2
X -rm -f core float.h hard-params
X
X# Like clean but also delete the links made to configure gcc.
X# Also removes gnulib, since that is desirable if you are changing cpus.
Xcleanconfig: clean
X -rm -f tm.h aux-output.c config.h md config.status gnulib stamp-gnulib2
X
X# Get rid of every file that's generated from some other file (except INSTALL).
Xrealclean: cleanconfig
X -rm -f cpp.aux cpp.cps cpp.fns cpp.info cpp.kys cpp.pgs cpp.tps cpp.vrs
X# -rm -f cplus-parse.tab.c cplus-parse.output
X -rm -f c-parse.tab.c c-parse.output c-parse.tab.output
X -rm -f gnulib cexp.c TAGS
X -rm -f cpp.info* cpp.?? cpp.??s cpp.log cpp.toc cpp.*aux
X -rm -f gcc.info* gcc.?? gcc.??s gcc.log gcc.toc gcc.*aux
X -rm -f gplus.info* gplus.?? gplus.??s gplus.log gplus.toc gplus.*aux
X -rm -f *.dvi
X
X# Copy the files into directories where they will be run.
Xinstall: all $(USER_H) float.h gvarargs.h gstdarg.h gcc.1
X -mkdir $(libdir)
X -if [ -f cc1 ] ; then $(INSTALL) cc1 $(libdir)/gcc-cc1 ; else true; fi
X -if [ -f cc1plus ] ; then $(INSTALL) cc1plus $(libdir)/gcc-cc1plus ; else true; fi
X $(INSTALL) gnulib $(libdir)/gcc-gnulib
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then (cd $(libdir); $(RANLIB) gcc-gnulib) ; else true; fi
X $(INSTALL) cpp $(libdir)/gcc-cpp
X $(INSTALL) gcc $(bindir)
X -mkdir $(libdir)/gcc-include
X -chmod ugo+rx $(libdir)/gcc-include
X for file in $(USER_H); do \
X for eachfile in $(srcdir)/$${file} ; do \
X $(INSTALL) $(srcdir)/`basename $${eachfile}` $(libdir)/gcc-include/`basename $${eachfile}`; \
X done ; done
X $(INSTALL) float.h $(libdir)/gcc-include/float.h
X $(INSTALL) $(srcdir)/gvarargs.h $(libdir)/gcc-include/varargs.h
X $(INSTALL) $(srcdir)/gstdarg.h $(libdir)/gcc-include/stdarg.h
X -chmod a-x $(libdir)/gcc-include/*.h
X $(INSTALL) $(srcdir)/gcc.1 $(mandir)/gcc.$(manext)
X -chmod a-x $(mandir)/gcc.$(manext)
X# Make sure -lg won't get an error message from the linker:
X# create a library libg.a if there isn't one.
X -if [ -f /lib/libg.a -o -f /usr/lib/libg.a ]; then \
X : ; \
X else \
X echo Installing a dummy libg.a into /usr/lib; \
X echo "_no_libg(){}" > _no_libg.c; \
X ./gcc -B./ -c _no_libg.c; \
X $(AR) rc libg.a _no_libg.o; \
X $(INSTALL) libg.a /usr/lib/libg.a; \
X if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then (cd /usr/lib; $(RANLIB) libg.a) ; else true; fi; \
X rm -f _no_libg.[co] libg.a; \
X fi
X
X# do make -f ../gcc/Makefile maketest DIR=../gcc
X# in the intended test directory to make it a suitable test directory.
Xmaketest:
X ln -s $(DIR)/*.[chy] .
X ln -s $(DIR)/config .
X ln -s $(DIR)/*.def .
X -rm -f =*
X ln -s $(DIR)/.gdbinit .
X -ln -s $(DIR)/bison.simple .
X ln -s $(DIR)/config.gcc .
X ln -s $(DIR)/move-if-change .
X# The then and else were swapped to avoid a problem on Ultrix.
X if [ ! -f Makefile ] ; then ln -s $(DIR)/Makefile . ; else false; fi
X -rm tm.h aux-output.c config.h md
X make clean
X# You must then run config.gcc to set up for compilation.
X
Xbootstrap: all force
X $(MAKE) stage1
X $(MAKE) CC="stage1/gcc -Bstage1/" CFLAGS="-O $(CFLAGS)" libdir=$(libdir)
X $(MAKE) stage2
X $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="-O $(CFLAGS)" libdir=$(libdir)
X
Xbootstrap2: force
X $(MAKE) CC="stage1/gcc -Bstage1/" CFLAGS="-O $(CFLAGS)" libdir=$(libdir)
X $(MAKE) stage2
X $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="-O $(CFLAGS)" libdir=$(libdir)
X
Xbootstrap3: force
X $(MAKE) CC="stage2/gcc -Bstage2/" CFLAGS="-O $(CFLAGS)" libdir=$(libdir)
X
X# Copy the object files from a particular stage into a subdirectory.
Xstage1: force
X -mkdir stage1
X -mv $(STAGESTUFF) $(STAGE_GCC) stage1
X -rm -f stage1/gnulib
X -ln gnulib stage1 || cp gnulib stage1
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then $(RANLIB) stage1/gnulib; else true; fi
X
Xstage2: force
X -mkdir stage2
X -mv $(STAGESTUFF) $(STAGE_GCC) stage2
X -rm -f stage2/gnulib
X -ln gnulib stage2 || cp gnulib stage2
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then $(RANLIB) stage2/gnulib; else true; fi
X
Xstage3: force
X -mkdir stage3
X -mv $(STAGESTUFF) $(STAGE_GCC) stage3
X -rm -f stage3/gnulib
X -ln gnulib stage3 || cp gnulib stage3
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then $(RANLIB) stage3/gnulib; else true; fi
X
Xstage4: force
X -mkdir stage4
X -mv $(STAGESTUFF) $(STAGE_GCC) stage4
X -rm -f stage4/gnulib
X -ln gnulib stage4 || cp gnulib stage4
X -if [ -f /usr/bin/ranlib -o -f /bin/ranlib ] ; then $(RANLIB) stage4/gnulib; else true; fi
X
XTAGS: force
X mkdir temp
X -mv c-parse.tab.c cplus-parse.c cplus-parse.h cexp.c temp
X etags *.y *.h *.c
X mv temp/* .
X rmdir temp
X
Xincludes: force
X export LIB; LIB=$(libdir)/gcc-include ./fixincludes
X
X#In GNU Make, ignore whether `stage*' exists.
X.PHONY: stage1 stage2 stage3 stage4 clean realclean TAGS bootstrap
X
Xforce:
END_OF_FILE
if test 28005 -ne `wc -c <'Makefile-sco'`; then
echo shar: \"'Makefile-sco'\" unpacked with wrong size!
fi
# end of 'Makefile-sco'
fi
if test -f 'pragma.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'pragma.c'\"
else
echo shar: Extracting \"'pragma.c'\" \(311 characters\)
sed "s/^X//" >'pragma.c' <<'END_OF_FILE'
X#define DEFAULT_ALIGN 32
X
Xstatic int pack_align = DEFAULT_ALIGN;
Xstatic int was_pragma = 0;
X
Xpragma_pack(val)
Xint val;
X{
X pack_align = 8 * val;
X was_pragma = 1;
X}
X
Xpragma_align_val()
X{
X return pack_align;
X}
X
Xpragma_pack_default()
X{
X pack_align = DEFAULT_ALIGN;
X}
X
Xint pragma_pack_seen()
X{
X return was_pragma;
X}
END_OF_FILE
if test 311 -ne `wc -c <'pragma.c'`; then
echo shar: \"'pragma.c'\" unpacked with wrong size!
fi
# end of 'pragma.c'
fi
if test -f 'packtest.c' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'packtest.c'\"
else
echo shar: Extracting \"'packtest.c'\" \(2439 characters\)
sed "s/^X//" >'packtest.c' <<'END_OF_FILE'
Xstatic char *rcsid = "@(#)$Header: /pdsrc/Local/RCS/packtest.c,v 1.1 90/04/26 17:50:35 root Exp $";
X
X/*
X * Regression test to check that gcc's #pragma pack() support does the
X * same thing as Microsoft C's.
X *
X * Run with this command from sh, not csh, since SCO's csh is BROKEN.
X * cc packtest.c && ./a.out > m && gcc packtest.c && ./a.out > g && diff m g
X * You should not see any output.
X *
X * $Log: packtest.c,v $
X * Revision 1.1 90/04/26 17:50:35 root
X * Initial revision
X *
X */
X
X#pragma pack(4)
Xstruct s1 {
X char one;
X int two;
X long three;
X double four;
X} s1;
X#pragma pack(2)
Xstruct s2 {
X char one;
X int two;
X long three;
X double four;
X} s2;
X#pragma pack(1)
Xstruct s3 {
X char one;
X int two;
X long three;
X double four;
X} s3;
X#pragma pack()
Xstruct s4 {
X char one;
X int two;
X long three;
X double four;
X} s4;
Xstruct biggie {
X struct s3 x1;
X struct s1 b1;
X struct s3 x2;
X struct s2 b2;
X struct s3 x3;
X struct s3 b3;
X struct s3 x4;
X struct s4 b4;
X} b;
X#define offsetof(TYPE, MEMBER) ((unsigned) &((TYPE *)0)->MEMBER)
Xmain()
X{
X printf("% 4d% 4d% 4d\n",
X offsetof(struct s1, two),
X offsetof(struct s1, three),
X offsetof(struct s1, four));
X printf("% 4d% 4d% 4d\n",
X offsetof(struct s2, two),
X offsetof(struct s2, three),
X offsetof(struct s2, four));
X printf("% 4d% 4d% 4d\n",
X offsetof(struct s3, two),
X offsetof(struct s3, three),
X offsetof(struct s3, four));
X printf("% 4d% 4d% 4d\n",
X offsetof(struct s4, two),
X offsetof(struct s4, three),
X offsetof(struct s4, four));
X printf("\n% 4d% 4d% 4d\n",
X ((char *)&b.b1.two) - ((char *)&b.b1.one),
X ((char *)&b.b1.three) - ((char *)&b.b1.one),
X ((char *)&b.b1.four) - ((char *)&b.b1.one));
X printf("% 4d% 4d% 4d\n",
X ((char *)&b.b2.two) - ((char *)&b.b2.one),
X ((char *)&b.b2.three) - ((char *)&b.b2.one),
X ((char *)&b.b2.four) - ((char *)&b.b2.one));
X printf("% 4d% 4d% 4d\n",
X ((char *)&b.b3.two) - ((char *)&b.b3.one),
X ((char *)&b.b3.three) - ((char *)&b.b3.one),
X ((char *)&b.b3.four) - ((char *)&b.b3.one));
X printf("% 4d% 4d% 4d\n\n",
X ((char *)&b.b4.two) - ((char *)&b.b4.one),
X ((char *)&b.b4.three) - ((char *)&b.b4.one),
X ((char *)&b.b4.four) - ((char *)&b.b4.one));
X printf(" % 4d% 4d\n", sizeof b.b1, (char *)&b.b1 - (char *)&b);
X printf(" % 4d% 4d\n", sizeof b.b2, (char *)&b.b2 - (char *)&b);
X printf(" % 4d% 4d\n", sizeof b.b3, (char *)&b.b3 - (char *)&b);
X printf(" % 4d% 4d\n", sizeof b.b4, (char *)&b.b4 - (char *)&b);
X exit(0);
X}
END_OF_FILE
if test 2439 -ne `wc -c <'packtest.c'`; then
echo shar: \"'packtest.c'\" unpacked with wrong size!
fi
# end of 'packtest.c'
fi
echo shar: End of shell archive.
exit 0
More information about the Comp.unix.sysv386
mailing list