remove driver and cpp

This commit is contained in:
YamaArashi 2016-04-25 02:51:34 -07:00
parent fa618cd10b
commit 346ed7678f
82 changed files with 713 additions and 79882 deletions

View File

@ -1,95 +0,0 @@
Makefile
SYSCALLS.c.X
bc-arity.h
bc-opcode.h
bc-opname.h
bi-arity
bi-opcode
bi-opname
bi-parser.c
bi-parser.h
c++
c-parse.c
c-parse.h
c-parse.output
c-parse.y
cc1
cc1chill
cc1obj
cc1plus
cccp
cexp.c
cexp.output
chill
chill.ignore
chill.info
chill.install
chill.log
chill.plog
chill.psum
chill.sum
collect2
config.status
cpp
dbg.log
deduced.h
fix-header
fixhdr.ready
fixinc.ready
fixproto.list
fixtmp.?
g++
g++-cross
g++.sum
gcc
gcc-cross
gcc.sum
gcov
gen-protos
genattr
genattrtab
gencodes
genconfig
genemit
genextract
genflags
genopinit
genoutput
genpeep
genrecog
genrtl
genrtl.h
genrtl.c
gfloat.h
insn-attr.h
insn-attrtab.c
insn-codes.h
insn-config.h
insn-emit.c
insn-extract.c
insn-flags.h
insn-opinit.c
insn-output.c
insn-peep.c
insn-recog.c
ld
libgcc2.ready
multilib.h
objc-headers
objc-parse.c
objc-parse.output
objc-parse.y
patch-header
protoize
protoize.1
scan-decls
site.exp
specs
stamp-*
stmp-*
unprotoize
unprotoize.1
xgcc
xlimits.h
xsys-protos.h
y.tab.c

File diff suppressed because it is too large Load Diff

View File

@ -1,91 +0,0 @@
Right now there is no documentation for the GCC tree -> rtl interfaces
(or more generally the interfaces for adding new languages).
Such documentation would be of great benefit to the project. Until such
time as we can formally start documenting the interface this file will
serve as a repository for information on these interface and any incompatable
changes we've made.
Aug 31, 1998:
The interface to HANDLE_PRAGMA has changed. It now takes three arguments.
The first two are pointers to functions that should be used to read characters
from the input stream, and to push them back into the input stream respectively.
The third argument is a pointer to a null terminate string which is the first
word after #pragma. The expression supplied by HANDLE_PRAGMA should return
non-zero if it parsed and implemented the pragma. Otherwise it should return
zero, and leave the input stream as it was before the expression was evaluated.
A new back-end definable macro has been added: INSERT_ATTRIBUTES. This macro
allows backend to add attributes to decls as they are created.
Jun 10, 1998:
The interface to lang_decode_option has changed. It now uses and argc/argv
interface to allow for options that use more than one input string. The new
declaration is: int lang_decode_option (int argc, char** argv). It now
returns the number of input strings processed, or 0 if the option is
unknown.
Jun 7, 1998:
Front-ends must now define lang_init_options. It is safe for this
function to do nothing. See c-lang.c.
Apr 21, 1998:
Front ends which link with c-common or other files from the C/C++
front-ends may need to handle TI types. Look for references to
[unsigned]int_DI_type_node in your front end. If you have references
to these variables, you'll need up update the front end.
To update the front end you must mirror all the code which currently
deals with intDI_type_node to also handle intTI_type_node.
Apr 7, 1998:
The interface between toplev.c and the language front ends for opening the
source file has changed:
o init_lex() has been renamed to init_parse (char *filename) where filename
is the name of the source file.
o The code in toplev.c which opened the source file should be moved to
the new init_parse function.
o toplev.c now calls finish_parse() instead of closing the source file
using fclose(). This should now be done in finish_parse, if necessary.
Apr 1, 1998:
Front-ends must now define lang_print_xnode. It is safe for this
function to do nothing. See c-lang.c.
Feb 1, 1998:
GCC used to store structure sizes & offsets to elements as bitsize
quantities. This causes problems because a structure can only be
(target memsize / 8) bytes long (this may effect arrays too). This
is particularly problematical on machines with small address spaces.
So:
All trees that represent sizes in bits should have a TREE_TYPE of
bitsizetype (rather than sizetype).
Accordingly, when such values are computed / initialized, care has to
be takes to use / compute the proper type.
When a size in bits is converted into a size in bytes, which is expressed
in trees, care should be taken to change the tree's type again to sizetype.
We've updated C, C++, Fortran & Objective-C to work with the new
scheme. Other languages will need to be updated accordingly.
Contact amylaar@cygnus.com for additional information.
?? 1997:
In an effort to decrease cache thrashing and useless loads we've changed the
third argument to the DEFTREECODE macro to be a single char. This will
effect languages that defined their own tree codes (usually in a .def file).
Old way:
DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", "d", 0)
New way:
DEFTREECODE (CLASS_METHOD_DECL, "class_method_decl", 'd', 0)

View File

@ -1,101 +0,0 @@
Collected papers/sites on standards, compilers, optimization, etc.
- Massively Scalar Compiler Project
ftp://cs.rice.edu/public/preston/optimizer
- Searchable article archive
http://hypatia.dcs.qmw.ac.uk/SEL-HPC/Articles/CompilersArchive.html
- David M Keaton's site
http://www.dmk.com, ftp://ftp.dmk.com
c9x stuff is in ftp://ftp.dmk.com/DMK/sc22wg14/c9x
- Some information about optimizing for x86 processors, links to
x86 manuals and documentation.
http://www.goof.com/pcg/docs.html
http://www.announce.com/agner/assem/
- AMD site with optimization guide for x86
http://www.amd.com/K6/k6docs/pdf/21828a.pdf
- Links related to many compiler topics
http://www.nullstone.com/htmls/connections.htm
- HPPA information:
http://www.hp.com/computing/framed/technology/micropro
- New compiler book. Online appendix includes some compiler links
http://www.mkp.com/books_catalog/1-55860-320-4.asp
- Various MIPS stuff:
http://www.sgi.com/MIPS/arch/mips4docs/mipsiv_3_2.pdf (*)
http://www.sgi.com/MIPS/arch/MIPS16/MIPS16.whitepaper.pdf
http://www.sgi.com/MIPS/arch/MIPS16/mips16.pdf
http://www.sgi.com/MIPS/arch/ISA5/isa5_tech_brf.pdf
http://www.sgi.com/MIPS/arch/ISA5/MDMXspec.pdf
http://www.sgi.com/MIPS/arch/ISA5/MIPSVspec.pdf
- IBM Journal of Research and Development
http://www.almaden.ibm.com/journal/
- System V PowerPC ABI
http://www.esofta.com/softspecs.html
- C9X draft
http://www.dkuug.dk/JTC1/SC22/WG14/www/docs/n794.htm
- DWARF v2 spec and sample implementation
ftp://sgigate.sgi.com/pub/dwarf/
- Various m68k info (including user guides in pdf format)
http://www.mot.com/SPS/HPESD/prod/0X0
- Modula 3 Stuff
http://www.cmass.com
http://www.cl.cam.ac.uk/m3doc/linux/cambridge.html
ftp://ftp.freebsd.org/pub/FreeBSD/distfiles/LOCAL_PORTS/m3-fbsd-m3cc-3.6.tar.gz
http://www.m3.org
- Comp.compilers archive
http://www.iecc.com/compilers
- Intel Pentium design info:
http://developer.intel.com/design/litcentr/index.htm
- comp.std.c++ FAQ:
http://reality.sgi.com/employees/austern_mti/std-c++/faq.html
- EG3 maintains a list of compiler Internet resources, including FAQ's,
papers, hot list pages, potential software/shareware, all known companies, etc.
http://www.eg3.com/ulc/compulc.htm
http://www.eg3.com/softd/compiler.htm
http://www.eg3.com/softdv/compiler.htm
These resource pages are published as part of EG3's
Free Electronic Engineers' Toolbox at:
http://www.eg3.com/ebox.htm

484
gcc/Makefile Normal file
View File

@ -0,0 +1,484 @@
# Makefile for GNU C compiler.
# Copyright (C) 1987, 88, 90-98, 1999 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston MA 02111-1307, USA.
# Directory where sources are, from where we are.
srcdir = .
VPATH = $(srcdir)
CFLAGS = -g
CC = gcc
out_file=$(srcdir)/config/arm/thumb.c
out_object_file=thumb.o
md_file=$(srcdir)/config/arm/thumb.md
# End of variables for you to override.
# This tells GNU Make version 3 not to put all variables in the environment.
.NOEXPORT:
HOST_RTL = rtl.o bitmap.o
HOST_RTLANAL = rtlanal.o
HOST_PRINT = print-rtl.o
# Specify the directories to be searched for header files.
# Both . and srcdir are used, in that order,
# so that tm.h and config.h will be found in the compilation
# subdirectory rather than in the source directory.
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/config -I$(srcdir)/../include
# Always use -I$(srcdir)/config when compiling.
.c.o:
$(CC) -c $(CFLAGS) $(INCLUDES) $<
# This tells GNU make version 3 not to export all the variables
# defined in this file into the environment.
.NOEXPORT:
# Lists of files for various purposes.
OBJS = toplev.o version.o tree.o print-tree.o stor-layout.o fold-const.o \
function.o stmt.o except.o expr.o calls.o expmed.o explow.o optabs.o \
varasm.o rtl.o print-rtl.o rtlanal.o emit-rtl.o genrtl.o real.o regmove.o \
dwarf2out.o bitmap.o alias.o \
integrate.o jump.o cse.o loop.o unroll.o flow.o stupid.o combine.o varray.o \
regclass.o local-alloc.o global.o reload.o reload1.o caller-save.o gcse.o \
insn-peep.o final.o recog.o \
insn-opinit.o insn-recog.o insn-extract.o insn-output.o insn-emit.o \
lcm.o \
insn-attrtab.o $(out_object_file) getpwd.o convert.o \
dyn-string.o splay-tree.o graph.o sbitmap.o resource.o \
c-parse.o c-lex.o c-decl.o c-typeck.o c-convert.o c-aux-info.o c-common.o \
c-iterate.o obstack.o
GEN = genemit genoutput genrecog genextract genflags gencodes genconfig \
genpeep gengenrtl gencheck genattr
# The files that "belong" in CONFIG_H are deliberately omitted
# because having them there would not be useful in actual practice.
# All they would do is cause complete recompilation every time
# one of the machine description files is edited.
# That may or may not be what one wants to do.
# If it is, rm *.o is an easy way to do it.
# CONFIG_H = $(host_xm_file) $(tm_file)
CONFIG_H =
RTL_BASE_H = rtl.h rtl.def machmode.h machmode.def
RTL_H = $(RTL_BASE_H) genrtl.h
TREE_H = tree.h real.h tree.def machmode.h machmode.def tree-check.h
BASIC_BLOCK_H = basic-block.h bitmap.h sbitmap.h
RECOG_H = recog.h
EXPR_H = expr.h insn-codes.h
REGS_H = regs.h varray.h machmode.h machmode.def
# The only suffixes we want for implicit rules are .c and .o, so clear
# the list and add them. This speeds up GNU Make, and allows -r to work.
.SUFFIXES:
.SUFFIXES: .c .o
.PHONY: clean
agbcc: $(OBJS)
$(CC) $(CFLAGS) -o $@ $(OBJS)
clean:
$(RM) $(GEN) $(OBJS)
# Compiling object files from source files.
# C language specific files.
# CYGNUS LOCAL: built in build directory
c-parse.o : $(srcdir)/c-parse.c $(CONFIG_H) $(TREE_H) c-lex.h c-parse.h \
c-tree.h input.h flags.h system.h toplev.h
$(CC) $(CFLAGS) $(INCLUDES) -c $(srcdir)/c-parse.c
# CYGNUS LOCAL: c-gperf.h really depends on c-parse.gperf.
$(srcdir)/c-gperf.h:
gperf -L KR-C -F ', 0, 0' -p -j1 -i 1 -g -o -t -G -N is_reserved_word \
-k1,3,$$ $(srcdir)/c-parse.gperf >tmp-gperf.h
$(srcdir)/move-if-change tmp-gperf.h $(srcdir)/c-gperf.h
c-decl.o : c-decl.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h flags.h \
output.h toplev.h
c-typeck.o : c-typeck.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h \
output.h $(EXPR_H) $(RTL_H) toplev.h
# CYGNUS LOCAL: built in build directory
c-lex.o : c-lex.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-lex.h c-tree.h \
c-parse.h input.h flags.h c-gperf.h toplev.h output.h
c-aux-info.o : c-aux-info.c $(CONFIG_H) system.h $(TREE_H) c-tree.h flags.h
c-convert.o : c-convert.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h
c-iterate.o: c-iterate.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) c-tree.h \
flags.h toplev.h $(EXPR_H)
graph.o: graph.c $(CONFIG_H) system.h toplev.h flags.h output.h $(RTL_H) \
hard-reg-set.h $(BASIC_BLOCK_H)
sbitmap.o: sbitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H)
hash.o: hash.c hash.h system.h toplev.h
splay-tree.o: splay-tree.c splay-tree.h
# A file used by all variants of C.
c-common.o : c-common.c $(CONFIG_H) system.h $(TREE_H) c-tree.h c-lex.h \
flags.h toplev.h output.h $(RTL_H)
# Language-independent files.
tree-check.h: s-check
s-check : gencheck $(srcdir)/move-if-change
./gencheck > tmp-check.h
$(srcdir)/move-if-change tmp-check.h tree-check.h
touch s-check
gencheck : gencheck.o tree.def $(lang_tree_files)
$(CC) $(CFLAGS) -o $@ \
gencheck.o
gencheck.o : gencheck.c config.h system.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(srcdir)/gencheck.c
dumpvers: dumpvers.c
version.o: version.c
obstack.o: obstack.c $(CONFIG_H)
convert.o: convert.c $(CONFIG_H) $(TREE_H) flags.h convert.h toplev.h
tree.o : tree.c $(CONFIG_H) system.h $(TREE_H) flags.h function.h toplev.h except.h
print-tree.o : print-tree.c $(CONFIG_H) system.h $(TREE_H)
stor-layout.o : stor-layout.c $(CONFIG_H) system.h $(TREE_H) flags.h \
function.h $(EXPR_H) $(RTL_H) toplev.h except.h
fold-const.o : fold-const.c $(CONFIG_H) system.h $(TREE_H) flags.h toplev.h \
$(RTL_H)
toplev.o : toplev.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) \
flags.h input.h insn-attr.h defaults.h output.h \
insn-codes.h insn-config.h $(RECOG_H) Makefile toplev.h \
dwarf2out.h $(EXPR_H)
rtl.o : rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
print-rtl.o : print-rtl.c $(CONFIG_H) system.h $(RTL_H) bitmap.h
rtlanal.o : rtlanal.c $(CONFIG_H) system.h $(RTL_H)
varasm.o : varasm.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) flags.h \
function.h defaults.h $(EXPR_H) hard-reg-set.h $(REGS_H) \
output.h toplev.h except.h
function.o : function.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h insn-codes.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h toplev.h except.h
stmt.o : stmt.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
insn-flags.h insn-config.h insn-codes.h hard-reg-set.h $(EXPR_H) except.h \
loop.h $(RECOG_H) toplev.h output.h varray.h
except.o : except.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
function.h insn-flags.h $(EXPR_H) $(REGS_H) hard-reg-set.h \
insn-config.h $(RECOG_H) output.h except.h toplev.h
expr.o : expr.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h function.h \
$(REGS_H) insn-flags.h insn-codes.h $(EXPR_H) insn-config.h $(RECOG_H) output.h \
typeclass.h hard-reg-set.h toplev.h hard-reg-set.h except.h
calls.o : calls.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(EXPR_H) \
insn-flags.h $(REGS_H) toplev.h output.h
expmed.o : expmed.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) real.h
explow.o : explow.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
hard-reg-set.h insn-config.h $(EXPR_H) $(RECOG_H) insn-flags.h insn-codes.h
optabs.o : optabs.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
insn-flags.h insn-config.h insn-codes.h $(EXPR_H) $(RECOG_H) reload.h
dwarf2out.o : dwarf2out.c $(CONFIG_H) system.h $(TREE_H) $(RTL_H) dwarf2.h \
flags.h insn-config.h reload.h output.h defaults.h \
hard-reg-set.h $(REGS_H) $(EXPR_H) toplev.h dwarf2out.h dyn-string.h
emit-rtl.o : emit-rtl.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
except.h function.h $(REGS_H) insn-config.h $(RECOG_H) real.h \
$(EXPR_H) obstack.h hard-reg-set.h bitmap.h
real.o : real.c $(CONFIG_H) system.h $(TREE_H) toplev.h
getpwd.o : getpwd.c $(CONFIG_H) system.h
integrate.o : integrate.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h \
integrate.h insn-flags.h insn-config.h $(EXPR_H) real.h $(REGS_H) \
function.h output.h $(RECOG_H) except.h toplev.h
jump.o : jump.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h $(REGS_H) \
insn-config.h insn-flags.h $(RECOG_H) $(EXPR_H) real.h except.h \
toplev.h
stupid.o : stupid.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h \
$(BASIC_BLOCK_H) insn-config.h reload.h flags.h toplev.h
cse.o : cse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) toplev.h output.h
gcse.o : gcse.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H) output.h
resource.o : resource.c $(CONFIG_H) $(RTL_H) hard-reg-set.h system.h \
$(BASIC_BLOCK_H) $(REGS_H) flags.h output.h resource.h
lcm.o : lcm.c $(CONFIG_H) system.h $(RTL_H) $(REGS_H) hard-reg-set.h flags.h \
real.h insn-config.h $(RECOG_H) $(EXPR_H) $(BASIC_BLOCK_H)
loop.o : loop.c $(CONFIG_H) system.h $(RTL_H) flags.h loop.h insn-config.h \
insn-flags.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) real.h \
toplev.h varray.h
unroll.o : unroll.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
integrate.h $(REGS_H) $(RECOG_H) flags.h $(EXPR_H) loop.h toplev.h varray.h
flow.o : flow.c $(CONFIG_H) system.h $(RTL_H) flags.h insn-config.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h output.h toplev.h recog.h
combine.o : combine.c $(CONFIG_H) system.h $(RTL_H) flags.h \
insn-config.h insn-flags.h insn-codes.h insn-attr.h $(REGS_H) $(EXPR_H) \
$(BASIC_BLOCK_H) $(RECOG_H) real.h hard-reg-set.h toplev.h
regclass.o : regclass.c $(CONFIG_H) system.h $(RTL_H) hard-reg-set.h flags.h \
$(BASIC_BLOCK_H) $(REGS_H) insn-config.h $(RECOG_H) reload.h real.h toplev.h \
output.h
local-alloc.o : local-alloc.c $(CONFIG_H) system.h $(RTL_H) flags.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h $(RECOG_H) output.h \
insn-attr.h toplev.h
bitmap.o : bitmap.c $(CONFIG_H) system.h $(RTL_H) flags.h $(BASIC_BLOCK_H) \
$(REGS_H)
global.o : global.c $(CONFIG_H) system.h $(RTL_H) flags.h reload.h \
$(BASIC_BLOCK_H) $(REGS_H) hard-reg-set.h insn-config.h output.h toplev.h
varray.o : varray.c $(CONFIG_H) system.h varray.h $(RTL_H) $(TREE_H) bitmap.h
reload.o : reload.c $(CONFIG_H) system.h $(RTL_H) flags.h output.h $(EXPR_H) \
reload.h $(RECOG_H) hard-reg-set.h insn-config.h insn-codes.h $(REGS_H) \
real.h toplev.h
reload1.o : reload1.c $(CONFIG_H) system.h $(RTL_H) real.h flags.h $(EXPR_H) \
reload.h $(REGS_H) hard-reg-set.h insn-config.h insn-flags.h insn-codes.h \
$(BASIC_BLOCK_H) $(RECOG_H) output.h toplev.h
caller-save.o : caller-save.c $(CONFIG_H) system.h $(RTL_H) flags.h \
$(REGS_H) hard-reg-set.h insn-config.h $(BASIC_BLOCK_H) \
$(RECOG_H) reload.h $(EXPR_H) toplev.h
alias.o : alias.c $(CONFIG_H) system.h $(RTL_H) flags.h hard-reg-set.h \
$(REGS_H) toplev.h output.h $(EXPR_H)
regmove.o : regmove.c $(CONFIG_H) system.h $(RTL_H) insn-config.h \
$(RECOG_H) output.h reload.h $(REGS_H) hard-reg-set.h flags.h \
$(EXPR_H) insn-flags.h $(BASIC_BLOCK_H) toplev.h
final.o : final.c $(CONFIG_H) system.h $(RTL_H) $(TREE_H) flags.h $(REGS_H) \
$(RECOG_H) conditions.h insn-config.h insn-attr.h except.h real.h output.h \
hard-reg-set.h insn-flags.h insn-codes.h defaults.h \
toplev.h reload.h dwarf2out.h
recog.o : recog.c $(CONFIG_H) system.h $(RTL_H) \
$(REGS_H) $(RECOG_H) hard-reg-set.h flags.h insn-config.h insn-attr.h \
insn-flags.h insn-codes.h real.h toplev.h
dyn-string.o: dyn-string.c dyn-string.h $(CONFIG_H) system.h
$(out_object_file): $(out_file) $(CONFIG_H) $(TREE_H) \
$(RTL_H) $(REGS_H) hard-reg-set.h real.h insn-config.h conditions.h \
insn-flags.h output.h insn-attr.h insn-codes.h system.h toplev.h
$(CC) -c $(CFLAGS) $(INCLUDES) $(out_file)
# Generate header and source files from the machine description,
# and compile them.
.PRECIOUS: insn-config.h insn-flags.h insn-codes.h \
insn-emit.c insn-recog.c insn-extract.c insn-output.c insn-peep.c \
insn-attr.h insn-attrtab.c
# The following pair of rules has this effect:
# genconfig is run only if the md has changed since genconfig was last run;
# but the file insn-config.h is touched only when its contents actually change.
# Each of the other insn-* files is handled by a similar pair of rules.
# This causes an anomaly in the results of make -n
# because insn-* is older than s-*
# and thus make -n thinks that insn-* will be updated
# and force recompilation of things that depend on it.
# We use move-if-change precisely to avoid such recompilation.
# But there is no way to teach make -n that it will be avoided.
insn-config.h: s-config
s-config : $(md_file) genconfig $(srcdir)/move-if-change
./genconfig $(md_file) > tmp-config.h
$(srcdir)/move-if-change tmp-config.h insn-config.h
touch s-config
insn-flags.h: s-flags
s-flags : $(md_file) genflags $(srcdir)/move-if-change
./genflags $(md_file) > tmp-flags.h
$(srcdir)/move-if-change tmp-flags.h insn-flags.h
touch s-flags
insn-codes.h: s-codes
s-codes : $(md_file) gencodes $(srcdir)/move-if-change
./gencodes $(md_file) > tmp-codes.h
$(srcdir)/move-if-change tmp-codes.h insn-codes.h
touch s-codes
insn-emit.o : insn-emit.c $(CONFIG_H) $(RTL_H) $(EXPR_H) real.h output.h \
insn-config.h insn-flags.h insn-codes.h system.h reload.h recog.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-emit.c
insn-emit.c: s-emit
s-emit : $(md_file) genemit $(srcdir)/move-if-change
./genemit $(md_file) > tmp-emit.c
$(srcdir)/move-if-change tmp-emit.c insn-emit.c
touch s-emit
insn-recog.o : insn-recog.c $(CONFIG_H) $(RTL_H) insn-config.h $(RECOG_H) \
real.h output.h flags.h system.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-recog.c
insn-recog.c: s-recog
s-recog : $(md_file) genrecog $(srcdir)/move-if-change
./genrecog $(md_file) > tmp-recog.c
$(srcdir)/move-if-change tmp-recog.c insn-recog.c
touch s-recog
insn-opinit.o : insn-opinit.c $(CONFIG_H) $(RTL_H) insn-codes.h insn-flags.h \
insn-config.h flags.h $(RECOG_H) $(EXPR_H) reload.h system.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-opinit.c
insn-opinit.c: s-opinit
s-opinit : $(md_file) genopinit $(srcdir)/move-if-change
./genopinit $(md_file) > tmp-opinit.c
$(srcdir)/move-if-change tmp-opinit.c insn-opinit.c
touch s-opinit
insn-extract.o : insn-extract.c $(CONFIG_H) $(RTL_H) system.h toplev.h \
insn-config.h recog.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-extract.c
insn-extract.c: s-extract
s-extract : $(md_file) genextract $(srcdir)/move-if-change
./genextract $(md_file) > tmp-extract.c
$(srcdir)/move-if-change tmp-extract.c insn-extract.c
touch s-extract
insn-peep.o : insn-peep.c $(CONFIG_H) $(RTL_H) $(REGS_H) output.h real.h \
system.h insn-config.h recog.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-peep.c
insn-peep.c: s-peep
s-peep : $(md_file) genpeep $(srcdir)/move-if-change
./genpeep $(md_file) > tmp-peep.c
$(srcdir)/move-if-change tmp-peep.c insn-peep.c
touch s-peep
insn-attrtab.o : insn-attrtab.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h \
output.h insn-attr.h insn-config.h system.h toplev.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-attrtab.c
insn-attr.h: s-attr
s-attr : $(md_file) genattr $(srcdir)/move-if-change
./genattr $(md_file) > tmp-attr.h
$(srcdir)/move-if-change tmp-attr.h insn-attr.h
touch s-attr
insn-attrtab.c: s-attrtab
s-attrtab : $(md_file) genattrtab $(srcdir)/move-if-change
./genattrtab $(md_file) > tmp-attrtab.c;
$(srcdir)/move-if-change tmp-attrtab.c insn-attrtab.c
touch s-attrtab
insn-output.o : insn-output.c $(CONFIG_H) $(RTL_H) $(REGS_H) real.h conditions.h \
hard-reg-set.h insn-config.h insn-flags.h insn-attr.h output.h $(RECOG_H) \
insn-codes.h system.h
$(CC) $(CFLAGS) $(INCLUDES) -c insn-output.c
insn-output.c: s-output
s-output : $(md_file) genoutput $(srcdir)/move-if-change
./genoutput $(md_file) > tmp-output.c
$(srcdir)/move-if-change tmp-output.c insn-output.c
touch s-output
genrtl.o : genrtl.c $(CONFIG_H) $(RTL_H) system.h
genrtl.c genrtl.h : s-genrtl
@true # force gnu make to recheck modification times.
s-genrtl: gengenrtl $(srcdir)/move-if-change $(RTL_BASE_H)
./gengenrtl tmp-genrtl.h tmp-genrtl.c
$(srcdir)/move-if-change tmp-genrtl.h genrtl.h
$(srcdir)/move-if-change tmp-genrtl.c genrtl.c
touch s-genrtl
# Compile the programs that generate insn-* from the machine description.
# $(CONFIG_H) is omitted from the deps of the gen*.o
# because these programs don't really depend on anything
# about the target machine. They do depend on config.h itself,
# since that describes the host machine.
genconfig : genconfig.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genconfig.o $(HOST_RTL) $(HOST_PRINT)
genconfig.o : genconfig.c $(RTL_H) config.h system.h
genflags : genflags.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genflags.o $(HOST_RTL) $(HOST_PRINT)
genflags.o : genflags.c $(RTL_H) config.h system.h
gencodes : gencodes.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
gencodes.o $(HOST_RTL) $(HOST_PRINT)
gencodes.o : gencodes.c $(RTL_H) config.h system.h
genemit : genemit.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genemit.o $(HOST_RTL) $(HOST_PRINT)
genemit.o : genemit.c $(RTL_H) config.h system.h
genopinit : genopinit.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genopinit.o $(HOST_RTL) $(HOST_PRINT)
genopinit.o : genopinit.c $(RTL_H) config.h system.h
genrecog : genrecog.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genrecog.o $(HOST_RTL) $(HOST_PRINT)
genrecog.o : genrecog.c $(RTL_H) config.h system.h
genextract : genextract.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genextract.o $(HOST_RTL) $(HOST_PRINT)
genextract.o : genextract.c $(RTL_H) config.h system.h insn-config.h
genpeep : genpeep.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genpeep.o $(HOST_RTL) $(HOST_PRINT)
genpeep.o : genpeep.c $(RTL_H) config.h system.h
genattr : genattr.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genattr.o $(HOST_RTL) $(HOST_PRINT)
genattr.o : genattr.c $(RTL_H) config.h system.h
genattrtab : genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL)
$(CC) $(CFLAGS) -o $@ \
genattrtab.o $(HOST_RTL) $(HOST_PRINT) $(HOST_RTLANAL)
genattrtab.o : genattrtab.c $(RTL_H) config.h system.h insn-config.h
genoutput : genoutput.o $(HOST_RTL) $(HOST_PRINT)
$(CC) $(CFLAGS) -o $@ \
genoutput.o $(HOST_RTL) $(HOST_PRINT)
genoutput.o : genoutput.c $(RTL_H) config.h system.h
gengenrtl : gengenrtl.o
$(CC) $(CFLAGS) -o $@ \
gengenrtl.o
gengenrtl.o : gengenrtl.c $(RTL_BASE_H) system.h

File diff suppressed because it is too large Load Diff

1078
gcc/NEWS

File diff suppressed because it is too large Load Diff

View File

@ -1,117 +0,0 @@
3. When find_reloads is used to count number of spills needed
it does not take into account the fact that a reload may
turn out to be a dummy.
I'm not sure this really happens any more. Doesn't it find
all the dummies on both passes?
10. movl a3@,a0
movl a3@(16),a1
clrb a0@(a1:l)
is generated and may be worse than
movl a3@,a0
addl a3@(16),a0
clrb a0@
If ordering of operands is improved, many more
such cases will be generated from typical array accesses.
38. Hack expand_mult so that if there is no same-modes multiply
it will use a widening multiply and then truncate rather than
calling the library.
39. Hack expanding of division to notice cases for
long -> short division.
40. Represent divide insns as (DIV:SI ...) followed by
a separate lowpart extract. Represent remainder insns as DIV:SI
followed by a separate highpart extract. Then cse can work on
the DIV:SI part. Problem is, this may not be desirable on machines
where computing the quotient alone does not necessarily give
a remainder--such as the 68020 for long operands.
52. Reloading can look at how reload_contents got set up.
If it was copied from a register, just reload from that register.
Otherwise, perhaps can change the previous insn to move the
data via the reload reg, thus avoiding one memory ref.
63. Potential problem in cc_status.value2, if it ever activates itself
after a two-address subtraction (which currently cannot happen).
It is supposed to compare the current value of the destination
but eliminating it would use the results of the subtraction, equivalent
to comparing the previous value of the destination.
65. Should loops that neither start nor end with a break
be rearranged to end with the last break?
69. Define the floating point converting arithmetic instructions
for the 68881.
74. Combine loop opt with cse opt in one pass. Do cse on each loop,
then loop opt on that loop, and go from innermost loops outward.
Make loop invariants available for cse at end of loop.
85. pea can force a value to be reloaded into an areg
which can make it worse than separate adding and pushing.
This can only happen for adding something within addql range
and it only loses if the qty becomes dead at that point
so it can be added to with no copying.
93. If a pseudo doesn't get a hard reg everywhere,
can it get one during a loop?
96. Can do SImode bitfield insns without reloading, but must
alter the operands in special ways.
99. final could check loop-entry branches to see if they
screw up deletion of a test instruction. If they do,
can put another test instruction before the branch and
make it conditional and redirect it.
106. Aliasing may be impossible if data types of refs differ
and data type of containing objects also differ.
(But check this wrt unions.)
108. Can speed up flow analysis by making a table saying which
register is set and which registers are used by each instruction that
only sets one register and only uses two. This way avoid the tree
walk for such instructions (most instructions).
109. It is desirable to avoid converting INDEX to SImode if a
narrower mode suffices, as HImode does on the 68000.
How can this be done?
110. Possible special combination pattern:
If the two operands to a comparison die there and both come from insns
that are identical except for replacing one operand with the other,
throw away those insns. Ok if insns being discarded are known 1 to 1.
An andl #1 after a seq is 1 to 1, but how should compiler know that?
112. Can convert float to unsigned int by subtracting a constant,
converting to signed int, and changing the sign bit.
117. Any number of slow zero-extensions in one loop, that have
their clr insns moved out of the loop, can share one register
if their original life spans are disjoint.
But it may be hard to be sure of this since
the life span data that regscan produces may be hard to interpret
validly or may be incorrect after cse.
118. In cse, when a bfext insn refers to a register, if the field
corresponds to a halfword or a byte and the register is equivalent
to a memory location, it would be possible to detect this and
replace it with a simple memory reference.
121. Insns that store two values cannot be moved out of loops.
The code in scan_loop doesn't even try to deal with them.
122. When insn-output.c turns a bit-test into a sign-test,
it should see whether the cc is already set up with that sign.
123. When a conditional expression is used as a function arg, it would
be faster (and in some cases shorter) to push each alternative rather
than compute in a register and push that. This would require
being able to specify "push this" as a target for expand_expr.
124. On the 386, bad code results from foo (bar ()) when bar
returns a double, because the pseudo used fails to get preferenced
into an fp reg because of the distinction between regs 8 and 9.

View File

@ -1,435 +0,0 @@
Haifa scheduler (haifa-sched.c, loop.[ch], unroll.[ch], genattrtab.c):
(contact law@cygnus.com before starting any serious haifa work)
* Fix all the formatting problems. Simple, mindless work.
* Fix/add comments throughout the code. Many of the comments are from
the old scheduler and are out of date and misleading. Many new hunks
of code don't have sufficient comments and documentation. Those which
do have comments need to be rewritten to use complete sentences and
proper formatting.
* Someone needs make one (or more) passes over the scheduler as a whole to
just clean it up. Try to move the machine dependent bits into the target
files where they belong, avoid re-creating functions where or near
equivalents already exist (ie is_conditional_branch and friends), etc., etc.
* Document the new scheduling options. Remove those options which are
not really useful (like reverse scheduling for example). In general
the haifa scheduler adds _way_ too many options. I'm definitely of the
opinion that gcc already has too many -foptions, and haifa doesn't help
that situation.
* Testing and benchmarking. We've converted a few ports to using the
Haifa scheduler (hppa, sparc, ppc, alpha). We need to continue testing
and benchmarking the new scheduler on additional targets.
We need to have some kind of docs for how to best describe a machine to
the haifa scheduler to get good performance. Some existing ports have
been tuned to deal with the old scheduler -- they may need to be tuned
to generate good schedules with haifa.
Improvements to global cse and partial redundancy elimination:
The current implementation of global cse uses partial redundancy elimination
as described in Chow's thesis.
Long term we want to use lazy code motion as the basis for partial redundancy
elimination. lcm will find as many (or more) redunancies *and* it will
place the remaining computations at computationally optimal placement points
within the function. This reduces the number of redundant operations performed
as well as reducing register lifetimes. My experiments have shown that the
cases were the current PRE code hurts performance are greatly helped by using
lazy code motion.
lcm also provides the underlying framework for several additional optimizations
such as shrink wrapping, spill code motion, dead store elimination, and generic
load/store motion (all the other examples are subcases of load/store motion).
It can probably also be used to improve the reg-stack pass of the compiler.
Contact law@cygnus.com if you're interested in working on lazy code motion.
-------------
The old PROJECTS file. Stuff I know has been done has been deleted.
Stuff in progress has a contact name associated with it.
has been
1. Better optimization.
* Constants in unused inline functions
It would be nice to delay output of string constants so that string
constants mentioned in unused inline functions are never generated.
Perhaps this would also take care of string constants in dead code.
The difficulty is in finding a clean way for the RTL which refers
to the constant (currently, only by an assembler symbol name)
to point to the constant and cause it to be output.
* Optimize a sequence of if statements whose conditions are exclusive.
It is possible to optimize
if (x == 1) ...;
if (x == 2) ...;
if (x == 3) ...;
into
if (x == 1) ...;
else if (x == 2) ...;
else if (x == 3) ...;
provided that x is not altered by the contents of the if statements.
It's not certain whether this is worth doing. Perhaps programmers
nearly always write the else's themselves, leaving few opportunities
to improve anything.
* Un-cse.
Perhaps we should have an un-cse step right after cse, which tries to
replace a reg with its value if the value can be substituted for the
reg everywhere, if that looks like an improvement. Which is if the
reg is used only a few times. Use rtx_cost to determine if the
change is really an improvement.
* Clean up how cse works.
The scheme is that each value has just one hash entry. The
first_same_value and next_same_value chains are no longer needed.
For arithmetic, each hash table elt has the following slots:
* Operation. This is an rtx code.
* Mode.
* Operands 0, 1 and 2. These point to other hash table elements.
So, if we want to enter (PLUS:SI (REG:SI 30) (CONST_INT 104)), we
first enter (CONST_INT 104) and find the entry that (REG:SI 30) now
points to. Then we put these elts into operands 0 and 1 of a new elt.
We put PLUS and SI into the new elt.
Registers and mem refs would never be entered into the table as such.
However, the values they contain would be entered. There would be a
table indexed by regno which points at the hash entry for the value in
that reg.
The hash entry index now plays the role of a qty number.
We still need qty_first_reg, reg_next_eqv, etc. to record which regs
share a particular qty.
When a reg is used whose contents are unknown, we need to create a
hash table entry whose contents say "unknown", as a place holder for
whatever the reg contains. If that reg is added to something, then
the hash entry for the sum will refer to the "unknown" entry. Use
UNKNOWN for the rtx code in this entry. This replaces make_new_qty.
For a constant, a unique hash entry would be made based on the
value of the constant.
What about MEM? Each time a memory address is referenced, we need a
qty (a hash table elt) to represent what is in it. (Just as for a
register.) If this isn't known, create one, just as for a reg whose
contents are unknown.
We need a way to find all mem refs that still contain a certain value.
Do this with a chain of hash elts (for memory addresses) that point to
locations that hold the value. The hash elt for the value itself should
point to the start of the chain. It would be good for the hash elt
for an address to point to the hash elt for the contents of that address
(but this ptr can be null if the contents have never been entered).
With this data structure, nothing need ever be invalidated except
the lists of which regs or mems hold a particular value. It is easy
to see if there is a reg or mem that is equiv to a particular value.
If the value is constant, it is always explicitly constant.
* Support more general tail-recursion among different functions.
This might be possible under certain circumstances, such as when
the argument lists of the functions have the same lengths.
Perhaps it could be done with a special declaration.
You would need to verify in the calling function that it does not
use the addresses of any local variables and does not use setjmp.
* Put short statics vars at low addresses and use short addressing mode?
Useful on the 68000/68020 and perhaps on the 32000 series,
provided one has a linker that works with the feature.
This is said to make a 15% speedup on the 68000.
* Keep global variables in registers.
Here is a scheme for doing this. A global variable, or a local variable
whose address is taken, can be kept in a register for an entire function
if it does not use non-constant memory addresses and (for globals only)
does not call other functions. If the entire function does not meet
this criterion, a loop may.
The VAR_DECL for such a variable would have to have two RTL expressions:
the true home in memory, and the pseudo-register used temporarily.
It is necessary to emit insns to copy the memory location into the
pseudo-register at the beginning of the function or loop, and perhaps
back out at the end. These insns should have REG_EQUIV notes so that,
if the pseudo-register does not get a hard register, it is spilled into
the memory location which exists in any case.
The easiest way to set up these insns is to modify the routine
put_var_into_stack so that it does not apply to the entire function
(sparing any loops which contain nothing dangerous) and to call it at
the end of the function regardless of where in the function the
address of a local variable is taken. It would be called
unconditionally at the end of the function for all relevant global
variables.
For debugger output, the thing to do is to invent a new binding level
around the appropriate loop and define the variable name as a register
variable with that scope.
* Live-range splitting.
Currently a variable is allocated a hard register either for the full
extent of its use or not at all. Sometimes it would be good to
allocate a variable a hard register for just part of a function; for
example, through a particular loop where the variable is mostly used,
or outside of a particular loop where the variable is not used. (The
latter is nice because it might let the variable be in a register most
of the time even though the loop needs all the registers.)
Contact meissner@cygnus.com before starting any work on live range
splitting.
* Detect dead stores into memory?
A store into memory is dead if it is followed by another store into
the same location; and, in between, there is no reference to anything
that might be that location (including no reference to a variable
address).
This can be modeled as a partial redundancy elimination/lazy code motion
problem. Contact law@cygnus.com before working on dead store elimination
optimizations.
* Loop optimization.
Strength reduction and iteration variable elimination could be
smarter. They should know how to decide which iteration variables are
not worth making explicit because they can be computed as part of an
address calculation. Based on this information, they should decide
when it is desirable to eliminate one iteration variable and create
another in its place.
It should be possible to compute what the value of an iteration
variable will be at the end of the loop, and eliminate the variable
within the loop by computing that value at the loop end.
When a loop has a simple increment that adds 1,
instead of jumping in after the increment,
decrement the loop count and jump to the increment.
This allows aob insns to be used.
* Using constraints on values.
Many operations could be simplified based on knowledge of the
minimum and maximum possible values of a register at any particular time.
These limits could come from the data types in the tree, via rtl generation,
or they can be deduced from operations that are performed. For example,
the result of an `and' operation one of whose operands is 7 must be in
the range 0 to 7. Compare instructions also tell something about the
possible values of the operand, in the code beyond the test.
Value constraints can be used to determine the results of a further
comparison. They can also indicate that certain `and' operations are
redundant. Constraints might permit a decrement and branch
instruction that checks zeroness to be used when the user has
specified to exit if negative.
* Change the type of a variable.
Sometimes a variable is declared as `int', it is assigned only once
from a value of type `char', and then it is used only by comparison
against constants. On many machines, better code would result if
the variable had type `char'. If the compiler could detect this
case, it could change the declaration of the variable and change
all the places that use it.
* Better handling for very sparse switches.
There may be cases where it would be better to compile a switch
statement to use a fixed hash table rather than the current
combination of jump tables and binary search.
* Order of subexpressions.
It might be possible to make better code by paying attention
to the order in which to generate code for subexpressions of an expression.
* More code motion.
Consider hoisting common code up past conditional branches or tablejumps.
Contact law@cygnus.com before working on code hoisting.
* Trace scheduling.
This technique is said to be able to figure out which way a jump
will usually go, and rearrange the code to make that path the
faster one.
* Distributive law.
The C expression *(X + 4 * (Y + C)) compiles better on certain
machines if rewritten as *(X + 4*C + 4*Y) because of known addressing
modes. It may be tricky to determine when, and for which machines, to
use each alternative.
Some work has been done on this, in combine.c.
* Can optimize by changing if (x) y; else z; into z; if (x) y;
if z and x do not interfere and z has no effects not undone by y.
This is desirable if z is faster than jumping.
* For a two-insn loop on the 68020, such as
foo: movb a2@+,a3@+
jne foo
it is better to insert dbeq d0,foo before the jne.
d0 can be a junk register. The challenge is to fit this into
a portable framework: when can you detect this situation and
still be able to allocate a junk register?
2. Simpler porting.
Right now, describing the target machine's instructions is done
cleanly, but describing its addressing mode is done with several
ad-hoc macro definitions. Porting would be much easier if there were
an RTL description for addressing modes like that for instructions.
Tools analogous to genflags and genrecog would generate macros from
this description.
There would be one pattern in the address-description file for each
kind of addressing, and this pattern would have:
* the RTL expression for the address
* C code to verify its validity (since that may depend on
the exact data).
* C code to print the address in assembler language.
* C code to convert the address into a valid one, if it is not valid.
(This would replace LEGITIMIZE_ADDRESS).
* Register constraints for all indeterminates that appear
in the RTL expression.
3. Other languages.
Front ends for Pascal, Fortran, Algol, Cobol, Modula-2 and Ada are
desirable.
Pascal, Modula-2 and Ada require the implementation of functions
within functions. Some of the mechanisms for this already exist.
4. More extensions.
* Generated unique labels. Have some way of generating distinct labels
for use in extended asm statements. I don't know what a good syntax would
be.
* A way of defining a structure containing a union, in which the choice of
union alternative is controlled by a previous structure component.
Here is a possible syntax for this.
struct foo {
enum { INT, DOUBLE } code;
auto union { case INT: int i; case DOUBLE: double d;} value : code;
};
* Allow constructor expressions as lvalues, like this:
(struct foo) {a, b, c} = foo();
This would call foo, which returns a structure, and then store the
several components of the structure into the variables a, b, and c.
5. Generalize the machine model.
* Some new compiler features may be needed to do a good job on machines
where static data needs to be addressed using base registers.
* Some machines have two stacks in different areas of memory, one used
for scalars and another for large objects. The compiler does not
now have a way to understand this.
6. Useful warnings.
* Warn about statements that are undefined because the order of
evaluation of increment operators makes a big difference. Here is an
example:
*foo++ = hack (*foo);
7. Better documentation of how GCC works and how to port it.
Here is an outline proposed by Allan Adler.
I. Overview of this document
II. The machines on which GCC is implemented
A. Prose description of those characteristics of target machines and
their operating systems which are pertinent to the implementation
of GCC.
i. target machine characteristics
ii. comparison of this system of machine characteristics with
other systems of machine specification currently in use
B. Tables of the characteristics of the target machines on which
GCC is implemented.
C. A priori restrictions on the values of characteristics of target
machines, with special reference to those parts of the source code
which entail those restrictions
i. restrictions on individual characteristics
ii. restrictions involving relations between various characteristics
D. The use of GCC as a cross-compiler
i. cross-compilation to existing machines
ii. cross-compilation to non-existent machines
E. Assumptions which are made regarding the target machine
i. assumptions regarding the architecture of the target machine
ii. assumptions regarding the operating system of the target machine
iii. assumptions regarding software resident on the target machine
iv. where in the source code these assumptions are in effect made
III. A systematic approach to writing the files tm.h and xm.h
A. Macros which require special care or skill
B. Examples, with special reference to the underlying reasoning
IV. A systematic approach to writing the machine description file md
A. Minimal viable sets of insn descriptions
B. Examples, with special reference to the underlying reasoning
V. Uses of the file aux-output.c
VI. Specification of what constitutes correct performance of an
implementation of GCC
A. The components of GCC
B. The itinerary of a C program through GCC
C. A system of benchmark programs
D. What your RTL and assembler should look like with these benchmarks
E. Fine tuning for speed and size of compiled code
VII. A systematic procedure for debugging an implementation of GCC
A. Use of GDB
i. the macros in the file .gdbinit for GCC
ii. obstacles to the use of GDB
a. functions implemented as macros can't be called in GDB
B. Debugging without GDB
i. How to turn off the normal operation of GCC and access specific
parts of GCC
C. Debugging tools
D. Debugging the parser
i. how machine macros and insn definitions affect the parser
E. Debugging the recognizer
i. how machine macros and insn definitions affect the recognizer
ditto for other components
VIII. Data types used by GCC, with special reference to restrictions not
specified in the formal definition of the data type
IX. References to the literature for the algorithms used in GCC

View File

@ -1,26 +0,0 @@
This directory contains the egcs version 1.1 release of the GNU C
compiler. It includes all of the support for compiling C++ and
Objective C, including a run-time library for Objective C.
The GNU C compiler is free software. See the file COPYING for copying
permission.
See the file gcc.texi (together with other files that it includes) for
installation and porting information. The file INSTALL contains a
copy of the installation information, as plain ASCII.
Installing this package will create various files in subdirectories of
/usr/local/lib, which are passes used by the compiler and a library
named libgcc.a. It will also create /usr/local/bin/gcc, which is
the user-level command to do a compilation.
See the Bugs chapter of the GCC Manual for how to report bugs
usefully. An online readable version of the manual is in the files
gcc.info*.
The files pself.c and pself1.c are not part of GCC.
They are programs that print themselves on standard output.
They were written by Dario Dariol and Giovanni Cozzi, and are
included for your hacking pleasure. Likewise pself2.c
(Who is the author of that?) and pself3.c (by Vlad Taeerov and Rashit
Fakhreyev).

View File

@ -1,39 +0,0 @@
This is a collection of things that test suites have
said were "wrong" with GCC--but that I don't agree with.
First, test suites sometimes test for compatibility with
traditional C. GCC with -traditional is not completely
compatible with traditional C, and in some ways I think it
should not be.
* K&R C allowed \x to appear in a string literal (or character
literal?) even in cases where it is *not* followed by a sequence of
hex digits. I'm not convinced this is desirable.
* K&R compilers allow comments to cross over an inclusion boundary (i.e.
started in an include file and ended in the including file).
I think this would be quite ugly and can't imagine it could
be needed.
Sometimes tests disagree with GCC's interpretation of the ANSI standard.
* One test claims that this function should return 1.
enum {A, B} foo;
func (enum {B, A} arg)
{
return B;
}
I think it should return 0, because the definition of B that
applies is the one in func.
* Some tests report failure when the compiler does not produce
an error message for a certain program.
ANSI C requires a "diagnostic" message for certain kinds of invalid
programs, but a warning counts as a diagnostic. If GCC produces
a warning but not an error, that is correct ANSI support.
When test suites call this "failure", the tests are broken.

View File

@ -1,96 +0,0 @@
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define if printf supports "%p". */
#undef HAVE_PRINTF_PTR
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
/* Define if your compiler understands volatile. */
#undef HAVE_VOLATILE
/* Define if your assembler supports specifying the maximum number
of bytes to skip when using the GAS .p2align command. */
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
/* Define if your assembler supports .balign and .p2align. */
#undef HAVE_GAS_BALIGN_AND_P2ALIGN
/* Define if your assembler supports .subsection and .subsection -1 starts
emitting at the beginning of your section */
#undef HAVE_GAS_SUBSECTION_ORDERING
/* Define if you have a working <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Whether malloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_MALLOC
/* Whether realloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_REALLOC
/* Whether calloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_CALLOC
/* Whether free must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_FREE
/* Whether bcopy must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BCOPY
/* Whether bcmp must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BCMP
/* Whether bzero must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BZERO
/* Whether index must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_INDEX
/* Whether rindex must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_RINDEX
/* Whether getenv must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_GETENV
/* Whether atol must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ATOL
/* Whether sbrk must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_SBRK
/* Whether abort must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ABORT
/* Whether strerror must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRERROR
/* Whether strsignal must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRSIGNAL
/* Whether getcwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETCWD
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
/* Whether getrlimit must be declared even if <sys/resource.h> is included. */
#undef NEED_DECLARATION_GETRLIMIT
/* Whether setrlimit must be declared even if <sys/resource.h> is included. */
#undef NEED_DECLARATION_SETRLIMIT
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define to enable the use of a default assembler. */
#undef DEFAULT_ASSEMBLER
/* Define to enable the use of a default linker. */
#undef DEFAULT_LINKER
@TOP@

237
gcc/aclocal.m4 vendored
View File

@ -1,237 +0,0 @@
dnl See whether we can include both string.h and strings.h.
AC_DEFUN(GCC_HEADER_STRING,
[AC_CACHE_CHECK([whether string.h and strings.h may both be included],
gcc_cv_header_string,
[AC_TRY_COMPILE([#include <string.h>
#include <strings.h>], , gcc_cv_header_string=yes, gcc_cv_header_string=no)])
if test $gcc_cv_header_string = yes; then
AC_DEFINE(STRING_WITH_STRINGS)
fi
])
dnl See whether we need a declaration for a function.
dnl GCC_NEED_DECLARATION(FUNCTION [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATION,
[AC_MSG_CHECKING([whether $1 must be declared])
AC_CACHE_VAL(gcc_cv_decl_needed_$1,
[AC_TRY_COMPILE([
#include <stdio.h>
#ifdef STRING_WITH_STRINGS
# include <string.h>
# include <strings.h>
#else
# ifdef HAVE_STRING_H
# include <string.h>
# else
# ifdef HAVE_STRINGS_H
# include <strings.h>
# endif
# endif
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifndef HAVE_RINDEX
#define rindex strrchr
#endif
#ifndef HAVE_INDEX
#define index strchr
#endif
$2],
[char *(*pfn) = (char *(*)) $1],
eval "gcc_cv_decl_needed_$1=no", eval "gcc_cv_decl_needed_$1=yes")])
if eval "test \"`echo '$gcc_cv_decl_needed_'$1`\" = yes"; then
AC_MSG_RESULT(yes)
gcc_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
AC_DEFINE_UNQUOTED($gcc_tr_decl)
else
AC_MSG_RESULT(no)
fi
])dnl
dnl Check multiple functions to see whether each needs a declaration.
dnl GCC_NEED_DECLARATIONS(FUNCTION... [, EXTRA-HEADER-FILES])
AC_DEFUN(GCC_NEED_DECLARATIONS,
[for ac_func in $1
do
GCC_NEED_DECLARATION($ac_func, $2)
done
])
dnl Check if we have vprintf and possibly _doprnt.
dnl Note autoconf checks for vprintf even though we care about vfprintf.
AC_DEFUN(GCC_FUNC_VFPRINTF_DOPRNT,
[AC_FUNC_VPRINTF
vfprintf=
doprint=
if test $ac_cv_func_vprintf != yes ; then
vfprintf=vfprintf.o
if test $ac_cv_func__doprnt != yes ; then
doprint=doprint.o
fi
fi
AC_SUBST(vfprintf)
AC_SUBST(doprint)
])
dnl See if the printf functions in libc support %p in format strings.
AC_DEFUN(GCC_FUNC_PRINTF_PTR,
[AC_CACHE_CHECK(whether the printf functions support %p,
gcc_cv_func_printf_ptr,
[AC_TRY_RUN([#include <stdio.h>
main()
{
char buf[64];
char *p = buf, *q = NULL;
sprintf(buf, "%p", p);
sscanf(buf, "%p", &q);
exit (p != q);
}], gcc_cv_func_printf_ptr=yes, gcc_cv_func_printf_ptr=no,
gcc_cv_func_printf_ptr=no)
rm -f core core.* *.core])
if test $gcc_cv_func_printf_ptr = yes ; then
AC_DEFINE(HAVE_PRINTF_PTR)
fi
])
dnl See if symbolic links work and if not, try to substitute either hard links or simple copy.
AC_DEFUN(GCC_PROG_LN_S,
[AC_MSG_CHECKING(whether ln -s works)
AC_CACHE_VAL(gcc_cv_prog_LN_S,
[rm -f conftestdata_t
echo >conftestdata_f
if ln -s conftestdata_f conftestdata_t 2>/dev/null
then
gcc_cv_prog_LN_S="ln -s"
else
if ln conftestdata_f conftestdata_t 2>/dev/null
then
gcc_cv_prog_LN_S=ln
else
gcc_cv_prog_LN_S=cp
fi
fi
rm -f conftestdata_f conftestdata_t
])dnl
LN_S="$gcc_cv_prog_LN_S"
if test "$gcc_cv_prog_LN_S" = "ln -s"; then
AC_MSG_RESULT(yes)
else
if test "$gcc_cv_prog_LN_S" = "ln"; then
AC_MSG_RESULT([no, using ln])
else
AC_MSG_RESULT([no, and neither does ln, so using cp])
fi
fi
AC_SUBST(LN_S)dnl
])
dnl See if hard links work and if not, try to substitute either symbolic links or simple copy.
AC_DEFUN(GCC_PROG_LN,
[AC_MSG_CHECKING(whether ln works)
AC_CACHE_VAL(gcc_cv_prog_LN,
[rm -f conftestdata_t
echo >conftestdata_f
if ln conftestdata_f conftestdata_t 2>/dev/null
then
gcc_cv_prog_LN="ln"
else
if ln -s conftestdata_f conftestdata_t 2>/dev/null
then
gcc_cv_prog_LN="ln -s"
else
gcc_cv_prog_LN=cp
fi
fi
rm -f conftestdata_f conftestdata_t
])dnl
LN="$gcc_cv_prog_LN"
if test "$gcc_cv_prog_LN" = "ln"; then
AC_MSG_RESULT(yes)
else
if test "$gcc_cv_prog_LN" = "ln -s"; then
AC_MSG_RESULT([no, using ln -s])
else
AC_MSG_RESULT([no, and neither does ln -s, so using cp])
fi
fi
AC_SUBST(LN)dnl
])
dnl See whether the stage1 host compiler accepts the volatile keyword.
AC_DEFUN(GCC_C_VOLATILE,
[AC_CACHE_CHECK([for volatile], gcc_cv_c_volatile,
[AC_TRY_COMPILE(, [volatile int foo;],
gcc_cv_c_volatile=yes, gcc_cv_c_volatile=no)])
if test $gcc_cv_c_volatile = yes ; then
AC_DEFINE(HAVE_VOLATILE)
fi
])
AC_DEFUN(EGCS_PROG_INSTALL,
[AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
# SysV /etc/install, /usr/sbin/install
# SunOS /usr/etc/install
# IRIX /sbin/install
# AIX /bin/install
# AFS /usr/afsws/bin/install, which mishandles nonexistent args
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
AC_MSG_CHECKING(for a BSD compatible install)
if test -z "$INSTALL"; then
AC_CACHE_VAL(ac_cv_path_install,
[ IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS="${IFS}:"
for ac_dir in $PATH; do
# Account for people who put trailing slashes in PATH elements.
case "$ac_dir/" in
/|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
for ac_prog in ginstall scoinst install; do
if test -f $ac_dir/$ac_prog; then
if test $ac_prog = install &&
grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
# OSF/1 installbsd also uses dspmsg, but is usable.
:
else
ac_cv_path_install="$ac_dir/$ac_prog -c"
break 2
fi
fi
done
;;
esac
done
IFS="$ac_save_IFS"
])dnl
if test "${ac_cv_path_install+set}" = set; then
INSTALL="$ac_cv_path_install"
else
# As a last resort, use the slow shell script. We don't cache a
# path for INSTALL within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the path is relative.
INSTALL="$ac_install_sh"
fi
fi
dnl We do special magic for INSTALL instead of AC_SUBST, to get
dnl relative paths right.
AC_MSG_RESULT($INSTALL)
AC_SUBST(INSTALL)dnl
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
AC_SUBST(INSTALL_PROGRAM)dnl
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
AC_SUBST(INSTALL_DATA)dnl
])

View File

@ -1,35 +0,0 @@
# We have to use the cross-compiler we just built to compile it.
CC = gcc -b $(host)
# Need those to compile binaries running on host machine.
# It is configured by
#
# configure --host=target_cpu-target_os \
# --target=host=target_cpu-target_os --build=host_cpu-host_os
#
# That HOST stuff has to be taken care of very carefully.
HOST_PREFIX=l-
HOST_PREFIX_1=$(HOST_PREFIX)
HOST_CC=$(CC) -b $(build)
HOST_CFLAGS=$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS) $(XCFLAGS)
HOST_CLIB=
HOST_LDFLAGS=$(LDFLAGS)
HOST_CPPFLAGS=$(ALL_CPPFLAGS)
HOST_ALLOCA=$(ALLOCA)
HOST_MALLOC=$(MALLOC)
HOST_OBSTACK=$(OBSTACK)
# To build the native compiler with the cross compiler, the headers
# for the target are already fixed. And /usr/include is for host, not
# target.
FIXINCLUDES=Makefile.in
# Don't run fixproto either
STMP_FIXPROTO =
# Cause installation using install-build. We do nothing here.
#INSTALL_TARGET = install-build
# Don't try to compile the things we can't compile or we have made
# while making gcc with the cross-compiler.
#ALL = all.build

View File

@ -44,6 +44,67 @@ static char *gen_formal_list_for_func_def (tree, formals_style);
static char *gen_type (char *, tree, formals_style);
static char *gen_decl (tree, int, formals_style);
/* Concatenate strings and return the result.
Each string is passed as an argument, with the last argument being NULL,
e.g. concat("str1", "str2", "str3", ..., "strN", NULL). */
char *
concat(const char *first, ...)
{
int length;
char *newstr;
char *end;
const char *arg;
va_list args;
/* First compute the size of the result and get sufficient memory. */
va_start(args, first);
if (first == NULL)
{
length = 0;
}
else
{
length = strlen(first);
while ((arg = va_arg(args, const char *)) != NULL)
{
length += strlen(arg);
}
}
newstr = (char *)xmalloc(length + 1);
va_end(args);
/* Now copy the individual pieces to the result string. */
va_start(args, first);
end = newstr;
if (first != NULL)
{
arg = first;
while (*arg)
{
*end++ = *arg++;
}
while ((arg = va_arg(args, const char *)) != NULL)
{
while (*arg)
{
*end++ = *arg++;
}
}
}
*end = 0;
va_end(args);
return newstr;
}
/* Given a string representing an entire type or an entire declaration
which only lacks the actual "data-type" specifier (at its left end),
affix the data-type specifier to the left end of the given type

View File

@ -27,14 +27,8 @@ Boston, MA 02111-1307, USA. */
#include "obstack.h"
#include "toplev.h"
#include "output.h"
#include "c-pragma.h"
#include "rtl.h"
#include "cpplib.h"
cpp_reader parse_in;
cpp_options parse_options;
static enum cpp_token cpp_token;
#ifndef WCHAR_TYPE_SIZE
#ifdef INT_TYPE_SIZE
#define WCHAR_TYPE_SIZE INT_TYPE_SIZE
@ -419,14 +413,6 @@ decl_attributes (node, attributes, prefix_attributes)
}
else if (TREE_CODE_CLASS (TREE_CODE (node)) == 't')
type = node, is_type = 1;
#ifdef PRAGMA_INSERT_ATTRIBUTES
/* If the code in c-pragma.c wants to insert some attributes then
allow it to do so. Do this before allowing machine back ends to
insert attributes, so that they have the opportunity to override
anything done here. */
PRAGMA_INSERT_ATTRIBUTES (node, & attributes, & prefix_attributes);
#endif
#ifdef INSERT_ATTRIBUTES
INSERT_ATTRIBUTES (node, & attributes, & prefix_attributes);
@ -2775,7 +2761,7 @@ truthvalue_conversion (expr)
return build_binary_op (NE_EXPR, expr, integer_zero_node, 1);
}
/* Read the rest of a #-directive from input stream FINPUT.
In normal use, the directive name and the white space after it
have already been read, so they won't be included in the result.
@ -2784,103 +2770,85 @@ truthvalue_conversion (expr)
a part of the directive.
The value is a string in a reusable buffer. It remains valid
only until the next time this function is called. */
unsigned char *yy_cur, *yy_lim;
only until the next time this function is called.
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
#define UNGETC(c) ((c), yy_cur--)
void cpplib_init()
{
cpp_reader_init (&parse_in);
parse_in.opts = &parse_options;
cpp_options_init (&parse_options);
}
int
yy_get_token ()
{
for (;;)
{
parse_in.limit = parse_in.token_buffer;
cpp_token = cpp_get_token (&parse_in);
if (cpp_token == CPP_EOF)
return -1;
yy_lim = CPP_PWRITTEN (&parse_in);
yy_cur = parse_in.token_buffer;
if (yy_cur < yy_lim)
return *yy_cur++;
}
}
The terminating character ('\n' or EOF) is left in FINPUT for the
caller to re-read. */
char *
get_directive_line ()
get_directive_line (finput)
FILE *finput;
{
static char *directive_buffer = NULL;
static unsigned buffer_length = 0;
register char *p;
register char *buffer_limit;
register int looking_for = 0;
register int char_escaped = 0;
static char *directive_buffer = NULL;
static unsigned buffer_length = 0;
char *buffer_limit;
int looking_for = 0;
int char_escaped = 0;
if (buffer_length == 0)
if (buffer_length == 0)
{
directive_buffer = (char *)xmalloc (128);
buffer_length = 128;
directive_buffer = (char *)xmalloc(128);
buffer_length = 128;
}
buffer_limit = &directive_buffer[buffer_length];
buffer_limit = &directive_buffer[buffer_length];
for (p = directive_buffer; ; )
char *p = directive_buffer;
for (;;)
{
int c;
int c;
/* Make buffer bigger if it is full. */
if (p >= buffer_limit)
/* Make buffer bigger if it is full. */
if (p >= buffer_limit)
{
register unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
directive_buffer
= (char *)xrealloc (directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
unsigned bytes_used = (p - directive_buffer);
buffer_length *= 2;
directive_buffer = (char *)xrealloc(directive_buffer, buffer_length);
p = &directive_buffer[bytes_used];
buffer_limit = &directive_buffer[buffer_length];
}
c = GETC ();
c = getc(finput);
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
continue;
/* Discard initial whitespace. */
if ((c == ' ' || c == '\t') && p == directive_buffer)
{
do
{
c = getc(finput);
} while (c == ' ' || c == '\t');
}
/* Detect the end of the directive. */
if (c == '\n' && looking_for == 0)
{
UNGETC (c);
c = '\0';
}
/* Detect the end of the directive. */
if (looking_for == 0 && (c == '\n' || c == EOF))
{
ungetc(c, finput);
c = 0;
}
*p++ = c;
*p++ = c;
if (c == 0)
return directive_buffer;
if (c == 0)
return directive_buffer;
/* Handle string and character constant syntax. */
if (looking_for)
{
if (looking_for == c && !char_escaped)
looking_for = 0; /* Found terminator... stop looking. */
}
else
if (c == '\'' || c == '"')
looking_for = c; /* Don't stop buffering until we see another
another one of these (or an EOF). */
/* Handle string and character constant syntax. */
if (looking_for)
{
if (looking_for == c && !char_escaped)
looking_for = 0; /* Found terminator... stop looking. */
}
else
{
if (c == '\'' || c == '"')
looking_for = c; /* Don't stop buffering until we see another one of these (or an EOF). */
}
/* Handle backslash. */
char_escaped = (c == '\\' && ! char_escaped);
/* Handle backslash. */
char_escaped = (c == '\\' && !char_escaped);
}
}
/* Make a variant type in the proper way for C/C++, propagating qualifiers
down to the element type of an array. */

View File

@ -35,9 +35,6 @@ Boston, MA 02111-1307, USA. */
#include "c-lex.h"
#include "toplev.h"
#include "cpplib.h"
extern cpp_reader parse_in;
/* In grokdeclarator, distinguish syntactic contexts of declarators. */
enum decl_context
{ NORMAL, /* Ordinary declaration */
@ -360,7 +357,7 @@ struct binding_level
/* Nonzero means make a BLOCK if this level has any subblocks. */
char keep_if_subblocks;
/* Number of decls in `names' that have incomplete
/* Number of decls in `names' that have incomplete
structure or union types. */
int n_incomplete;
@ -371,7 +368,7 @@ struct binding_level
};
#define NULL_BINDING_LEVEL (struct binding_level *) NULL
/* The binding level currently in effect. */
static struct binding_level *current_binding_level;
@ -400,7 +397,7 @@ static int keep_next_level_flag;
if it has subblocks. */
static int keep_next_if_subblocks;
/* The chain of outer levels of label scopes.
This uses the same data structure used for binding levels,
but it works differently: each link in the chain records
@ -570,10 +567,6 @@ int warn_missing_braces;
int warn_main;
/* Warn about #pragma directives that are not recognised. */
int warn_unknown_pragmas = 0; /* Tri state variable. */
/* Warn about comparison of signed and unsigned values.
If -1, neither -Wsign-compare nor -Wno-sign-compare has been specified. */
@ -583,25 +576,12 @@ int warn_sign_compare = -1;
int warn_multichar = 1;
/* Nonzero means `$' can be in an identifier. */
/* Decode the string P as a language-specific option for C. */
#ifndef DOLLARS_IN_IDENTIFIERS
#define DOLLARS_IN_IDENTIFIERS 1
#endif
int dollars_in_ident = DOLLARS_IN_IDENTIFIERS;
/* Decode the string P as a language-specific option for C.
Return the number of strings consumed. */
int
c_decode_option (argc, argv)
int argc ATTRIBUTE_UNUSED;
char **argv;
void
c_decode_option (p)
char *p;
{
int strings_processed;
char *p = argv[0];
strings_processed = cpp_handle_option (&parse_in, argc, argv);
if (!strcmp (p, "-ftraditional") || !strcmp (p, "-traditional"))
{
flag_traditional = 1;
@ -684,18 +664,6 @@ c_decode_option (argc, argv)
else
error ("unknown C standard `%s'", argstart);
}
else if (!strcmp (p, "-fdollars-in-identifiers"))
dollars_in_ident = 1;
else if (!strcmp (p, "-fno-dollars-in-identifiers"))
dollars_in_ident = 0;
else if (!strcmp (p, "-fsigned-char"))
flag_signed_char = 1;
else if (!strcmp (p, "-funsigned-char"))
flag_signed_char = 0;
else if (!strcmp (p, "-fno-signed-char"))
flag_signed_char = 0;
else if (!strcmp (p, "-fno-unsigned-char"))
flag_signed_char = 1;
else if (!strcmp (p, "-fsigned-bitfields")
|| !strcmp (p, "-fno-unsigned-bitfields"))
{
@ -820,26 +788,6 @@ c_decode_option (argc, argv)
warn_return_type = 1;
else if (!strcmp (p, "-Wno-return-type"))
warn_return_type = 0;
else if (!strcmp (p, "-Wcomment"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wno-comment"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wcomments"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wno-comments"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wtrigraphs"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wno-trigraphs"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wundef"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wno-undef"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wimport"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wno-import"))
; /* cpp handles this one. */
else if (!strcmp (p, "-Wmissing-braces"))
warn_missing_braces = 1;
else if (!strcmp (p, "-Wno-missing-braces"))
@ -856,12 +804,6 @@ c_decode_option (argc, argv)
warn_multichar = 1;
else if (!strcmp (p, "-Wno-multichar"))
warn_multichar = 0;
else if (!strcmp (p, "-Wunknown-pragmas"))
/* Set to greater than 1, so that even unknown pragmas in system
headers will be warned about. */
warn_unknown_pragmas = 2;
else if (!strcmp (p, "-Wno-unknown-pragmas"))
warn_unknown_pragmas = 0;
else if (!strcmp (p, "-Wall"))
{
/* We save the value of warn_uninitialized, since if they put
@ -881,13 +823,7 @@ c_decode_option (argc, argv)
/* We set this to 2 here, but 1 in -Wmain, so -ffreestanding can turn
it off only if it's not explicit. */
warn_main = 2;
/* Only warn about unknown pragmas that are not in system headers. */
warn_unknown_pragmas = 1;
}
else
return strings_processed;
return 1;
}
/* Hooks for print_node. */
@ -924,7 +860,7 @@ print_lang_identifier (file, node, indent)
/* Hook called at end of compilation to assume 1 elt
for a top-level array decl that wasn't complete before. */
void
finish_incomplete_decl (decl)
tree decl;
@ -1065,7 +1001,7 @@ clear_limbo_values (block)
for (tem = BLOCK_SUBBLOCKS (block); tem; tem = TREE_CHAIN (tem))
clear_limbo_values (tem);
}
/* Exit a binding level.
Pop the level off, and restore the state of the identifier-decl mappings
that were in effect when this level was entered.
@ -1405,7 +1341,7 @@ pop_label_level ()
DECL_NAME (TREE_VALUE (link)));
}
else if (warn_unused && !TREE_USED (TREE_VALUE (link)))
warning_with_decl (TREE_VALUE (link),
warning_with_decl (TREE_VALUE (link),
"label `%s' defined but not used");
IDENTIFIER_LABEL_VALUE (DECL_NAME (TREE_VALUE (link))) = 0;
@ -1612,7 +1548,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
tree trytype
= build_function_type (newreturntype,
TYPE_ARG_TYPES (oldtype));
types_match = comptypes (newtype, trytype);
if (types_match)
oldtype = trytype;
@ -1630,10 +1566,10 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
the return type of olddecl's function type. */
tree trytype
= build_function_type (TREE_TYPE (oldtype),
tree_cons (NULL_TREE,
tree_cons (NULL_TREE,
TREE_VALUE (TYPE_ARG_TYPES (newtype)),
TREE_CHAIN (TYPE_ARG_TYPES (oldtype))));
types_match = comptypes (newtype, trytype);
if (types_match)
oldtype = trytype;
@ -1760,11 +1696,11 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
: "`%s' previously declared here"));
}
else if (TREE_CODE (newdecl) == TYPE_DECL
&& (DECL_IN_SYSTEM_HEADER (olddecl)
&& (DECL_IN_SYSTEM_HEADER (olddecl)
|| DECL_IN_SYSTEM_HEADER (newdecl)))
{
warning_with_decl (newdecl, "redefinition of `%s'");
warning_with_decl
warning_with_decl
(olddecl,
((DECL_INITIAL (olddecl)
&& current_binding_level == global_binding_level)
@ -1894,7 +1830,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
push_obstacks_nochange ();
end_temporary_allocation ();
}
/* Merge the data types specified in the two decls. */
if (TREE_CODE (newdecl) != FUNCTION_DECL || !DECL_BUILT_IN (olddecl))
{
@ -1996,7 +1932,7 @@ duplicate_decls (newdecl, olddecl, different_binding_level)
}
/* Merge the storage class information. */
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
DECL_WEAK (newdecl) |= DECL_WEAK (olddecl);
/* For functions, static overrides non-static. */
if (TREE_CODE (newdecl) == FUNCTION_DECL)
{
@ -2342,7 +2278,7 @@ pushdecl (x)
if (b == global_binding_level)
{
/* Install a global value. */
/* If the first global decl has external linkage,
warn if we later see static one. */
if (IDENTIFIER_GLOBAL_VALUE (name) == 0 && TREE_PUBLIC (x))
@ -2648,7 +2584,7 @@ redeclaration_error_message (newdecl, olddecl)
is equivalent to what this code used to do before the build_type_copy
call. The variant type distinction should not matter for traditional
code, because it doesn't have type qualifiers. */
if (flag_traditional
if (flag_traditional
&& TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl))
return 0;
if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl))
@ -2772,7 +2708,7 @@ shadow_label (name)
for (dup = named_labels; dup; dup = TREE_CHAIN (dup))
if (TREE_VALUE (dup) == decl)
{
error ("duplicate label declaration `%s'",
error ("duplicate label declaration `%s'",
IDENTIFIER_POINTER (name));
error_with_decl (TREE_VALUE (dup),
"this is a previous declaration");
@ -3011,13 +2947,9 @@ init_decl_processing ()
pushdecl (build_decl (TYPE_DECL, ridpointers[(int) RID_INT],
integer_type_node));
/* Define `char', which is like either `signed char' or `unsigned char'
but not the same as either. */
/* Define `char', which is like `unsigned char' but not the same. */
char_type_node
= (flag_signed_char
? make_signed_type (CHAR_TYPE_SIZE)
: make_unsigned_type (CHAR_TYPE_SIZE));
char_type_node = make_unsigned_type (CHAR_TYPE_SIZE);
pushdecl (build_decl (TYPE_DECL, get_identifier ("char"),
char_type_node));
@ -3308,14 +3240,14 @@ init_decl_processing ()
BUILT_IN_CONSTANT_P, NULL);
builtin_function ("__builtin_return_address",
build_function_type (ptr_type_node,
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
unsigned_type_node,
endlink)),
BUILT_IN_RETURN_ADDRESS, NULL);
builtin_function ("__builtin_frame_address",
build_function_type (ptr_type_node,
build_function_type (ptr_type_node,
tree_cons (NULL_TREE,
unsigned_type_node,
endlink)),
@ -3335,7 +3267,7 @@ init_decl_processing ()
build_function_type (unsigned_type_node, endlink),
BUILT_IN_DWARF_FP_REGNUM, NULL);
builtin_function ("__builtin_dwarf_reg_size", int_ftype_int,
BUILT_IN_DWARF_REG_SIZE, NULL);
BUILT_IN_DWARF_REG_SIZE, NULL);
builtin_function ("__builtin_frob_return_addr", ptr_ftype_ptr,
BUILT_IN_FROB_RETURN_ADDR, NULL);
builtin_function ("__builtin_extract_return_addr", ptr_ftype_ptr,
@ -3461,23 +3393,23 @@ init_decl_processing ()
BUILT_IN_STRCPY, "strcpy");
builtin_function ("__builtin_strlen", strlen_ftype,
BUILT_IN_STRLEN, "strlen");
builtin_function ("__builtin_sqrtf", float_ftype_float,
builtin_function ("__builtin_sqrtf", float_ftype_float,
BUILT_IN_FSQRT, "sqrtf");
builtin_function ("__builtin_fsqrt", double_ftype_double,
builtin_function ("__builtin_fsqrt", double_ftype_double,
BUILT_IN_FSQRT, "sqrt");
builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
builtin_function ("__builtin_sqrtl", ldouble_ftype_ldouble,
BUILT_IN_FSQRT, "sqrtl");
builtin_function ("__builtin_sinf", float_ftype_float,
builtin_function ("__builtin_sinf", float_ftype_float,
BUILT_IN_SIN, "sinf");
builtin_function ("__builtin_sin", double_ftype_double,
builtin_function ("__builtin_sin", double_ftype_double,
BUILT_IN_SIN, "sin");
builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
builtin_function ("__builtin_sinl", ldouble_ftype_ldouble,
BUILT_IN_SIN, "sinl");
builtin_function ("__builtin_cosf", float_ftype_float,
builtin_function ("__builtin_cosf", float_ftype_float,
BUILT_IN_COS, "cosf");
builtin_function ("__builtin_cos", double_ftype_double,
builtin_function ("__builtin_cos", double_ftype_double,
BUILT_IN_COS, "cos");
builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
builtin_function ("__builtin_cosl", ldouble_ftype_ldouble,
BUILT_IN_COS, "cosl");
builtin_function ("__builtin_setjmp",
build_function_type (integer_type_node,
@ -3762,7 +3694,7 @@ start_decl (declarator, declspecs, initialized, attributes, prefix_attributes)
/* The corresponding pop_obstacks is in finish_decl. */
push_obstacks_nochange ();
if (warn_main && TREE_CODE (decl) != FUNCTION_DECL
if (warn_main && TREE_CODE (decl) != FUNCTION_DECL
&& !strcmp (IDENTIFIER_POINTER (DECL_NAME (decl)), "main"))
warning_with_decl (decl, "`%s' is usually a function");
@ -4978,7 +4910,7 @@ grokdeclarator (declarator, declspecs, decl_context, initialized)
/* Omit the arg types if -traditional, since the arg types
and the list links might not be permanent. */
type = build_function_type (type,
flag_traditional
flag_traditional
? NULL_TREE : arg_types);
#endif
/* Type qualifiers before the return type of the function
@ -5967,7 +5899,7 @@ finish_struct (t, fieldlist, attributes)
else
{
register tree y = fieldlist;
while (1)
{
if (DECL_NAME (y) == DECL_NAME (TREE_CHAIN (x)))
@ -6479,7 +6411,7 @@ start_function (declspecs, declarator, prefix_attributes, attributes, nested)
#ifdef SET_DEFAULT_DECL_ATTRIBUTES
SET_DEFAULT_DECL_ATTRIBUTES (decl1, attributes);
#endif
/* This function exists in static storage.
(This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1;
@ -7159,7 +7091,7 @@ combine_parm_decls (specparms, parmlist, void_at_end)
types = saveable_tree_cons (NULL_TREE, TREE_TYPE (parm), types);
}
}
if (void_at_end)
return saveable_tree_cons (parmdecls, nonparms,
nreverse (saveable_tree_cons (NULL_TREE,

View File

@ -30,17 +30,10 @@ Boston, MA 02111-1307, USA. */
#include "c-tree.h"
#include "flags.h"
#include "c-parse.h"
#include "c-pragma.h"
#include "toplev.h"
#ifdef MULTIBYTE_CHARS
#include "mbchar.h"
#include <locale.h>
#endif /* MULTIBYTE_CHARS */
#include "cpplib.h"
extern cpp_reader parse_in;
extern cpp_options parse_options;
/* Stream for reading from the input file. */
FILE *finput;
extern void yyprint (FILE *, int, YYSTYPE);
@ -52,12 +45,8 @@ tree ridpointers[(int) RID_MAX];
/* Cause the `yydebug' variable to be defined. */
#define YYDEBUG 1
extern unsigned char *yy_cur, *yy_lim;
extern int yy_get_token ();
#define GETC() (yy_cur < yy_lim ? *yy_cur++ : yy_get_token ())
#define UNGETC(c) ((void)(c), yy_cur--)
#define GETC() getc(finput)
#define UNGETC(c) ungetc(c, finput)
/* the declaration found for the last IDENTIFIER token read in.
yylex must look this up to detect typedefs, which get token type TYPENAME,
@ -90,10 +79,6 @@ static int indent_level = 0; /* Number of { minus number of }. */
/* Nonzero if end-of-file has been seen on input. */
static int end_of_file;
#ifdef HANDLE_GENERIC_PRAGMAS
static int handle_generic_pragma (int);
#endif /* HANDLE_GENERIC_PRAGMAS */
static int whitespace_cr (int);
static int skip_white_space (int);
static int skip_white_space_on_line (void);
@ -155,17 +140,17 @@ char *
init_parse (filename)
char *filename;
{
parse_in.show_column = 1;
if (! cpp_start_read (&parse_in, filename))
abort ();
/* Open input file. */
if (filename == 0 || !strcmp (filename, "-"))
filename = "stdin";
{
finput = stdin;
filename = "stdin";
}
else
finput = fopen (filename, "r");
/* cpp_start_read always puts at least one line directive into the
token buffer. We must arrange to read it out here. */
yy_cur = parse_in.token_buffer;
yy_lim = CPP_PWRITTEN (&parse_in);
if (finput == 0)
pfatal_with_name (filename);
init_lex ();
@ -175,7 +160,7 @@ init_parse (filename)
void
finish_parse ()
{
cpp_finish (&parse_in);
fclose(finput);
}
void
@ -188,12 +173,6 @@ init_lex ()
and will increment it to 1. */
lineno = 0;
#ifdef MULTIBYTE_CHARS
/* Change to the native locale for multibyte conversions. */
setlocale (LC_CTYPE, "");
literal_codeset = getenv ("LANG");
#endif
maxtoken = 40;
token_buffer = (char *) xmalloc (maxtoken + 2);
@ -361,16 +340,12 @@ skip_white_space (c)
}
}
/* Skips all of the white space at the current location in the input file.
Must use and reset nextchar if it has the next character. */
/* Skips all of the white space at the current location in the input file. */
void
position_after_white_space ()
{
register int c;
c = GETC();
int c = GETC();
UNGETC (skip_white_space (c));
}
@ -422,27 +397,13 @@ extend_token_buffer (p)
return token_buffer + offset;
}
#if defined HANDLE_PRAGMA
/* Local versions of these macros, that can be passed as function pointers. */
static int
pragma_getc ()
{
return GETC();
}
static void
pragma_ungetc (arg)
int arg;
{
UNGETC (arg);
}
#endif
/* At the beginning of the file, check for a #line directive indicating
the real name of the file. */
void check_line_directive()
{
check_newline ();
yy_cur--;
ungetc(check_newline(), finput);
}
/* At the beginning of a line, increment the line number
@ -478,7 +439,7 @@ check_newline ()
/* If a letter follows, then if the word here is `line', skip
it and ignore it; otherwise, ignore the line, with an error
if the word isn't `pragma', `ident', `define', or `undef'. */
if the word isn't `pragma', `define', or `undef'. */
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
@ -489,46 +450,9 @@ check_newline ()
&& GETC() == 'g'
&& GETC() == 'm'
&& GETC() == 'a'
&& ((c = GETC()) == ' ' || c == '\t' || c == '\n'
|| whitespace_cr (c) ))
&& ((c = GETC()) == ' ' || c == '\t' || c == '\n' || whitespace_cr (c)))
{
while (c == ' ' || c == '\t' || whitespace_cr (c))
c = GETC ();
if (c == '\n')
return c;
#if defined HANDLE_PRAGMA || defined HANDLE_GENERIC_PRAGMAS
UNGETC (c);
token = yylex ();
if (token != IDENTIFIER)
goto skipline;
#endif /* HANDLE_PRAGMA || HANDLE_GENERIC_PRAGMAS */
#ifdef HANDLE_PRAGMA
/* We invoke HANDLE_PRAGMA before HANDLE_GENERIC_PRAGMAS (if
both are defined), in order to give the back end a chance to
override the interpretation of generic style pragmas. */
if (TREE_CODE (yylval.ttype) != IDENTIFIER_NODE)
goto skipline;
if (HANDLE_PRAGMA (pragma_getc, pragma_ungetc,
IDENTIFIER_POINTER (yylval.ttype)))
return GETC ();
#endif /* HANDLE_PRAGMA */
#ifdef HANDLE_GENERIC_PRAGMAS
if (handle_generic_pragma (token))
return GETC ();
#endif /* HANDLE_GENERIC_PRAGMAS */
/* Issue a warning message if we have been asked to do so.
Ignoring unknown pragmas in system header file unless
an explcit -Wunknown-pragmas has been given. */
if (warn_unknown_pragmas > 1
|| (warn_unknown_pragmas && ! in_system_header))
warning ("ignoring pragma: %s", token_buffer);
warning ("ignoring pragma");
goto skipline;
}
}
@ -568,45 +492,6 @@ check_newline ()
&& ((c = GETC()) == ' ' || c == '\t'))
goto linenum;
}
else if (c == 'i')
{
if (GETC() == 'd'
&& GETC() == 'e'
&& GETC() == 'n'
&& GETC() == 't'
&& ((c = GETC()) == ' ' || c == '\t'))
{
/* #ident. The pedantic warning is now in cccp.c. */
/* Here we have just seen `#ident '.
A string constant should follow. */
c = skip_white_space_on_line ();
/* If no argument, ignore the line. */
if (c == '\n')
return c;
UNGETC (c);
token = yylex ();
if (token != STRING
|| TREE_CODE (yylval.ttype) != STRING_CST)
{
error ("invalid #ident");
goto skipline;
}
if (!flag_no_ident)
{
#ifdef ASM_OUTPUT_IDENT
ASM_OUTPUT_IDENT (asm_out_file, TREE_STRING_POINTER (yylval.ttype));
#endif
}
/* Skip the rest of this line. */
goto skipline;
}
}
error ("undefined or invalid # directive");
goto skipline;
@ -782,50 +667,7 @@ linenum:
c = GETC();
return c;
}
#ifdef HANDLE_GENERIC_PRAGMAS
/* Handle a #pragma directive.
TOKEN is the token we read after `#pragma'. Processes the entire input
line and return non-zero iff the pragma has been successfully parsed. */
/* This function has to be in this file, in order to get at
the token types. */
static int
handle_generic_pragma (token)
register int token;
{
register int c;
for (;;)
{
switch (token)
{
case IDENTIFIER:
case TYPENAME:
case STRING:
case CONSTANT:
handle_pragma_token (token_buffer, yylval.ttype);
break;
default:
handle_pragma_token (token_buffer, NULL);
}
c = GETC ();
while (c == ' ' || c == '\t')
c = GETC ();
UNGETC (c);
if (c == '\n' || c == EOF)
return handle_pragma_token (NULL, NULL);
token = yylex ();
}
}
#endif /* HANDLE_GENERIC_PRAGMAS */
#define ENDFILE -1 /* token that represents end-of-file */
/* Read an escape sequence, returning its equivalent as a character,
@ -1022,7 +864,7 @@ yylex ()
register int value;
int wide_flag = 0;
c = GETC();
c = GETC();
/* Effectively do c = skip_white_space (c)
but do it faster in the usual cases. */
@ -1097,20 +939,10 @@ yylex ()
case 'u': case 'v': case 'w': case 'x': case 'y':
case 'z':
case '_':
case '$':
letter:
p = token_buffer;
while (ISALNUM (c) || c == '_' || c == '$')
while (ISALNUM (c) || c == '_')
{
/* Make sure this char really belongs in an identifier. */
if (c == '$')
{
if (! dollars_in_ident)
error ("`$' in identifier");
else if (pedantic)
pedwarn ("`$' in identifier");
}
if (p >= token_buffer + maxtoken)
p = extend_token_buffer (p);
@ -1714,7 +1546,7 @@ yylex ()
UNGETC (c);
*p = 0;
if (ISALNUM (c) || c == '.' || c == '_' || c == '$'
if (ISALNUM (c) || c == '.' || c == '_'
|| (!flag_traditional && (c == '-' || c == '+')
&& (p[-1] == 'e' || p[-1] == 'E')))
error ("missing white space after number `%s'", token_buffer);
@ -1730,10 +1562,6 @@ yylex ()
int chars_seen = 0;
unsigned width = TYPE_PRECISION (char_type_node);
int max_chars;
#ifdef MULTIBYTE_CHARS
int longest_char = local_mb_cur_max ();
(void) local_mbtowc (NULL, NULL, 0);
#endif
max_chars = TYPE_PRECISION (integer_type_node) / width;
if (wide_flag)
@ -1757,10 +1585,6 @@ yylex ()
if (width < HOST_BITS_PER_INT
&& (unsigned) c >= ((unsigned)1 << width))
pedwarn ("escape sequence out of range for character");
#ifdef MAP_CHARACTER
if (ISPRINT (c))
c = MAP_CHARACTER (c);
#endif
}
else if (c == '\n')
{
@ -1768,66 +1592,6 @@ yylex ()
pedwarn ("ANSI C forbids newline in character constant");
lineno++;
}
else
{
#ifdef MULTIBYTE_CHARS
wchar_t wc;
int i;
int char_len = -1;
for (i = 1; i <= longest_char; ++i)
{
if (i > maxtoken - 4)
extend_token_buffer (token_buffer);
token_buffer[i] = c;
char_len = local_mbtowc (& wc,
token_buffer + 1,
i);
if (char_len != -1)
break;
c = GETC ();
}
if (char_len > 1)
{
/* mbtowc sometimes needs an extra char before accepting */
if (char_len < i)
UNGETC (c);
if (! wide_flag)
{
/* Merge character into result; ignore excess chars. */
for (i = 1; i <= char_len; ++i)
{
if (i > max_chars)
break;
if (width < HOST_BITS_PER_INT)
result = (result << width)
| (token_buffer[i]
& ((1 << width) - 1));
else
result = token_buffer[i];
}
num_chars += char_len;
goto tryagain;
}
c = wc;
}
else
{
if (char_len == -1)
warning ("Ignoring invalid multibyte character");
if (wide_flag)
c = wc;
#ifdef MAP_CHARACTER
else
c = MAP_CHARACTER (c);
#endif
}
#else /* ! MULTIBYTE_CHARS */
#ifdef MAP_CHARACTER
c = MAP_CHARACTER (c);
#endif
#endif /* ! MULTIBYTE_CHARS */
}
if (wide_flag)
{
@ -1894,10 +1658,6 @@ yylex ()
{
unsigned width = wide_flag ? WCHAR_TYPE_SIZE
: TYPE_PRECISION (char_type_node);
#ifdef MULTIBYTE_CHARS
int longest_char = local_mb_cur_max ();
(void) local_mbtowc (NULL, NULL, 0);
#endif
c = GETC ();
p = token_buffer + 1;
@ -1919,40 +1679,6 @@ yylex ()
pedwarn ("ANSI C forbids newline in string constant");
lineno++;
}
else
{
#ifdef MULTIBYTE_CHARS
wchar_t wc;
int i;
int char_len = -1;
for (i = 0; i < longest_char; ++i)
{
if (p + i >= token_buffer + maxtoken)
p = extend_token_buffer (p);
p[i] = c;
char_len = local_mbtowc (& wc, p, i + 1);
if (char_len != -1)
break;
c = GETC ();
}
if (char_len == -1)
warning ("Ignoring invalid multibyte character");
else
{
/* mbtowc sometimes needs an extra char before accepting */
if (char_len <= i)
UNGETC (c);
if (! wide_flag)
{
p += (i + 1);
c = GETC ();
continue;
}
c = wc;
}
#endif /* MULTIBYTE_CHARS */
}
/* Add this single character into the buffer either as a wchar_t
or as a single byte. */

View File

@ -206,10 +206,6 @@
#include "output.h"
#include "toplev.h"
#ifdef MULTIBYTE_CHARS
#include <locale.h>
#endif
/* Since parsers are distinct for each language, put the language string
definition here. */

View File

@ -1,452 +0,0 @@
/* Handle #pragma, system V.4 style. Supports #pragma weak and #pragma pack.
Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "config.h"
#include "system.h"
#include "rtl.h"
#include "tree.h"
#include "except.h"
#include "function.h"
#include "defaults.h"
#include "c-pragma.h"
#include "flags.h"
#include "toplev.h"
#ifdef HANDLE_GENERIC_PRAGMAS
#ifdef HANDLE_PRAGMA_PACK
/* When structure field packing is in effect, this variable is the
number of bits to use as the maximum alignment. When packing is not
in effect, this is zero. */
extern int maximum_field_alignment;
#endif
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
typedef struct align_stack
{
int alignment;
unsigned int num_pushes;
struct align_stack * prev;
} align_stack;
static struct align_stack * alignment_stack = NULL;
static int push_alignment (int);
static int pop_alignment (void);
/* Push an alignment value onto the stack. */
static int
push_alignment (alignment)
int alignment;
{
switch (alignment)
{
case 0:
case 1:
case 2:
case 4:
case 8:
case 16:
break;
default:
warning ("\
Alignment must be a small power of two, not %d, in #pragma pack",
alignment);
return 0;
}
if (alignment_stack == NULL
|| alignment_stack->alignment != alignment)
{
align_stack * entry;
entry = (align_stack *) xmalloc (sizeof (* entry));
if (entry == NULL)
{
warning ("Out of memory pushing #pragma pack");
return 0;
}
entry->alignment = alignment;
entry->num_pushes = 1;
entry->prev = alignment_stack;
alignment_stack = entry;
if (alignment < 8)
maximum_field_alignment = alignment * 8;
else
/* MSVC ignores alignments > 4. */
maximum_field_alignment = 0;
}
else
alignment_stack->num_pushes ++;
return 1;
}
/* Undo a push of an alignment onto the stack. */
static int
pop_alignment ()
{
if (alignment_stack == NULL)
{
warning ("\
#pragma pack(pop) encountered without corresponding #pragma pack(push,<n>)");
return 0;
}
if (-- alignment_stack->num_pushes == 0)
{
align_stack * entry;
entry = alignment_stack->prev;
if (entry == NULL || entry->alignment > 4)
maximum_field_alignment = 0;
else
maximum_field_alignment = entry->alignment * 8;
free (alignment_stack);
alignment_stack = entry;
}
return 1;
}
/* Generate 'packed' and 'aligned' attributes for decls whilst a
#pragma pack(push... is in effect. */
void
insert_pack_attributes (node, attributes, prefix)
tree node;
tree * attributes;
tree * prefix;
{
tree a;
/* If we are not packing, then there is nothing to do. */
if (maximum_field_alignment == 0
|| alignment_stack == NULL)
return;
/* We are only interested in fields. */
if (TREE_CODE_CLASS (TREE_CODE (node)) != 'd'
|| TREE_CODE (node) != FIELD_DECL)
return;
/* Add a 'packed' attribute. */
* attributes = tree_cons (get_identifier ("packed"), NULL, * attributes);
/* If the alignment is > 8 then add an alignment attribute as well. */
if (maximum_field_alignment > 8)
{
/* If the aligned attribute is already present then do not override it. */
for (a = * attributes; a; a = TREE_CHAIN (a))
{
tree name = TREE_PURPOSE (a);
if (strcmp (IDENTIFIER_POINTER (name), "aligned") == 0)
break;
}
if (a == NULL)
for (a = * prefix; a; a = TREE_CHAIN (a))
{
tree name = TREE_PURPOSE (a);
if (strcmp (IDENTIFIER_POINTER (name), "aligned") == 0)
break;
}
if (a == NULL)
{
* attributes = tree_cons
(get_identifier ("aligned"),
tree_cons (NULL,
build_int_2 (maximum_field_alignment / 8, 0),
NULL),
* attributes);
}
}
return;
}
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
static int add_weak (char *, char *);
static int
add_weak (name, value)
char * name;
char * value;
{
struct weak_syms * weak;
weak = (struct weak_syms *) permalloc (sizeof (struct weak_syms));
if (weak == NULL)
return 0;
weak->next = weak_decls;
weak->name = name;
weak->value = value;
weak_decls = weak;
return 1;
}
#endif /* HANDLE_PRAGMA_WEAK */
/* Handle one token of a pragma directive. TOKEN is the current token, and
STRING is its printable form. Some front ends do not support generating
tokens, and will only pass in a STRING. Also some front ends will reuse
the buffer containing STRING, so it must be copied to a local buffer if
it needs to be preserved.
If STRING is non-NULL, then the return value will be ignored, and there
will be futher calls to handle_pragma_token() in order to handle the rest of
the line containing the #pragma directive. If STRING is NULL, the entire
line has now been presented to handle_pragma_token() and the return value
should be zero if the pragma flawed in some way, or if the pragma was not
recognised, and non-zero if it was successfully handled. */
int
handle_pragma_token (string, token)
char * string;
tree token;
{
static enum pragma_state state = ps_start;
static enum pragma_state type;
static char * name;
static char * value;
static int align;
/* If we have reached the end of the #pragma directive then
determine what value we should return. */
if (string == NULL)
{
int ret_val = 0;
switch (type)
{
default:
abort ();
break;
case ps_done:
/* The pragma was not recognised. */
break;
#ifdef HANDLE_PRAGMA_PACK
case ps_pack:
if (state == ps_right)
{
maximum_field_alignment = align * 8;
ret_val = 1;
}
else
warning ("malformed `#pragma pack'");
break;
#endif /* HANDLE_PRAGMA_PACK */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
case ps_push:
if (state == ps_right)
ret_val = push_alignment (align);
else
warning ("incomplete '#pragma pack(push,<n>)'");
break;
case ps_pop:
if (state == ps_right)
ret_val = pop_alignment ();
else
warning ("missing closing parenthesis in '#pragma pack(pop)'");
break;
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
case ps_weak:
if (HANDLE_PRAGMA_WEAK)
{
if (state == ps_name)
ret_val = add_weak (name, NULL);
else if (state == ps_value)
ret_val = add_weak (name, value);
else
warning ("malformed `#pragma weak'");
}
else
ret_val = 1; /* Ignore the pragma. */
break;
#endif /* HANDLE_PRAGMA_WEAK */
}
type = state = ps_start;
return ret_val;
}
/* If we have been given a token, but it is not an identifier,
or a small constant, then something has gone wrong. */
if (token)
{
switch (TREE_CODE (token))
{
case IDENTIFIER_NODE:
break;
case INTEGER_CST:
if (TREE_INT_CST_HIGH (token) != 0)
return 0;
break;
default:
return 0;
}
}
switch (state)
{
case ps_start:
type = state = ps_done;
#ifdef HANDLE_PRAGMA_PACK
if (strcmp (string, "pack") == 0)
type = state = ps_pack;
#endif
#ifdef HANDLE_PRAGMA_WEAK
if (strcmp (string, "weak") == 0)
type = state = ps_weak;
#endif
break;
#ifdef HANDLE_PRAGMA_WEAK
case ps_weak:
name = permalloc (strlen (string) + 1);
if (name == NULL)
{
warning ("Out of memory parsing #pragma weak");
state = ps_bad;
}
else
{
strcpy (name, string);
state = ps_name;
}
break;
case ps_name:
state = (strcmp (string, "=") ? ps_bad : ps_equals);
break;
case ps_equals:
value = permalloc (strlen (string) + 1);
if (value == NULL)
{
warning ("Out of memory parsing #pragma weak");
state = ps_bad;
}
else
{
strcpy (value, string);
state = ps_value;
}
break;
case ps_value:
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_WEAK */
#ifdef HANDLE_PRAGMA_PACK
case ps_pack:
state = (strcmp (string, "(") ? ps_bad : ps_left);
break;
case ps_left:
if (token && TREE_CODE(token) == INTEGER_CST)
align = TREE_INT_CST_LOW(token);
else
align = atoi (string);
switch (align)
{
case 1:
case 2:
case 4:
state = ps_align;
break;
case 0:
state = (strcmp (string, ")") ? ps_bad : ps_right);
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
if (state == ps_bad)
{
if (strcmp (string, "push") == 0)
type = state = ps_push;
else if (strcmp (string, "pop") == 0)
type = state = ps_pop;
}
#endif
break;
default:
state = ps_bad;
break;
}
break;
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
case ps_pop:
#endif
case ps_align:
state = (strcmp (string, ")") ? ps_bad : ps_right);
break;
case ps_right:
state = ps_bad;
break;
#endif /* HANDLE_PRAGMA_PACK */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
case ps_push:
state = (strcmp (string, ",") ? ps_bad : ps_comma);
break;
case ps_comma:
align = atoi (string);
state = ps_align;
break;
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
case ps_bad:
case ps_done:
break;
default:
abort ();
}
return 1;
}
#endif /* HANDLE_GENERIC_PRAGMAS */

View File

@ -1,100 +0,0 @@
/* Pragma related interfaces.
Copyright (C) 1995, 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef _C_PRAGMA_H
#define _C_PRAGMA_H
#ifdef HANDLE_SYSV_PRAGMA
/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
defined. */
#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
#define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
#endif
/* We always support #pragma pack for SYSV pragmas. */
#ifndef HANDLE_PRAGMA_PACK
#define HANDLE_PRAGMA_PACK 1
#endif
#endif /* HANDLE_SYSV_PRAGMA */
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
/* If we are supporting #pragma pack(push... then we automatically
support #pragma pack(<n>) */
#define HANDLE_PRAGMA_PACK 1
#define PRAGMA_INSERT_ATTRIBUTES(node, pattr, prefix_attr) \
insert_pack_attributes (node, pattr, prefix_attr)
extern void insert_pack_attributes (tree, tree *, tree *);
#endif /* HANDLE_PRAGMA_PACK_PUSH_POP */
#ifdef HANDLE_PRAGMA_WEAK
/* This structure contains any weak symbol declarations waiting to be emitted. */
struct weak_syms
{
struct weak_syms * next;
char * name;
char * value;
};
/* Declared in varasm.c */
extern struct weak_syms * weak_decls;
#endif /* HANDLE_PRAGMA_WEAK */
#if defined HANDLE_PRAGMA_PACK || defined HANDLE_PRAGMA_WEAK
/* Define HANDLE_GENERIC_PRAGMAS if any kind of front-end pragma
parsing is to be done. The code in GCC's generic C source files
will only look for the definition of this constant. They will
ignore definitions of HANDLE_PRAGMA_PACK and so on. */
#define HANDLE_GENERIC_PRAGMAS 1
#endif
#ifdef HANDLE_GENERIC_PRAGMAS
enum pragma_state
{
ps_start,
ps_done,
#ifdef HANDLE_PRAGMA_WEAK
ps_weak,
ps_name,
ps_equals,
ps_value,
#endif
#ifdef HANDLE_PRAGMA_PACK
ps_pack,
ps_left,
ps_align,
ps_right,
#endif
#ifdef HANDLE_PRAGMA_PACK_PUSH_POP
ps_push,
ps_pop,
ps_comma,
#endif
ps_bad
};
/* Handle a C style pragma */
extern int handle_pragma_token (char *, tree);
#endif /* HANDLE_GENERIC_PRAGMAS */
#endif /* _C_PRAGMA_H */

View File

@ -187,8 +187,8 @@ extern tree convert_and_check (tree, tree);
extern void overflow_warning (tree);
extern void unsigned_conversion_warning (tree, tree);
/* Read the rest of the current #-directive line. */
extern char *get_directive_line (void);
#define GET_DIRECTIVE_LINE() get_directive_line ()
extern char *get_directive_line (FILE *);
#define GET_DIRECTIVE_LINE() get_directive_line(finput)
/* Subroutine of build_binary_op, used for comparison operations.
See if the operands have both been converted from subword integer types
@ -273,7 +273,7 @@ extern tree c_build_qualified_type (tree, int);
c_build_qualified_type (TYPE, \
((CONST_P) ? TYPE_QUAL_CONST : 0) | \
((VOLATILE_P) ? TYPE_QUAL_VOLATILE : 0))
extern int c_decode_option (int, char **);
extern void c_decode_option (char *);
extern void c_mark_varargs (void);
extern tree check_identifier (tree, tree);
extern void clear_parm_order (void);
@ -410,10 +410,6 @@ extern int current_function_returns_null;
extern int skip_evaluation;
/* Nonzero means `$' can be in an identifier. */
extern int dollars_in_ident;
/* Nonzero means allow type mismatches in conditional expressions;
just make their values `void'. */
@ -530,10 +526,6 @@ extern int warn_multichar;
extern int warn_long_long;
/* Nonzero means we are reading code that came from a system header file. */
extern int system_header_p;
/* In c-decl.c */
extern void finish_incomplete_decl (tree);

4
gcc/config.guess vendored
View File

@ -1,4 +0,0 @@
#!/bin/sh
# Use the top-level config.guess so that we don't have two of them.
guesssys=`echo $0 | sed 's|config.guess|../config.guess|'`
exec ${guesssys} "$@"

View File

@ -1,240 +0,0 @@
/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define if printf supports "%p". */
#undef HAVE_PRINTF_PTR
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define if your cpp understands the stringify operator. */
#undef HAVE_CPP_STRINGIFY
/* Define if your compiler understands volatile. */
#undef HAVE_VOLATILE
/* Define if your assembler supports specifying the maximum number
of bytes to skip when using the GAS .p2align command. */
#undef HAVE_GAS_MAX_SKIP_P2ALIGN
/* Define if your assembler supports .balign and .p2align. */
#undef HAVE_GAS_BALIGN_AND_P2ALIGN
/* Define if your assembler supports .subsection and .subsection -1 starts
emitting at the beginning of your section */
#undef HAVE_GAS_SUBSECTION_ORDERING
/* Define if you have a working <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Whether malloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_MALLOC
/* Whether realloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_REALLOC
/* Whether calloc must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_CALLOC
/* Whether free must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_FREE
/* Whether bcopy must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BCOPY
/* Whether bcmp must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BCMP
/* Whether bzero must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_BZERO
/* Whether index must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_INDEX
/* Whether rindex must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_RINDEX
/* Whether getenv must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_GETENV
/* Whether atol must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ATOL
/* Whether sbrk must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_SBRK
/* Whether abort must be declared even if <stdlib.h> is included. */
#undef NEED_DECLARATION_ABORT
/* Whether strerror must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRERROR
/* Whether strsignal must be declared even if <string.h> is included. */
#undef NEED_DECLARATION_STRSIGNAL
/* Whether getcwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETCWD
/* Whether getwd must be declared even if <unistd.h> is included. */
#undef NEED_DECLARATION_GETWD
/* Whether getrlimit must be declared even if <sys/resource.h> is included. */
#undef NEED_DECLARATION_GETRLIMIT
/* Whether setrlimit must be declared even if <sys/resource.h> is included. */
#undef NEED_DECLARATION_SETRLIMIT
/* Define if you want expensive run-time checks. */
#undef ENABLE_CHECKING
/* Define to enable the use of a default assembler. */
#undef DEFAULT_ASSEMBLER
/* Define to enable the use of a default linker. */
#undef DEFAULT_LINKER
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if you have the atoll function. */
#undef HAVE_ATOLL
/* Define if you have the atoq function. */
#undef HAVE_ATOQ
/* Define if you have the bcmp function. */
#undef HAVE_BCMP
/* Define if you have the bcopy function. */
#undef HAVE_BCOPY
/* Define if you have the bsearch function. */
#undef HAVE_BSEARCH
/* Define if you have the bzero function. */
#undef HAVE_BZERO
/* Define if you have the fputc_unlocked function. */
#undef HAVE_FPUTC_UNLOCKED
/* Define if you have the fputs_unlocked function. */
#undef HAVE_FPUTS_UNLOCKED
/* Define if you have the getrlimit function. */
#undef HAVE_GETRLIMIT
/* Define if you have the gettimeofday function. */
#undef HAVE_GETTIMEOFDAY
/* Define if you have the index function. */
#undef HAVE_INDEX
/* Define if you have the isascii function. */
#undef HAVE_ISASCII
/* Define if you have the kill function. */
#undef HAVE_KILL
/* Define if you have the popen function. */
#undef HAVE_POPEN
/* Define if you have the putc_unlocked function. */
#undef HAVE_PUTC_UNLOCKED
/* Define if you have the putenv function. */
#undef HAVE_PUTENV
/* Define if you have the rindex function. */
#undef HAVE_RINDEX
/* Define if you have the setrlimit function. */
#undef HAVE_SETRLIMIT
/* Define if you have the strchr function. */
#undef HAVE_STRCHR
/* Define if you have the strerror function. */
#undef HAVE_STRERROR
/* Define if you have the strrchr function. */
#undef HAVE_STRRCHR
/* Define if you have the strsignal function. */
#undef HAVE_STRSIGNAL
/* Define if you have the strtoul function. */
#undef HAVE_STRTOUL
/* Define if you have the sysconf function. */
#undef HAVE_SYSCONF
/* Define if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
/* Define if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define if you have the <stab.h> header file. */
#undef HAVE_STAB_H
/* Define if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
/* Define if you have the <sys/resource.h> header file. */
#undef HAVE_SYS_RESOURCE_H
/* Define if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define if you have the <sys/times.h> header file. */
#undef HAVE_SYS_TIMES_H
/* Define if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H

1225
gcc/config.sub vendored

File diff suppressed because it is too large Load Diff

View File

@ -384,8 +384,6 @@ extern char * structure_size_string;
/* Layout of Source Language Data Types */
#define DEFAULT_SIGNED_CHAR 0
#define TARGET_BELL 007
#define TARGET_BS 010
#define TARGET_TAB 011
@ -1101,8 +1099,6 @@ int thumb_shiftable_const ();
#define FUNCTION_MODE SImode
#define DOLLARS_IN_IDENTIFIERS 0
#define NO_DOLLAR_IN_LABEL 1
#define HAVE_ATEXIT
@ -1111,8 +1107,8 @@ int thumb_shiftable_const ();
limited PC addressing range: */
#define MACHINE_DEPENDENT_REORG(INSN) thumb_reorg ((INSN))
extern char * thumb_unexpanded_epilogue ();
extern char * output_move_mem_multiple ();
extern char * thumb_load_double_from_address ();
extern int far_jump_used_p();
extern char *thumb_unexpanded_epilogue();
extern char *output_move_mem_multiple();
extern char *thumb_load_double_from_address();
extern int far_jump_used_p();
extern void thumb_override_options();

4451
gcc/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +0,0 @@
@echo off
if %1.==go32. goto call_go32
if %1.==winnt. goto call_winnt
echo Usage: configure go32 or configure winnt cpu
goto END
:call_go32
call config\msdos\configure %1 %2 %3 %4
goto END
:call_winnt
if %2.==i386. goto really_call_winnt
if %2.==alpha. goto really_call_winnt
echo Usage: configure winnt i386 or configure winnt alpha
goto END
:really_call_winnt
call config\winnt\config-nt %1 %2 %3 %4
goto END
:END

View File

@ -1,77 +0,0 @@
# configure.frag for GNU CC
# Process the host/target/language Makefile fragments.
# Copyright (C) 1997 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
# First parameter is the source directory, second is list of subdirectories,
# third is list of host makefile fragments, fourth is list of target makefile
# fragments.
srcdir=$1
subdirs=$2
xmake_files=$3
tmake_files=$4
# Copy all the host makefile fragments into Make-host.
rm -f Make-host
touch Make-host
for f in .. $xmake_files
do
if [ -f $f ]
then
cat $f >> Make-host
fi
done
# Copy all the target makefile fragments into Make-target.
rm -f Make-target
touch Make-target
for f in .. $tmake_files
do
if [ -f $f ]
then
cat $f >> Make-target
fi
done
# Ensure the language build subdirectories exist.
for subdir in . $subdirs
do
if [ $subdir != . ]
then
test -d $subdir || mkdir $subdir
fi
done
# Now copy each language's Make-lang.in file to Make-lang.
rm -f Make-lang
touch Make-lang
for subdir in . $subdirs
do
if [ $subdir != . ]
then
cat $srcdir/$subdir/Make-lang.in >> Make-lang
fi
done

File diff suppressed because it is too large Load Diff

View File

@ -1,233 +0,0 @@
# configure.lang for GNU CC
# This script is run by configure for configuration of language
# subdirectories which conform to the old GCC configure mechanism
# for such subdirectories.
# Copyright (C) 1997, 1998 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
savesrcdir=$srcdir
for subdir in . $oldstyle_subdirs
do
# We only want to do this in language subdirs, but we have to handle
# the case of $oldstyle_subdirs = "".
if [ $subdir = . ]
then
continue
fi
oldsrcdir=$savesrcdir
# Re-adjust the path
case $oldsrcdir in
/*)
srcdir=$oldsrcdir/$subdir
;;
*)
oldsrcdir=../${oldsrcdir}
srcdir=$oldsrcdir/$subdir
;;
esac
mainsrcdir=$oldsrcdir
STARTDIR=`pwd`
test -d $subdir || mkdir $subdir
cd $subdir
# Create Makefile.tem from Makefile.in.
# Make it set VPATH if necessary so that the sources are found.
# Also change its value of srcdir.
# Also create a .gdbinit file which runs the one in srcdir
# and tells GDB to look there for source files.
case $srcdir in
. | ./$subdir | .././$subdir)
rm -f Makefile.tem
cp Makefile.in Makefile.tem
chmod +w Makefile.tem
;;
*)
rm -f Makefile.tem
echo "VPATH = ${srcdir}" \
| cat - ${srcdir}/Makefile.in \
| sed "s@^srcdir = \.@srcdir = ${srcdir}@" > Makefile.tem
rm -f .gdbinit
echo "dir ." > .gdbinit
echo "dir ${srcdir}" >> .gdbinit
echo "dir ${mainsrcdir}" >> .gdbinit
if [ x$gdb_needs_out_file_path = xyes ]
then
echo "dir ${mainsrcdir}/config/"`dirname ${out_file}` >> .gdbinit
fi
echo "source ${mainsrcdir}/.gdbinit" >> .gdbinit
;;
esac
# Conditionalize the makefile for this host machine.
rm -f Makefile.xx Makefile.ll
merged_frags=
for f in .. ${host_xmake_file}
do
if [ -f ${mainsrcdir}/config/$f ]
then
cat ${mainsrcdir}/config/$f >> Makefile.ll
if [ x"${merged_frags}" != x ]
then
merged_frags="${merged_frags} and "
fi
merged_frags="${merged_frags}${f}"
fi
done
if [ x"${merged_frags}" != x ]
then
sed -e "/####host/ r Makefile.ll" Makefile.tem > Makefile.xx
echo "Merged ${merged_frags}."
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
rm -f Makefile.ll
fi
# Add a definition for MAKE if system wants one.
case "$SET_MAKE" in
?*)
rm -f Makefile.xx
(echo "$SET_MAKE"; cat Makefile.tem) >Makefile.xx
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
esac
# Add a definition for INSTALL if system wants one.
# This substitutes for lots of x-* files.
if [ x$build_broken_install = x ]
then true
else
rm -f Makefile.xx
abssrcdir=`cd ${srcdir}; pwd`
sed "s|^INSTALL = .*|${INSTALL}|" Makefile.tem > Makefile.xx
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
fi
# If using -program-transform-name, override the installation names.
if [ "x${program_transform_set}" = "xyes" ] ; then
sed -e "s/^program_transform_name[ ]*=.*$/program_transform_name =
$program_transform_name/" \
-e "s/^program_transform_cross_name[
]*=.*$/program_transform_cross_name = $program_transform_name/" \
Makefile.tem > Makefile.xx
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
fi
# Conditionalize the makefile for this target machine.
rm -f Makefile.xx Makefile.ll
merged_frags=
for f in .. ${tmake_file}
do
if [ -f ${mainsrcdir}/config/$f ]
then
cat ${mainsrcdir}/config/$f >> Makefile.ll
if [ x"${merged_frags}" != x ]
then
merged_frags="${merged_frags} and "
fi
merged_frags="${merged_frags}$f"
fi
done
if [ x"${merged_frags}" != x ]
then
sed -e "/####target/ r Makefile.ll" Makefile.tem > Makefile.xx
echo "Merged ${merged_frags}."
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
rm -f Makefile.ll
fi
# If the host supports
# symlinks, point stage[123] at ../stage[123] so bootstrapping and the
# installation procedure can still use CC="stage1/xgcc -Bstage1/".
# If the host doesn't support symlinks, FLAGS_TO_PASS has been
# modified to solve the problem there.
for t in stage1 stage2 stage3 stage4 include
do
rm -f $t
$symbolic_link ../$t $t 2>/dev/null
done
# Remove all formfeeds, since some Makes get confused by them.
# Also arrange to give the variables `target', `target_alias',
# `host_xmake_file', `tmake_file', `prefix', `local_prefix',
# `exec_prefix', `INSTALL_HEADERS_DIR', `exeext'
# values in the Makefile from the values they have in this script.
rm -f Makefile.xx
# Create an empty Makefile.sed first, to work around a Nextstep 3.3 bug.
echo 's| ||' > Makefile.sed
rm Makefile.sed
echo 's| ||' > Makefile.sed
echo "s|^target=.*$|target=${target}|" >> Makefile.sed
echo "s|^target_alias=.*$|target_alias=${target_alias}|" >> Makefile.sed
echo "s|^xmake_file=.*$|xmake_file=${dep_host_xmake_file}|" >> Makefile.sed
echo "s|^tmake_file=.*$|tmake_file=${dep_tmake_file}|" >> Makefile.sed
echo "s|^version=.*$|version=${version}|" >> Makefile.sed
echo "s|^GCC_THREAD_FILE=.*$|GCC_THREAD_FILE=${thread_file}|" >> Makefile.sed
echo "s|^prefix[ ]*=.*|prefix = $prefix|" >> Makefile.sed
echo "s|^local_prefix[ ]*=.*|local_prefix = $local_prefix|" >> Makefile.sed
echo "s|^exec_prefix[ ]*=.*|exec_prefix = $exec_prefix|" >> Makefile.sed
echo "s|^INSTALL_HEADERS_DIR[ ]*=.*$|INSTALL_HEADERS_DIR = ${build_install_headers_dir}|" >> Makefile.sed
echo "s|^exeext[ ]*=.*$|exeext = ${build_exeext}|" >> Makefile.sed
sed -f Makefile.sed Makefile.tem > Makefile.xx
rm -f Makefile.tem Makefile.sed
mv Makefile.xx Makefile.tem
# Install Makefile for real, after making final changes.
# Define macro CROSS_COMPILE in compilation
# if this is a cross-compiler.
# Also use all.cross instead of all.internal
# and add cross-make to Makefile.
if [ x$host != x$target ]
then
rm -f Makefile.xx
echo "CROSS=-DCROSS_COMPILE" > Makefile.xx
sed -e "/####cross/ r ${mainsrcdir}/cross-make" Makefile.tem >> Makefile.xx
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
fi
# When building gcc with a cross-compiler, we need to fix a few things.
# This must come after cross-make as we want all.build to override
# all.cross.
if [ x$build != x$host ]
then
rm -f Makefile.xx
echo "build= $build" > Makefile.xx
echo "host= $host" >> Makefile.xx
sed -e "s|objc-runtime$||" \
-e "/####build/ r ${mainsrcdir}/build-make" Makefile.tem >> Makefile.xx
rm -f Makefile.tem
mv Makefile.xx Makefile.tem
fi
rm -f Makefile
mv Makefile.tem Makefile
echo "Created \`$subdir/Makefile'."
cd $STARTDIR
done # end of current-dir SUBDIRS loop
# Restore this, remember we're invoked with `.'.
srcdir=$savesrcdir

View File

@ -1 +0,0 @@
.so man1/cccp.1

View File

@ -1,66 +0,0 @@
\initial {#}
\entry {\samp {##}}{18}
\initial {A}
\entry {arguments in macro definitions}{10}
\entry {assertions}{36}
\entry {assertions, undoing}{37}
\initial {B}
\entry {blank macro arguments}{12}
\initial {C}
\entry {cascaded macros}{29}
\entry {commands}{3}
\entry {commenting out code}{34}
\entry {computed \samp {#include}}{5}
\entry {concatenation}{18}
\entry {conditionals}{30}
\initial {E}
\entry {expansion of arguments}{26}
\initial {F}
\entry {function-like macro}{10}
\initial {H}
\entry {header file}{3}
\initial {I}
\entry {including just once}{6}
\entry {inheritance}{8}
\entry {invocation of the preprocessor}{41}
\initial {L}
\entry {line control}{39}
\initial {M}
\entry {macro argument expansion}{26}
\entry {macro body uses macro}{29}
\entry {macros with argument}{10}
\entry {manifest constant}{9}
\initial {N}
\entry {newlines in macro arguments}{30}
\entry {null command}{40}
\initial {O}
\entry {options}{41}
\entry {output format}{41}
\entry {overriding a header file}{8}
\initial {P}
\entry {parentheses in macro bodies}{22}
\entry {pitfalls of macros}{21}
\entry {predefined macros}{13}
\entry {predicates}{36}
\entry {preprocessor commands}{3}
\entry {prescan of macro arguments}{26}
\entry {problems with macros}{21}
\initial {R}
\entry {redefining macros}{20}
\entry {repeated inclusion}{6}
\entry {retracting assertions}{37}
\initial {S}
\entry {second include path}{45}
\entry {self-reference}{25}
\entry {semicolons (after macro calls)}{23}
\entry {side effects (in macro arguments)}{24}
\entry {simple macro}{9}
\entry {space as macro argument}{12}
\entry {standard predefined macros}{13}
\entry {stringification}{17}
\initial {T}
\entry {testing predicates}{36}
\initial {U}
\entry {unassert}{37}
\entry {undefining macros}{20}
\entry {unsafe macros}{24}

View File

@ -1,94 +0,0 @@
\initial {#}
\entry {\code {#assert}}{37}
\entry {\code {#cpu}}{36}
\entry {\code {#define}}{10}
\entry {\code {#elif}}{33}
\entry {\code {#else}}{32}
\entry {\code {#error}}{38}
\entry {\code {#ident}}{40}
\entry {\code {#if}}{31}
\entry {\code {#ifdef}}{35}
\entry {\code {#ifndef}}{35}
\entry {\code {#import}}{7}
\entry {\code {#include}}{4}
\entry {\code {#include{\_}next}}{8}
\entry {\code {#line}}{39}
\entry {\code {#machine}}{36}
\entry {\code {#pragma}}{40}
\entry {\code {#pragma once}}{7}
\entry {\code {#system}}{36}
\entry {\code {#unassert}}{37}
\entry {\code {#warning}}{38}
\initial {-}
\entry {\code {-$}}{46}
\entry {\code {-A}}{44}
\entry {\code {-C}}{42}
\entry {\code {-D}}{43}
\entry {\code {-dD}}{44}
\entry {\code {-dM}}{44}
\entry {\code {-H}}{45}
\entry {\code {-I}}{43}
\entry {\code {-idirafter}}{45}
\entry {\code {-imacros}}{45}
\entry {\code {-include}}{45}
\entry {\code {-iprefix}}{45}
\entry {\code {-isystem}}{45}
\entry {\code {-iwithprefix}}{45}
\entry {\code {-lang-c}}{45}
\entry {\code {-lang-c{\tt\char43}{\tt\char43}}}{45}
\entry {\code {-lang-objc}}{45}
\entry {\code {-lang-objc{\tt\char43}{\tt\char43}}}{45}
\entry {\code {-M}}{44}
\entry {\code {-MD}}{44}
\entry {\code {-MM}}{44}
\entry {\code {-MMD}}{45}
\entry {\code {-nostdinc}}{43}
\entry {\code {-nostdinc{\tt\char43}{\tt\char43}}}{43}
\entry {\code {-P}}{42}
\entry {\code {-pedantic}}{43}
\entry {\code {-pedantic-errors}}{43}
\entry {\code {-traditional}}{42}
\entry {\code {-trigraphs}}{42}
\entry {\code {-U}}{44}
\entry {\code {-undef}}{44}
\entry {\code {-Wall}}{43}
\entry {\code {-Wcomment}}{43}
\entry {\code {-Wtraditional}}{43}
\entry {\code {-Wtrigraphs}}{43}
\initial {{\_}}
\entry {\code {{\_}{\_}BASE{\_}FILE{\_}{\_}}}{15}
\entry {\code {{\_}{\_}CHAR{\_}UNSIGNED{\_}{\_}}}{15}
\entry {\code {{\_}{\_}cplusplus}}{14}
\entry {\code {{\_}{\_}DATE{\_}{\_}}}{14}
\entry {\code {{\_}{\_}FILE{\_}{\_}}}{13}
\entry {\code {{\_}{\_}GNUC{\_}{\_}}}{14}
\entry {\code {{\_}{\_}GNUG{\_}{\_}}}{14}
\entry {\code {{\_}{\_}INCLUDE{\_}LEVEL{\_}}}{14}
\entry {\code {{\_}{\_}LINE{\_}{\_}}}{13}
\entry {\code {{\_}{\_}OPTIMIZE{\_}{\_}}}{15}
\entry {\code {{\_}{\_}STDC{\_}{\_}}}{14}
\entry {\code {{\_}{\_}STRICT{\_}ANSI{\_}{\_}}}{15}
\entry {\code {{\_}{\_}TIME{\_}{\_}}}{14}
\entry {\code {{\_}{\_}VERSION{\_}{\_}}}{15}
\entry {\code {{\_}AM29000}}{16}
\entry {\code {{\_}AM29K}}{16}
\initial {B}
\entry {\code {BSD}}{16}
\initial {D}
\entry {\code {defined}}{34}
\initial {M}
\entry {\code {M68020}}{16}
\entry {\code {m68k}}{16}
\entry {\code {mc68000}}{16}
\initial {N}
\entry {\code {ns32000}}{16}
\initial {P}
\entry {\code {pyr}}{16}
\initial {S}
\entry {\code {sequent}}{16}
\entry {\code {sun}}{16}
\entry {\code {system header files}}{4}
\initial {U}
\entry {\code {unix}}{16}
\initial {V}
\entry {\code {vax}}{16}

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +0,0 @@
/* Part of CPP library. (memory allocation - xmalloc etc)
Copyright (C) 1986, 87, 89, 92 - 95, 1998 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "cpplib.h"
static void memory_full (void) ATTRIBUTE_NORETURN;
static void
memory_full ()
{
fprintf (stderr, "%s: Memory exhausted.\n", progname);
exit (EXIT_FAILURE);
}
void *
xmalloc (size)
size_t size;
{
register void *ptr = malloc (size);
if (ptr == 0)
memory_full ();
return ptr;
}
void *
xcalloc (number, size)
size_t number, size;
{
register void *ptr = calloc (number, size);
if (ptr == 0)
memory_full ();
return ptr;
}
void *
xrealloc (old, size)
void *old;
size_t size;
{
register void *ptr;
if (old)
ptr = realloc (old, size);
else
ptr = malloc (size);
if (ptr == 0)
memory_full ();
return ptr;
}
char *
xstrdup (input)
const char *input;
{
unsigned size = strlen (input);
char *output = xmalloc (size + 1);
strcpy (output, input);
return output;
}

View File

@ -1,149 +0,0 @@
/* Default error handlers for CPP Library.
Copyright (C) 1986, 87, 89, 92 - 95, 1998 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef EMACS
#include "config.h"
#include "system.h"
#else
#include <stdio.h>
#endif /* not EMACS */
#include "cpplib.h"
/* Print the file names and line numbers of the #include
commands which led to the current file. */
void
cpp_print_containing_files (pfile)
cpp_reader *pfile;
{
cpp_buffer *ip;
int first = 1;
/* If stack of files hasn't changed since we last printed
this info, don't repeat it. */
if (pfile->input_stack_listing_current)
return;
ip = cpp_file_buffer (pfile);
/* Give up if we don't find a source file. */
if (ip == NULL)
return;
/* Find the other, outer source files. */
while ((ip = CPP_PREV_BUFFER (ip)), ip != CPP_NULL_BUFFER (pfile))
{
long line, col;
cpp_buf_line_and_col (ip, &line, &col);
if (ip->fname != NULL)
{
if (first)
{
first = 0;
fprintf (stderr, "In file included");
}
else
fprintf (stderr, ",\n ");
}
fprintf (stderr, " from %s:%ld", ip->nominal_fname, line);
}
if (! first)
fprintf (stderr, ":\n");
/* Record we have printed the status as of this time. */
pfile->input_stack_listing_current = 1;
}
void
cpp_file_line_for_message (pfile, filename, line, column)
cpp_reader *pfile ATTRIBUTE_UNUSED;
char *filename;
int line, column;
{
if (column > 0)
fprintf (stderr, "%s:%d:%d: ", filename, line, column);
else
fprintf (stderr, "%s:%d: ", filename, line);
}
/* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning */
void
v_cpp_message (pfile, is_error, msg, ap)
cpp_reader * pfile;
int is_error;
const char *msg;
va_list ap;
{
if (!is_error)
fprintf (stderr, "warning: ");
else if (is_error == 2)
pfile->errors = CPP_FATAL_LIMIT;
else if (pfile->errors < CPP_FATAL_LIMIT)
pfile->errors++;
vfprintf (stderr, msg, ap);
fprintf (stderr, "\n");
}
void
cpp_message (cpp_reader *pfile, int is_error, const char *msg, ...)
{
va_list ap;
va_start (ap, msg);
v_cpp_message(pfile, is_error, msg, ap);
va_end(ap);
}
/* Same as cpp_error, except we consider the error to be "fatal",
such as inconsistent options. I.e. there is little point in continuing.
(We do not exit, to support use of cpplib as a library.
Instead, it is the caller's responsibility to check
CPP_FATAL_ERRORS. */
void
cpp_fatal (cpp_reader *pfile, const char *str, ...)
{
va_list ap;
va_start (ap, str);
fprintf (stderr, "%s: ", progname);
v_cpp_message (pfile, 2, str, ap);
va_end(ap);
}
void
cpp_pfatal_with_name (pfile, name)
cpp_reader *pfile;
const char *name;
{
cpp_perror_with_name (pfile, name);
exit (EXIT_FAILURE);
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,200 +0,0 @@
/* Part of CPP library. (Macro hash table support.)
Copyright (C) 1986, 87, 89, 92-95, 1996, 1998 Free Software Foundation, Inc.
Written by Per Bothner, 1994.
Based on CCCP program by Paul Rubin, June 1986
Adapted to ANSI C, Richard Stallman, Jan 1987
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#include "config.h"
#include "system.h"
#include "cpplib.h"
#include "cpphash.h"
static HASHNODE *hashtab[HASHSIZE];
/* Return hash function on name. must be compatible with the one
computed a step at a time, elsewhere */
int
hashf (name, len, hashsize)
register const U_CHAR *name;
register int len;
int hashsize;
{
register int r = 0;
while (len--)
r = HASHSTEP (r, *name++);
return MAKE_POS (r) % hashsize;
}
/* Find the most recent hash node for name "name" (ending with first
non-identifier char) installed by install
If LEN is >= 0, it is the length of the name.
Otherwise, compute the length by scanning the entire name.
If HASH is >= 0, it is the precomputed hash code.
Otherwise, compute the hash code. */
HASHNODE *
cpp_lookup (pfile, name, len, hash)
cpp_reader *pfile ATTRIBUTE_UNUSED;
const U_CHAR *name;
int len;
int hash;
{
register const U_CHAR *bp;
register HASHNODE *bucket;
if (len < 0)
{
for (bp = name; is_idchar[*bp]; bp++) ;
len = bp - name;
}
if (hash < 0)
hash = hashf (name, len, HASHSIZE);
bucket = hashtab[hash];
while (bucket) {
if (bucket->length == len && strncmp (bucket->name, name, len) == 0)
return bucket;
bucket = bucket->next;
}
return (HASHNODE *) 0;
}
/*
* Delete a hash node. Some weirdness to free junk from macros.
* More such weirdness will have to be added if you define more hash
* types that need it.
*/
/* Note that the DEFINITION of a macro is removed from the hash table
but its storage is not freed. This would be a storage leak
except that it is not reasonable to keep undefining and redefining
large numbers of macros many times.
In any case, this is necessary, because a macro can be #undef'd
in the middle of reading the arguments to a call to it.
If #undef freed the DEFINITION, that would crash. */
void
delete_macro (hp)
HASHNODE *hp;
{
if (hp->prev != NULL)
hp->prev->next = hp->next;
if (hp->next != NULL)
hp->next->prev = hp->prev;
/* make sure that the bucket chain header that
the deleted guy was on points to the right thing afterwards. */
if (hp == *hp->bucket_hdr)
*hp->bucket_hdr = hp->next;
if (hp->type == T_MACRO)
{
DEFINITION *d = hp->value.defn;
struct reflist *ap, *nextap;
for (ap = d->pattern; ap != NULL; ap = nextap)
{
nextap = ap->next;
free (ap);
}
if (d->nargs >= 0)
free (d->args.argnames);
free (d);
}
free (hp);
}
/* Install a name in the main hash table, even if it is already there.
name stops with first non alphanumeric, except leading '#'.
caller must check against redefinition if that is desired.
delete_macro () removes things installed by install () in fifo order.
this is important because of the `defined' special symbol used
in #if, and also if pushdef/popdef directives are ever implemented.
If LEN is >= 0, it is the length of the name.
Otherwise, compute the length by scanning the entire name.
If HASH is >= 0, it is the precomputed hash code.
Otherwise, compute the hash code. */
HASHNODE *
install (name, len, type, ivalue, value, hash)
U_CHAR *name;
int len;
enum node_type type;
int ivalue;
char *value;
int hash;
{
register HASHNODE *hp;
register int i, bucket;
register U_CHAR *p;
if (len < 0) {
p = name;
while (is_idchar[*p])
p++;
len = p - name;
}
if (hash < 0)
hash = hashf (name, len, HASHSIZE);
i = sizeof (HASHNODE) + len + 1;
hp = (HASHNODE *) xmalloc (i);
bucket = hash;
hp->bucket_hdr = &hashtab[bucket];
hp->next = hashtab[bucket];
hashtab[bucket] = hp;
hp->prev = NULL;
if (hp->next != NULL)
hp->next->prev = hp;
hp->type = type;
hp->length = len;
if (hp->type == T_CONST)
hp->value.ival = ivalue;
else
hp->value.cpval = value;
hp->name = ((U_CHAR *) hp) + sizeof (HASHNODE);
copy_memory (name, hp->name, len);
hp->name[len] = 0;
return hp;
}
void
cpp_hash_cleanup (pfile)
cpp_reader *pfile ATTRIBUTE_UNUSED;
{
register int i;
for (i = HASHSIZE; --i >= 0; )
{
while (hashtab[i])
delete_macro (hashtab[i]);
}
}

View File

@ -1,53 +0,0 @@
/* Part of CPP library. (Macro hash table support.)
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* different kinds of things that can appear in the value field
of a hash node. Actually, this may be useless now. */
union hashval {
int ival;
char *cpval;
DEFINITION *defn;
};
struct hashnode {
struct hashnode *next; /* double links for easy deletion */
struct hashnode *prev;
struct hashnode **bucket_hdr; /* also, a back pointer to this node's hash
chain is kept, in case the node is the head
of the chain and gets deleted. */
enum node_type type; /* type of special token */
int length; /* length of token, for quick comparison */
U_CHAR *name; /* the actual name */
union hashval value; /* pointer to expansion, or whatever */
};
typedef struct hashnode HASHNODE;
/* Some definitions for the hash table. The hash function MUST be
computed as shown in hashf () below. That is because the rescan
loop computes the hash value `on the fly' for most tokens,
in order to avoid the overhead of a lot of procedure calls to
the hashf () function. Hashf () only exists for the sake of
politeness, for use when speed isn't so important. */
#define HASHSIZE 1403
#define HASHSTEP(old, c) ((old << 2) + c)
#define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */
extern HASHNODE *install (U_CHAR *,int,enum node_type, int,char *,int);
extern int hashf (const U_CHAR *, int, int);
extern void delete_macro (HASHNODE *);

File diff suppressed because it is too large Load Diff

View File

@ -1,737 +0,0 @@
/* Definitions for CPP library.
Copyright (C) 1995, 96-98, 1999 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef __GCC_CPPLIB__
#define __GCC_CPPLIB__
#include <sys/types.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef unsigned char U_CHAR;
typedef struct cpp_reader cpp_reader;
typedef struct cpp_buffer cpp_buffer;
typedef struct cpp_options cpp_options;
typedef struct hashnode cpp_hashnode;
enum cpp_token {
CPP_EOF = -1,
CPP_OTHER = 0,
CPP_COMMENT = 1,
CPP_HSPACE,
CPP_VSPACE, /* newlines and #line directives */
CPP_NAME,
CPP_NUMBER,
CPP_CHAR,
CPP_STRING,
CPP_DIRECTIVE,
CPP_LPAREN, /* "(" */
CPP_RPAREN, /* ")" */
CPP_LBRACE, /* "{" */
CPP_RBRACE, /* "}" */
CPP_COMMA, /* "," */
CPP_SEMICOLON,/* ";" */
CPP_3DOTS, /* "..." */
#if 0
CPP_ANDAND, /* "&&" */
CPP_OROR, /* "||" */
CPP_LSH, /* "<<" */
CPP_RSH, /* ">>" */
CPP_EQL, /* "==" */
CPP_NEQ, /* "!=" */
CPP_LEQ, /* "<=" */
CPP_GEQ, /* ">=" */
CPP_PLPL, /* "++" */
CPP_MINMIN, /* "--" */
#endif
/* POP_TOKEN is returned when we've popped a cpp_buffer. */
CPP_POP
};
typedef enum cpp_token (*parse_underflow_t) (cpp_reader *);
typedef int (*parse_cleanup_t) (cpp_buffer *, cpp_reader *);
/* A parse_marker indicates a previous position,
which we can backtrack to. */
struct parse_marker {
cpp_buffer *buf;
struct parse_marker *next;
int position;
};
extern void parse_set_mark (struct parse_marker *, cpp_reader *);
extern void parse_clear_mark (struct parse_marker *);
extern void parse_goto_mark (struct parse_marker *, cpp_reader *);
extern void parse_move_mark (struct parse_marker *, cpp_reader *);
extern int cpp_handle_option (cpp_reader *, int, char **);
extern int cpp_handle_options (cpp_reader *, int, char **);
extern enum cpp_token cpp_get_token (cpp_reader *);
extern void cpp_skip_hspace (cpp_reader *);
extern enum cpp_token cpp_get_non_space_token (cpp_reader *);
/* This frees resources used by PFILE. */
extern void cpp_cleanup (cpp_reader *PFILE);
/* If we have a huge buffer, may need to cache more recent counts */
#define CPP_LINE_BASE(BUF) ((BUF)->buf + (BUF)->line_base)
struct cpp_buffer {
unsigned char *buf;
unsigned char *cur;
unsigned char *rlimit; /* end of valid data */
unsigned char *alimit; /* end of allocated buffer */
unsigned char *prev; /* start of current token */
char *fname;
/* Filename specified with #line command. */
char *nominal_fname;
/* Actual directory of this file, used only for "" includes */
struct file_name_list *actual_dir;
/* Pointer into the include hash table. Used for include_next and
to record control macros.
->fname is an alias to ->ihash->fname. */
struct include_hash *ihash;
long line_base;
long lineno; /* Line number at CPP_LINE_BASE. */
long colno; /* Column number at CPP_LINE_BASE. */
parse_underflow_t underflow;
parse_cleanup_t cleanup;
void *data;
struct parse_marker *marks;
/* Value of if_stack at start of this file.
Used to prohibit unmatched #endif (etc) in an include file. */
struct if_stack *if_stack;
/* True if this is a header file included using <FILENAME>. */
char system_header_p;
char seen_eof;
/* True if buffer contains escape sequences.
Currently there are three kinds:
"@-" means following identifier should not be macro-expanded.
"@ " means a token-separator. This turns into " " in final output
if not stringizing and needed to separate tokens; otherwise nothing.
"@@" means a normal '@'.
(An '@' inside a string stands for itself and is never an escape.) */
char has_escapes;
};
struct cpp_pending; /* Forward declaration - for C++. */
struct file_name_map_list;
/* Maximum nesting of cpp_buffers. We use a static limit, partly for
efficiency, and partly to limit runaway recursion. */
#define CPP_STACK_MAX 200
/* A cpp_reader encapsulates the "state" of a pre-processor run.
Applying cpp_get_token repeatedly yields a stream of pre-processor
tokens. Usually, there is only one cpp_reader object active. */
struct cpp_reader
{
parse_underflow_t get_token;
cpp_buffer *buffer;
cpp_options *opts;
/* A buffer used for both for cpp_get_token's output, and also internally. */
unsigned char *token_buffer;
/* Allocated size of token_buffer. CPP_RESERVE allocates space. */
unsigned int token_buffer_size;
/* End of the written part of token_buffer. */
unsigned char *limit;
/* Error counter for exit code */
int errors;
/* Line where a newline was first seen in a string constant. */
int multiline_string_line;
/* Current depth in #include directives that use <...>. */
int system_include_depth;
/* Hash table of other included files. See cppfiles.c */
#define ALL_INCLUDE_HASHSIZE 71
struct include_hash *all_include_files[ALL_INCLUDE_HASHSIZE];
/* Chain of `actual directory' file_name_list entries,
for "" inclusion. */
struct file_name_list *actual_dirs;
/* Current maximum length of directory names in the search path
for include files. (Altered as we get more of them.) */
unsigned int max_include_len;
struct if_stack *if_stack;
/* Nonzero means we are inside an IF during a -pcp run. In this mode
macro expansion is done, and preconditions are output for all macro
uses requiring them. */
char pcp_inside_if;
/* Nonzero means we have printed (while error reporting) a list of
containing files that matches the current status. */
char input_stack_listing_current;
/* If non-zero, macros are not expanded. */
char no_macro_expand;
/* Print column number in error messages. */
char show_column;
/* We're printed a warning recommending against using #import. */
char import_warning;
/* If true, character between '<' and '>' are a single (string) token. */
char parsing_include_directive;
/* True if escape sequences (as described for has_escapes in
parse_buffer) should be emitted. */
char output_escapes;
/* 0: Have seen non-white-space on this line.
1: Only seen white space so far on this line.
2: Only seen white space so far in this file. */
char only_seen_white;
/* Nonzero means this file was included with a -imacros or -include
command line and should not be recorded as an include file. */
int no_record_file;
long lineno;
struct tm *timebuf;
/* Buffer of -M output. */
char *deps_buffer;
/* Number of bytes allocated in above. */
int deps_allocated_size;
/* Number of bytes used. */
int deps_size;
/* Number of bytes since the last newline. */
int deps_column;
#ifdef __cplusplus
~cpp_reader () { cpp_cleanup (this); }
#endif
cpp_buffer buffer_stack[CPP_STACK_MAX];
};
#define CPP_FATAL_LIMIT 1000
/* True if we have seen a "fatal" error. */
#define CPP_FATAL_ERRORS(READER) ((READER)->errors >= CPP_FATAL_LIMIT)
#define CPP_BUF_PEEK(BUFFER) \
((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur : EOF)
#define CPP_BUF_GET(BUFFER) \
((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF)
#define CPP_FORWARD(BUFFER, N) ((BUFFER)->cur += (N))
/* Macros for manipulating the token_buffer. */
#define CPP_OUT_BUFFER(PFILE) ((PFILE)->token_buffer)
/* Number of characters currently in PFILE's output buffer. */
#define CPP_WRITTEN(PFILE) ((size_t)((PFILE)->limit - (PFILE)->token_buffer))
#define CPP_PWRITTEN(PFILE) ((PFILE)->limit)
/* Make sure PFILE->token_buffer has space for at least N more characters. */
#define CPP_RESERVE(PFILE, N) \
(CPP_WRITTEN (PFILE) + (size_t)(N) > (PFILE)->token_buffer_size \
&& (cpp_grow_buffer (PFILE, N), 0))
/* Append string STR (of length N) to PFILE's output buffer.
Assume there is enough space. */
#define CPP_PUTS_Q(PFILE, STR, N) \
(bcopy (STR, (PFILE)->limit, (N)), (PFILE)->limit += (N))
/* Append string STR (of length N) to PFILE's output buffer. Make space. */
#define CPP_PUTS(PFILE, STR, N) CPP_RESERVE(PFILE, N), CPP_PUTS_Q(PFILE, STR,N)
/* Append character CH to PFILE's output buffer. Assume sufficient space. */
#define CPP_PUTC_Q(PFILE, CH) (*(PFILE)->limit++ = (CH))
/* Append character CH to PFILE's output buffer. Make space if need be. */
#define CPP_PUTC(PFILE, CH) (CPP_RESERVE (PFILE, 1), CPP_PUTC_Q (PFILE, CH))
/* Make sure PFILE->limit is followed by '\0'. */
#define CPP_NUL_TERMINATE_Q(PFILE) (*(PFILE)->limit = 0)
#define CPP_NUL_TERMINATE(PFILE) (CPP_RESERVE(PFILE, 1), *(PFILE)->limit = 0)
#define CPP_ADJUST_WRITTEN(PFILE,DELTA) ((PFILE)->limit += (DELTA))
#define CPP_SET_WRITTEN(PFILE,N) ((PFILE)->limit = (PFILE)->token_buffer + (N))
#define CPP_OPTIONS(PFILE) ((PFILE)->opts)
#define CPP_BUFFER(PFILE) ((PFILE)->buffer)
#define CPP_PREV_BUFFER(BUFFER) ((BUFFER)+1)
/* The bottom of the buffer stack. */
#define CPP_NULL_BUFFER(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX])
/* Pointed to by cpp_reader.opts. */
struct cpp_options {
char *in_fname;
/* Name of output file, for error messages. */
char *out_fname;
struct file_name_map_list *map_list;
/* Non-0 means -v, so print the full set of include dirs. */
char verbose;
/* Nonzero means use extra default include directories for C++. */
char cplusplus;
/* Nonzero means handle cplusplus style comments */
char cplusplus_comments;
/* Nonzero means handle #import, for objective C. */
char objc;
/* Nonzero means this is an assembly file, and allow
unknown directives, which could be comments. */
int lang_asm;
/* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */
char for_lint;
/* Nonzero means handle CHILL comment syntax
and output CHILL string delimiter for __DATE___ etc. */
char chill;
/* Nonzero means copy comments into the output file. */
char put_out_comments;
/* Nonzero means don't process the ANSI trigraph sequences. */
char no_trigraphs;
/* Nonzero means print the names of included files rather than
the preprocessed output. 1 means just the #include "...",
2 means #include <...> as well. */
char print_deps;
/* Nonzero if missing .h files in -M output are assumed to be generated
files and not errors. */
char print_deps_missing_files;
/* If true, fopen (deps_file, "a") else fopen (deps_file, "w"). */
char print_deps_append;
/* Nonzero means print names of header files (-H). */
char print_include_names;
/* Nonzero means try to make failure to fit ANSI C an error. */
char pedantic_errors;
/* Nonzero means don't print warning messages. -w. */
char inhibit_warnings;
/* Nonzero means warn if slash-star appears in a comment. */
char warn_comments;
/* Nonzero means warn if there are any trigraphs. */
char warn_trigraphs;
/* Nonzero means warn if #import is used. */
char warn_import;
/* Nonzero means warn if a macro argument is (or would be)
stringified with -traditional. */
char warn_stringify;
/* Nonzero means turn warnings into errors. */
char warnings_are_errors;
/* Nonzero causes output not to be done,
but directives such as #define that have side effects
are still obeyed. */
char no_output;
/* Nonzero means we should look for header.gcc files that remap file
names. */
char remap;
/* Nonzero means don't output line number information. */
char no_line_commands;
/* Nonzero means output the text in failing conditionals,
inside #failed ... #endfailed. */
char output_conditionals;
/* Nonzero means -I- has been seen,
so don't look for #include "foo" the source-file directory. */
char ignore_srcdir;
/* Zero means dollar signs are punctuation.
This used to be needed for conformance to the C Standard,
before the C Standard was corrected. */
char dollars_in_ident;
/* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */
char traditional;
/* Nonzero means warn if undefined identifiers are evaluated in an #if. */
char warn_undef;
/* Nonzero for the 1989 C Standard, including corrigenda and amendments. */
char c89;
/* Nonzero means give all the error messages the ANSI standard requires. */
char pedantic;
char done_initializing;
/* Search paths for include files. system_include, after_include are
only used during option parsing. */
struct file_name_list *quote_include; /* First dir to search for "file" */
struct file_name_list *bracket_include;/* First dir to search for <file> */
struct file_name_list *system_include; /* First dir with system headers */
struct file_name_list *after_include; /* Headers to search after system */
/* Directory prefix that should replace `/usr' in the standard
include file directories. */
char *include_prefix;
char inhibit_predefs;
char no_standard_includes;
char no_standard_cplusplus_includes;
/* dump_only means inhibit output of the preprocessed text
and instead output the definitions of all user-defined
macros in a form suitable for use as input to cccp.
dump_names means pass #define and the macro name through to output.
dump_definitions means pass the whole definition (plus #define) through
*/
enum {dump_none = 0, dump_only, dump_names, dump_definitions}
dump_macros;
/* Nonzero means pass all #define and #undef directives which we actually
process through to the output stream. This feature is used primarily
to allow cc1 to record the #defines and #undefs for the sake of
debuggers which understand about preprocessor macros, but it may
also be useful with -E to figure out how symbols are defined, and
where they are defined. */
int debug_output;
/* Nonzero means pass #include lines through to the output,
even if they are ifdefed out. */
int dump_includes;
/* Pending -D, -U and -A options, in reverse order. */
struct cpp_pending *pending;
/* File name which deps are being written to.
This is 0 if deps are being written to stdout. */
char *deps_file;
/* Target-name to write with the dependency information. */
char *deps_target;
};
#define CPP_TRADITIONAL(PFILE) (CPP_OPTIONS(PFILE)-> traditional)
#define CPP_WARN_UNDEF(PFILE) (CPP_OPTIONS(PFILE)->warn_undef)
#define CPP_C89(PFILE) (CPP_OPTIONS(PFILE)->c89)
#define CPP_PEDANTIC(PFILE) (CPP_OPTIONS (PFILE)->pedantic)
#define CPP_PRINT_DEPS(PFILE) (CPP_OPTIONS (PFILE)->print_deps)
/* List of directories to look for include files in. */
struct file_name_list
{
struct file_name_list *next;
struct file_name_list *alloc; /* for the cache of
current directory entries */
char *name;
unsigned int nlen;
/* We use these to tell if the directory mentioned here is a duplicate
of an earlier directory on the search path. */
ino_t ino;
dev_t dev;
/* If the following is nonzero, it is a C-language system include
directory. */
int sysp;
/* Mapping of file names for this directory.
Only used on MS-DOS and related platforms. */
struct file_name_map *name_map;
};
#define ABSOLUTE_PATH ((struct file_name_list *)-1)
/* This structure is used for the table of all includes. It is
indexed by the `short name' (the name as it appeared in the
#include statement) which is stored in *nshort. */
struct include_hash
{
struct include_hash *next;
/* Next file with the same short name but a
different (partial) pathname). */
struct include_hash *next_this_file;
/* Location of the file in the include search path.
Used for include_next */
struct file_name_list *foundhere;
char *name; /* (partial) pathname of file */
char *nshort; /* name of file as referenced in #include */
char *control_macro; /* macro, if any, preventing reinclusion - see
redundant_include_p */
char *buf, *limit; /* for file content cache, not yet implemented */
};
/* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found
via the same directory as the file that #included it. */
#define SELF_DIR_DUMMY ((struct file_name_list *) (~0))
/* Name under which this program was invoked. */
extern char *progname;
/* The structure of a node in the hash table. The hash table
has entries for all tokens defined by #define commands (type T_MACRO),
plus some special tokens like __LINE__ (these each have their own
type, and the appropriate code is run when that type of node is seen.
It does not contain control words like "#define", which are recognized
by a separate piece of code. */
/* different flavors of hash nodes --- also used in keyword table */
enum node_type {
T_DEFINE = 1, /* the `#define' keyword */
T_INCLUDE, /* the `#include' keyword */
T_INCLUDE_NEXT, /* the `#include_next' keyword */
T_IMPORT, /* the `#import' keyword */
T_IFDEF, /* the `#ifdef' keyword */
T_IFNDEF, /* the `#ifndef' keyword */
T_IF, /* the `#if' keyword */
T_ELSE, /* `#else' */
T_PRAGMA, /* `#pragma' */
T_ELIF, /* `#elif' */
T_UNDEF, /* `#undef' */
T_LINE, /* `#line' */
T_ERROR, /* `#error' */
T_WARNING, /* `#warning' */
T_ENDIF, /* `#endif' */
T_SCCS, /* `#sccs', used on system V. */
T_IDENT, /* `#ident', used on system V. */
T_ASSERT, /* `#assert', taken from system V. */
T_UNASSERT, /* `#unassert', taken from system V. */
T_SPECLINE, /* special symbol `__LINE__' */
T_DATE, /* `__DATE__' */
T_FILE, /* `__FILE__' */
T_BASE_FILE, /* `__BASE_FILE__' */
T_INCLUDE_LEVEL, /* `__INCLUDE_LEVEL__' */
T_VERSION, /* `__VERSION__' */
T_SIZE_TYPE, /* `__SIZE_TYPE__' */
T_PTRDIFF_TYPE, /* `__PTRDIFF_TYPE__' */
T_WCHAR_TYPE, /* `__WCHAR_TYPE__' */
T_REGISTER_PREFIX_TYPE, /* `__REGISTER_PREFIX__' */
T_TIME, /* `__TIME__' */
T_CONST, /* Constant value, used by `__STDC__' */
T_MACRO, /* macro defined by `#define' */
T_DISABLED, /* macro temporarily turned off for rescan */
T_SPEC_DEFINED, /* special `defined' macro for use in #if statements */
T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */
T_UNUSED /* Used for something not defined. */
};
/* Structure returned by create_definition */
typedef struct macrodef MACRODEF;
struct macrodef
{
struct definition *defn;
unsigned char *symnam;
int symlen;
};
/* Structure allocated for every #define. For a simple replacement
such as
#define foo bar ,
nargs = -1, the `pattern' list is null, and the expansion is just
the replacement text. Nargs = 0 means a functionlike macro with no args,
e.g.,
#define getchar() getc (stdin) .
When there are args, the expansion is the replacement text with the
args squashed out, and the reflist is a list describing how to
build the output from the input: e.g., "3 chars, then the 1st arg,
then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg".
The chars here come from the expansion. Whatever is left of the
expansion after the last arg-occurrence is copied after that arg.
Note that the reflist can be arbitrarily long---
its length depends on the number of times the arguments appear in
the replacement text, not how many args there are. Example:
#define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and
pattern list
{ (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL }
where (x, y) means (nchars, argno). */
typedef struct definition DEFINITION;
struct definition {
int nargs;
int length; /* length of expansion string */
int predefined; /* True if the macro was builtin or */
/* came from the command line */
unsigned char *expansion;
int line; /* Line number of definition */
char *file; /* File of definition */
char rest_args; /* Nonzero if last arg. absorbs the rest */
struct reflist {
struct reflist *next;
char stringify; /* nonzero if this arg was preceded by a
# operator. */
char raw_before; /* Nonzero if a ## operator before arg. */
char raw_after; /* Nonzero if a ## operator after arg. */
char rest_args; /* Nonzero if this arg. absorbs the rest */
int nchars; /* Number of literal chars to copy before
this arg occurrence. */
int argno; /* Number of arg to substitute (origin-0) */
} *pattern;
union {
/* Names of macro args, concatenated in reverse order
with comma-space between them.
The only use of this is that we warn on redefinition
if this differs between the old and new definitions. */
unsigned char *argnames;
} args;
};
extern unsigned char is_idchar[256];
extern unsigned char is_hor_space[256];
extern unsigned char is_space[256];
/* Stack of conditionals currently in progress
(including both successful and failing conditionals). */
struct if_stack {
struct if_stack *next; /* for chaining to the next stack frame */
char *fname; /* copied from input when frame is made */
int lineno; /* similarly */
int if_succeeded; /* true if a leg of this if-group
has been passed through rescan */
unsigned char *control_macro; /* For #ifndef at start of file,
this is the macro name tested. */
enum node_type type; /* type of last directive seen in this group */
};
typedef struct if_stack IF_STACK_FRAME;
/* Find the largest host integer type and set its size and type.
Watch out: on some crazy hosts `long' is shorter than `int'. */
#ifndef HOST_WIDE_INT
#include "machmode.h"
#endif
extern void cpp_buf_line_and_col (cpp_buffer *, long *, long *);
extern cpp_buffer* cpp_file_buffer (cpp_reader *);
extern void cpp_define (cpp_reader*, unsigned char *);
extern void cpp_error (cpp_reader *, const char *, ...)
ATTRIBUTE_PRINTF_2;
extern void cpp_warning (cpp_reader *, const char *, ...)
ATTRIBUTE_PRINTF_2;
extern void cpp_pedwarn (cpp_reader *, const char *, ...)
ATTRIBUTE_PRINTF_2;
extern void cpp_error_with_line (cpp_reader *, int, int, const char *, ...)
ATTRIBUTE_PRINTF_4;
extern void cpp_pedwarn_with_line (cpp_reader *, int, int, const char *, ...)
ATTRIBUTE_PRINTF_4;
extern void cpp_pedwarn_with_file_and_line (cpp_reader *, char *, int, const char *, ...)
ATTRIBUTE_PRINTF_4;
extern void cpp_message_from_errno (cpp_reader *, int, const char *);
extern void cpp_error_from_errno (cpp_reader *, const char *);
extern void cpp_perror_with_name (cpp_reader *, const char *);
extern void v_cpp_message (cpp_reader *, int, const char *, va_list);
extern void cpp_grow_buffer (cpp_reader *, long);
extern HOST_WIDE_INT cpp_parse_escape (cpp_reader *, char **, HOST_WIDE_INT);
extern cpp_buffer *cpp_push_buffer (cpp_reader *,
unsigned char *, long);
extern cpp_buffer *cpp_pop_buffer (cpp_reader *);
extern cpp_hashnode *cpp_lookup (cpp_reader *, const unsigned char *,
int, int);
extern void cpp_reader_init (cpp_reader *);
extern void cpp_options_init (cpp_options *);
extern int cpp_start_read (cpp_reader *, char *);
extern int cpp_read_check_assertion (cpp_reader *);
extern int scan_decls (cpp_reader *, int, char **);
extern void skip_rest_of_line (cpp_reader *);
extern void cpp_finish (cpp_reader *);
/* From cpperror.c */
extern void cpp_fatal (cpp_reader *, const char *, ...)
ATTRIBUTE_PRINTF_2;
extern void cpp_message (cpp_reader *, int, const char *, ...)
ATTRIBUTE_PRINTF_3;
extern void cpp_pfatal_with_name (cpp_reader *, const char *);
extern void cpp_file_line_for_message (cpp_reader *, char *, int, int);
extern void cpp_print_containing_files (cpp_reader *);
/* In cppfiles.c */
extern void append_include_chain (cpp_reader *,
struct file_name_list **,
const char *, int);
extern void merge_include_chains (struct cpp_options *);
extern int find_include_file (cpp_reader *, char *,
struct file_name_list *,
struct include_hash **,
int *);
extern int finclude (cpp_reader *, int,
struct include_hash *);
extern void deps_output (cpp_reader *, char *, int);
extern struct include_hash *include_hash (cpp_reader *, char *, int);
#ifndef INCLUDE_LEN_FUDGE
#define INCLUDE_LEN_FUDGE 0
#endif
#ifdef __cplusplus
}
#endif
#endif /* __GCC_CPPLIB__ */

View File

@ -1,112 +0,0 @@
/* CPP main program, using CPP Library.
Copyright (C) 1995, 1997, 1998 Free Software Foundation, Inc.
Written by Per Bothner, 1994-95.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2, or (at your option) any
later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
In other words, you are welcome to use, share and improve this program.
You are forbidden to forbid anyone else to use, share and improve
what you give them. Help stamp out software-hoarding! */
#ifndef EMACS
#include "config.h"
#include "system.h"
#else
#include <stdio.h>
extern char *getenv ();
#endif /* not EMACS */
#include "cpplib.h"
char *progname;
cpp_reader parse_in;
cpp_options options;
#ifdef abort
/* More 'friendly' abort that prints the line and file.
config.h can #define abort fancy_abort if you like that sort of thing. */
void
fatal (s)
char *s;
{
fputs (s, stderr);
exit (EXIT_FAILURE);
}
void
fancy_abort ()
{
fatal ("Internal gcc abort.");
}
#endif
int
main (argc, argv)
int argc;
char **argv;
{
char *p;
int argi = 1; /* Next argument to handle. */
struct cpp_options *opts = &options;
p = argv[0] + strlen (argv[0]);
while (p != argv[0] && p[-1] != '/') --p;
progname = p;
cpp_reader_init (&parse_in);
parse_in.opts = opts;
cpp_options_init (opts);
argi += cpp_handle_options (&parse_in, argc - argi , argv + argi);
if (argi < argc && ! CPP_FATAL_ERRORS (&parse_in))
cpp_fatal (&parse_in, "Invalid option `%s'", argv[argi]);
if (CPP_FATAL_ERRORS (&parse_in))
exit (EXIT_FAILURE);
parse_in.show_column = 1;
if (! cpp_start_read (&parse_in, opts->in_fname))
exit (EXIT_FAILURE);
/* Now that we know the input file is valid, open the output. */
if (!opts->out_fname || !strcmp (opts->out_fname, ""))
opts->out_fname = "stdout";
else if (! freopen (opts->out_fname, "w", stdout))
cpp_pfatal_with_name (&parse_in, opts->out_fname);
for (;;)
{
enum cpp_token kind;
if (! opts->no_output)
{
fwrite (parse_in.token_buffer, 1, CPP_WRITTEN (&parse_in), stdout);
}
CPP_SET_WRITTEN (&parse_in, 0);
kind = cpp_get_token (&parse_in);
if (kind == CPP_EOF)
break;
}
cpp_finish (&parse_in);
if (parse_in.errors)
exit (EXIT_FAILURE);
exit (EXIT_SUCCESS);
}

View File

@ -1,14 +0,0 @@
# Build libgcc1.a for a cross-compiler.
# By default this expects the user to provide libgcc1.a,
# and gives up immediately if the user has not done so.
LIBGCC1 = $(CROSS_LIBGCC1)
# Dir to search for system headers. Normally /usr/include.
# Use CROSS_INCLUDE_DIR not TOOL_INCLUDE_DIR for other vendor's headers.
SYSTEM_HEADER_DIR = $(tooldir)/sys-include
# Don't try to compile the things we can't compile.
ALL = all.cross
# Don't install assert.h in /usr/local/include.
assertdir = $(tooldir)/include

View File

@ -1 +0,0 @@
timestamp

View File

@ -8666,17 +8666,6 @@ gen_compile_unit_die (main_input_filename)
sprintf (producer, "%s %s", language_string, version_string);
#ifdef MIPS_DEBUGGING_INFO
/* The MIPS/SGI compilers place the 'cc' command line options in the producer
string. The SGI debugger looks for -g, -g1, -g2, or -g3; if they do
not appear in the producer string, the debugger reaches the conclusion
that the object file is stripped and has no debugging information.
To get the MIPS/SGI debugger to believe that there is debugging
information in the object file, we add a -g to the producer string. */
if (debug_info_level > DINFO_LEVEL_TERSE)
strcat (producer, " -g");
#endif
add_AT_string (comp_unit_die, DW_AT_producer, producer);
if (strcmp (language_string, "GNU C++") == 0)

File diff suppressed because it is too large Load Diff

View File

@ -1,109 +0,0 @@
#!/bin/sh
#
# NAME:
# fixcpp - fix CPP errors
#
# SYNOPSIS:
# fixcpp [-c][-p patch_file][-b bak_dir][-n new_dir] files(s)
#
# DESCRIPTION:
# For each named file, use sed(1) to fixup any descriptive
# text after #else or #endif or that is not properly
# commented as this causes ANSI compilers to generate
# unnecessary warnings.
#
# Naturally this script is not guaranteed to be bullet
# proof, use of -n or -b is advisable!
#
# -c causes fixcpp to make sure that only files that
# needed changing are affected by returning the original
# file to its original location if no changes were needed.
#
# -p causes fixcpp to append to a patch file the context
# diffs of the changes wrought.
#
# SEE ALSO:
# sed(1)
#
# AMENDED:
# 90/08/08 22:46:32 (sjg)
#
# RELEASED:
# 90/08/08 22:46:34 v1.4
#
# SCCSID:
# @(#)fixcpp.sh 1.4 90/08/08 22:46:32 (sjg)
#
# @(#)Copyright (c) 1990 Simon J. Gerraty
#
# This is free software. It comes with NO WARRANTY.
# Everyone is granted permission to copy, modify and
# redistribute this source code provided that all
# recipients are given similar rights, and that the above
# copyright notice and this notice are preserved in all
# copies.
TMPF=/tmp/fixcpp.$$
NEWDIR=
BAKDIR=
PATCHF=
CHECK=
set -- `getopt "cp:b:n:" $*`
if [ $? != 0 ]; then
echo "$0 [-c][-p patch_file][-b bakup_dir][-n new_dir] file [file ...]" >&2
exit 1
fi
for i in $*
do
case $i in
-c) CHECK=yes; shift;;
-p) PATCHF=$2; shift 2;;
-b) BAKDIR=$2; shift 2;;
-n) NEWDIR=$2; shift 2;;
--) shift; break;;
esac
done
NEWDIR=${NEWDIR:-.}
if [ $BAKDIR ]; then
if [ ! -d $BAKDIR ]; then
echo "$0: no such directory -- $BAKDIR" >&2
exit 1
fi
fi
for i in $*
do
if [ $BAKDIR ]; then
mv $i $BAKDIR
infile=$BAKDIR/$i
else
if [ "$NEWDIR" = "." ]; then
mv $i ${TMPF}
infile=${TMPF}
else
infile=$i
fi
fi
sed -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ][^\*].*\);#\1/* \2 */;' -e 's;^#\([ ]*e[nl][^ ]*[ ][ ]*\)\([^/ ]\)$;#\1/* \2 */;' $infile >${NEWDIR}/$i
if [ "${CHECK}" = "yes" -o ${PATCHF} ]; then
if cmp -s $infile ${NEWDIR}/$i ; then
if [ "${CHECK}" = "yes" ]; then
if [ $BAKDIR ]; then
mv $infile ${NEWDIR}/$i
else
rm ${NEWDIR}/$i
fi
fi
else
if [ $PATCHF ]; then
diff -c $infile ${NEWDIR}/$i >> ${PATCHF}
fi
fi
fi
done
rm -f ${TMPF}

View File

@ -87,14 +87,6 @@ extern int warn_inline;
extern int warn_uninitialized;
/* Zero if unknown pragmas are ignored
One if the compiler should warn about an unknown pragma not in
a system include file.
Greater than one if the compiler should warn for all unknown
pragmas. */
extern int warn_unknown_pragmas;
/* Nonzero means warn about all declarations which shadow others. */
extern int warn_shadow;
@ -154,10 +146,6 @@ extern int flag_print_asm_name;
/* Now the symbols that are set with `-f' switches. */
/* Nonzero means `char' should be signed. */
extern int flag_signed_char;
/* Nonzero means give an enum type only as many bytes as it needs. */
extern int flag_short_enums;
@ -376,10 +364,6 @@ extern int flag_verbose_asm;
extern int flag_debug_asm;
/* -fgnu-linker specifies use of the GNU linker for initializations.
-fno-gnu-linker says that collect will be used. */
extern int flag_gnu_linker;
/* CYGNUS LOCAL unaligned-struct-hack */
/* This is a hack. Disable the effect of SLOW_BYTE_ACCESS, so that references
to aligned fields inside of unaligned structures can work. That is, we

4191
gcc/gcc.1

File diff suppressed because it is too large Load Diff

5093
gcc/gcc.c

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,269 +0,0 @@
#!/bin/sh
# Generates multilib.h.
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
#This file is part of GNU CC.
#GNU CC is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2, or (at your option)
#any later version.
#GNU CC is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with GNU CC; see the file COPYING. If not, write to
#the Free Software Foundation, 59 Temple Place - Suite 330,
#Boston, MA 02111-1307, USA.
# This shell script produces a header file which the gcc driver
# program uses to pick which library to use based on the machine
# specific options that it is given.
# The first argument is a list of sets of options. The elements in
# the list are separated by spaces. Within an element, the options
# are separated by slashes. No leading dash is used on the options.
# Each option in a set is mutually incompatible with all other options
# in the set.
# The optional second argument is a list of subdirectory names. If
# the second argument is non-empty, there must be as many elements in
# the second argument as there are options in the first argument. The
# elements in the second list are separated by spaces. If the second
# argument is empty, the option names will be used as the directory
# names.
# The optional third argument is a list of options which are
# identical. The elements in the list are separated by spaces. Each
# element must be of the form OPTION=OPTION. The first OPTION should
# appear in the first argument, and the second should be a synonym for
# it. Question marks are replaced with equal signs in both options.
# The optional fourth argument is a list of multilib directory
# combinations that should not be built.
# The optional fifth argument is a list of options that should be
# used whenever building multilib libraries.
# The output looks like
# #define MULTILIB_MATCHES "\
# SUBDIRECTORY OPTIONS;\
# ...
# "
# The SUBDIRECTORY is the subdirectory to use. The OPTIONS are
# multiple options separated by spaces. Each option may start with an
# exclamation point. gcc will consider each line in turn. If none of
# the options beginning with an exclamation point are present, and all
# of the other options are present, that subdirectory will be used.
# The order of the subdirectories is such that they can be created in
# order; that is, a subdirectory is preceded by all its parents.
# Here is a example (this is simplified from the actual 680x0 case):
# genmultilib "m68000/m68020 msoft-float" "m68000 m68020 msoft-float"
# "m68000=mc68000"
# This produces:
# ". !m68000 !mc68000 !m68020 !msoft-float;",
# "m68000 m68000 !m68020 !msoft-float;",
# "m68000 mc60000 !m68020 !msoft-float;",
# "m68020 !m68000 !mc68000 m68020 !msoft-float;",
# "msoft-float !m68000 !mc68000 !m68020 msoft-float;",
# "m68000/msoft-float m68000 !m68020 msoft-float;",
# "m68000/msoft-float mc68000 !m68020 msoft-float;",
# "m68020/msoft-float !m68000 !mc68000 m68020 msoft-float;",
#
# The effect is that `gcc -msoft-float' (for example) will append
# msoft-float to the directory name when searching for libraries or
# startup files, and `gcc -m68000 -msoft-float' (for example) will
# append m68000/msoft-float.
# Copy the positional parameters into variables.
options=$1
dirnames=$2
matches=$3
exceptions=$4
extra=$5
echo "static char *multilib_raw[] = {"
# What we want to do is select all combinations of the sets in
# options. Each combination which includes a set of mutually
# exclusive options must then be output multiple times, once for each
# item in the set. Selecting combinations is a recursive process.
# Since not all versions of sh support functions, we achieve recursion
# by creating a temporary shell script which invokes itself.
rm -f tmpmultilib
cat >tmpmultilib <<\EOF
#!/bin/sh
# This recursive script basically outputs all combinations of its
# input arguments, handling mutually exclusive sets of options by
# repetition. When the script is called, ${initial} is the list of
# options which should appear before all combinations this will
# output. The output looks like a list of subdirectory names with
# leading and trailing slashes.
if [ "$#" != "0" ]; then
first=$1
shift
for opt in `echo $first | sed -e 's|/| |'g`; do
echo ${initial}${opt}/
done
./tmpmultilib $@
for opt in `echo $first | sed -e 's|/| |'g`; do
initial="${initial}${opt}/" ./tmpmultilib $@
done
fi
EOF
chmod +x tmpmultilib
combinations=`initial=/ ./tmpmultilib ${options}`
rm -f tmpmultilib
# If there exceptions, weed them out now
if [ -n "${exceptions}" ]; then
rm -f tmpmultilib2
cat >tmpmultilib2 <<\EOF
#!/bin/sh
# This recursive script weeds out any combination of multilib
# switches that should not be generated. The output looks like
# a list of subdirectory names with leading and trailing slashes.
for opt in $@; do
case "$opt" in
EOF
for except in ${exceptions}; do
echo " /${except}/) : ;;" >> tmpmultilib2
done
cat >>tmpmultilib2 <<\EOF
*) echo ${opt};;
esac
done
EOF
chmod +x tmpmultilib2
combinations=`./tmpmultilib2 ${combinations}`
rm -f ./tmpmultilib2
fi
# Construct a sed pattern which will convert option names to directory
# names.
todirnames=
if [ -n "${dirnames}" ]; then
set x ${dirnames}
shift
for set in ${options}; do
for opt in `echo ${set} | sed -e 's|/| |'g`; do
if [ "$1" != "${opt}" ]; then
todirnames="${todirnames} -e s|/${opt}/|/${1}/|g"
fi
shift
done
done
fi
# We need another recursive shell script to correctly handle positive
# matches. If we are invoked as
# genmultilib "opt1 opt2" "" "opt1=nopt1 opt2=nopt2"
# we must output
# opt1/opt2 opt1 opt2
# opt1/opt2 nopt1 opt2
# opt1/opt2 opt1 nopt2
# opt1/opt2 nopt1 nopt2
# In other words, we must output all combinations of matches.
rm -f tmpmultilib2
cat >tmpmultilib2 <<\EOF
#!/bin/sh
# The positional parameters are a list of matches to consider.
# ${dirout} is the directory name and ${optout} is the current list of
# options.
if [ "$#" = "0" ]; then
echo "\"${dirout} ${optout};\","
else
first=$1
shift
dirout="${dirout}" optout="${optout}" ./tmpmultilib2 $@
l=`echo ${first} | sed -e 's/=.*$//' -e 's/?/=/g'`
r=`echo ${first} | sed -e 's/^.*=//' -e 's/?/=/g'`
if expr " ${optout} " : ".* ${l} .*" > /dev/null; then
newopt=`echo " ${optout} " | sed -e "s/ ${l} / ${r} /" -e 's/^ //' -e 's/ $//'`
dirout="${dirout}" optout="${newopt}" ./tmpmultilib2 $@
fi
fi
EOF
chmod +x tmpmultilib2
# Start with the current directory, which includes only negations.
optout=
for set in ${options}; do
for opt in `echo ${set} | sed -e 's|/| |'g`; do
optout="${optout} !${opt}"
done
done
optout=`echo ${optout} | sed -e 's/^ //'`
echo "\". ${optout};\","
# Work over the list of combinations. We have to translate each one
# to use the directory names rather than the option names, we have to
# include the information in matches, and we have to generate the
# correct list of options and negations.
for combo in ${combinations}; do
# Use the directory names rather than the option names.
if [ -n "${todirnames}" ]; then
dirout=`echo ${combo} | sed ${todirnames}`
else
dirout=${combo}
fi
# Remove the leading and trailing slashes.
dirout=`echo ${dirout} | sed -e 's|^/||' -e 's|/$||g'`
# Look through the options. We must output each option that is
# present, and negate each option that is not present.
optout=
for set in ${options}; do
setopts=`echo ${set} | sed -e 's|/| |g'`
for opt in ${setopts}; do
if expr "${combo} " : ".*/${opt}/.*" > /dev/null; then
optout="${optout} ${opt}"
else
optout="${optout} !${opt}"
fi
done
done
optout=`echo ${optout} | sed -e 's/^ //'`
# Output the line with all appropriate matches.
dirout="${dirout}" optout="${optout}" ./tmpmultilib2
done
# Terminate the list of string.
echo "NULL"
echo "};"
# Output all of the matches now as option and that is the same as that, with
# a semicolon trailer. Include all of the normal options as well.
# Note, the format of the matches is reversed compared
# to what we want, so switch them around.
echo ""
echo "static char *multilib_matches_raw[] = {"
for match in ${matches}; do
l=`echo ${match} | sed -e 's/=.*$//' -e 's/?/=/g'`
r=`echo ${match} | sed -e 's/^.*=//' -e 's/?/=/g'`
echo "\"${r} ${l};\","
done
for set in ${options}; do
for opt in `echo ${set} | sed -e 's|/| |'g`; do
echo "\"${opt} ${opt};\","
done
done
echo "NULL"
echo "};"
# Output the default options now
echo ""
echo "static char *multilib_extra = \"${extra}\";"
rm -f tmpmultilib2
exit 0

View File

@ -21,22 +21,14 @@
#define UCHAR_MAX 255
/* Minimum and maximum values a `char' can hold. */
#ifdef __CHAR_UNSIGNED__
#undef CHAR_MIN
#define CHAR_MIN 0
#undef CHAR_MAX
#define CHAR_MAX 255
#else
#undef CHAR_MIN
#define CHAR_MIN (-128)
#undef CHAR_MAX
#define CHAR_MAX 127
#endif
/* Minimum and maximum values a `signed short int' can hold. */
#undef SHRT_MIN
/* For the sake of 16 bit hosts, we may not use -32768 */
#define SHRT_MIN (-32767-1)
#define SHRT_MIN -32768
#undef SHRT_MAX
#define SHRT_MAX 32767

View File

@ -19,10 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef IN_GCC
#include <ansidecl.h>
#endif /* ! IN_GCC */
#include "obstack.h"
typedef enum {false, true} boolean;

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +0,0 @@
@setfilename INSTALL
@set INSTALLONLY
@c This file itself, install1.texi, does not appear in the GCC distribution.
@c The immediately following lines apply to the INSTALL file
@c which is generated using this file.
This file documents the installation of the GNU compiler.
Copyright (C) 1988, 1989, 1992, 1994, 1995 Free Software Foundation, Inc.
You may copy, distribute, and modify it freely as long as you preserve
this copyright notice and permission notice.
@node Installation,,, (dir)
@chapter Installing GNU CC
@include install.texi
@bye

File diff suppressed because it is too large Load Diff

View File

@ -1,227 +0,0 @@
#!/bin/sh -f
# Generate a source code listing for C or C++ code with assembler code. The
# listing is always written to stdout.
# Author: Igor Metz <metz@iam.unibe.ch>
# Revision 1.4 94/08/26 13:58:27 coxs <coxs@dg-rtp.dg.com>
# lister now guesses how to should be configured. Added elf and coff support.
#
# Revision 1.3 89/12/18 13:58:27 metz
# lister must now be configured before it can be used. This is done in the
# /bin/sh part of the code.
#
#
# Revision 1.2 89/08/16 17:35:02 metz
# Support for SPARC added.
#
# Revision 1.1 89/08/16 16:49:22 metz
# Initial revision
#
# Requires: gawk (may be it works also with nawk)
# usage: lister filename [compiler-options]
# Method:
# compile the source with -g option to assembler code, then merge the
# generated assembler code with the source code. Compiler options
# can be supplied on the command line (for example -O)
# To install lister, assign one of the supported values to the variable MYSYS:
# mc68020 for Motorola 68020 (Sun-3, ..)
# mc68030 for Motorola 68030 (Sun-3, ..)
# sparc for SPARC (SUN-4, ..)
# i386 for i386 (Sun i386, ...)
# i386-gnu-linux for i386 (GNU/Linux, ...)
# Guess what kind of objects we are creating and thus what type of assembler
# symbols to look for
ex /tmp/$$.c <<END >/dev/null
a
main (){}
.
w
q
END
WD=`pwd`
cd /tmp
gcc -c $$.c
case "`file $$.o`" in
*ELF*) MYSYS=elf ;;
*COFF*|*BCS*) MYSYS=coff ;;
*mc68k*|*M68000*) MYSYS=mc68030 ;;
*SPARC*) MYSYS=sparc ;;
*386*) MYSYS=i386 ;;
esac
rm $$.c $$.o
cd $WD
# uncomment the line you need if the above guesses incorrectly:
# MYSYS=mc68020
# MYSYS=mc68030
# MYSYS=sparc
# MYSYS=i386
# MYSYS=i386-gnu-linux
# MYSYS=`mach` # this will work on Suns with SunOS > 4.0.0
# MYSYS=elf
# MYSYS=coff
WHOAMI=$0
if [ $# -gt 0 ] ; then
FILENAME=$1
shift
fi
exec gawk -v whoami=$WHOAMI -vsys=$MYSYS -voptions="$*" '
# commandline arguments:
# ARGV[0] = "gawk"
# ARGV[1] = processid
# ARGV[2] = filename
BEGIN {
if (ARGC != 3) {
usage()
exit 1
}
# Declaration of global variables
c_filename = ""
asm_filename = ""
cmdline = ""
asm_code = ""
c_code = ""
c_lineno = 0
oldlineno = 0
newlineno = 0
ignore_stabd = 0
num_of_fields = 0
# check processor architecture and set sourcecode line_hint accordingly
if (sys == "sparc" || sys == "i386") {
line_hint = "^[ \t]*\.stabn.*"
line_field = 3;
line_delimiter = ",";
line_offset = 0;
}
else if (sys == "mc68020" || sys == "mc68030" || sys == "i386-gnu-linux") {
line_hint = "^[ \t]*\.stabd.*"
line_field = 3;
line_delimiter = ",";
line_offset = 0;
}
else if (sys == "elf") {
line_hint = "section.*\.line"
line_field = 3;
line_delimiter = "\t";
line_offset = 0;
}
else if (sys == "coff") {
line_hint = "^[ \t]*ln"
line_field = 3;
line_delimiter = "\t";
}
else {
error("Processor type " sys " is not supported yet, sorry")
}
parse_cmdline()
printf("compiling %s to asm code\n", c_filename ) > "/dev/stderr"
if (system(cmdline) != 0 ) {
error("Compilation of " c_filename " failed")
}
printf("generating listing\n") > "/dev/stderr"
while ( getline asm_code < asm_filename > 0 ) {
if ( (ignore_stabd==0) && (asm_code ~ line_hint)) {
while ( sys == "elf" && (asm_code !~ "word" && asm_code !~ "byte") &&
getline asm_code < asm_filename > 0);
# source line hint found. Split the line into fields separated by commas.
# num_of_fields is 4 for sparc, 3 for m68k
num_of_fields = split(asm_code, fields, line_delimiter)
newlineno = fields[line_field] + line_offset;
if (newlineno > oldlineno) {
while ( newlineno > c_lineno && getline c_code < c_filename > 0) {
c_lineno++
printf("%4d %s\n", c_lineno, c_code)
}
oldlineno = newlineno
}
}
else if ( asm_code ~ ".*Ltext[ \t]*$" ) {
# filename hint found
if ( match(asm_code, c_filename)) {
ignore_stabd = 0
}
else {
ignore_stabd = 1
}
}
else if ( sys == "elf" && asm_code ~ "section.*\.debug" ) {
while ( asm_code !~ "^[ \t]*[.]*previous" &&
asm_code !~ "\.popsection" &&
getline asm_code < asm_filename > 0 );
if ( ! (getline asm_code < asm_filename > 0)) break;
}
else if ( sys == "coff" && asm_code ~ "^[ \t]*sdef" ) {
if ( asm_code ~ "\.bf" ) {
while ( asm_code !~ "^[ \t]*line" &&
getline asm_code < asm_filename > 0 ) {
num_of_fields = split(asm_code, fields, "\t")
line_offset = fields[line_field] - 1;
}
}
while ( asm_code !~ "^[ \t]*endef" &&
getline asm_code < asm_filename > 0 ) {
}
if ( ! (getline asm_code < asm_filename > 0)) break;
}
printf("\t\t\t%s\n", asm_code)
}
# general cleanup
system("/bin/rm " asm_filename)
}
function usage() {
printf("usage: %s filename compiler-options\n", whoami) > "/dev/stderr"
}
function error(s) {
printf("error: %s\n", s) > "/dev/stderr"
exit 1
}
function parse_cmdline( i) {
# construct filenames to use
asm_filename = "/tmp/lister" ARGV[1] ".s"
ARGV[1] = ""
c_filename = ARGV[2]
ARGV[2] = ""
# construct commandline to use
if ( match(c_filename, ".C") || match(c_filename, ".cc") ) {
cmdline = "g++"
}
else if (match(c_filename, ".c") || match(c_filename, ".i")) {
cmdline = "gcc"
}
else {
error("unknown extension for file " c_filename)
}
cmdline = cmdline " -g -S -o " asm_filename
# now we append the compiler options specified by the user
cmdline = cmdline " " options
# last but not least: the name of the file to compile
cmdline = cmdline " " c_filename
}
' $$ $FILENAME

View File

@ -1,290 +0,0 @@
/* Multibyte Character Functions.
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* These functions are used to manipulate multibyte characters. */
/* Note regarding cross compilation:
In general translation of multibyte characters to wide characters can
only work in a native compiler since the translation function (mbtowc)
needs to know about both the source and target character encoding. However,
this particular implementation for JIS, SJIS and EUCJP source characters
will work for any compiler with a newlib target. Other targets may also
work provided that their wchar_t implementation is 2 bytes and the encoding
leaves the source character values unchanged (except for removing the
state shifting markers). */
#ifdef MULTIBYTE_CHARS
#include "config.h"
#include "system.h"
#include "mbchar.h"
#include <locale.h>
typedef enum
{
ESCAPE, DOLLAR, BRACKET, AT, B, J, NUL, JIS_CHAR, OTHER, JIS_C_NUM
} JIS_CHAR_TYPE;
typedef enum
{
ASCII, A_ESC, A_ESC_DL, JIS, JIS_1, JIS_2, J_ESC, J_ESC_BR,
J2_ESC, J2_ESC_BR, INV, JIS_S_NUM
} JIS_STATE;
typedef enum
{
COPYA, COPYJ, COPYJ2, MAKE_A, MAKE_J, NOOP, EMPTY, ERROR
} JIS_ACTION;
/*****************************************************************************
* state/action tables for processing JIS encoding
* Where possible, switches to JIS are grouped with proceding JIS characters
* and switches to ASCII are grouped with preceding JIS characters.
* Thus, maximum returned length is:
* 2 (switch to JIS) + 2 (JIS characters) + 2 (switch back to ASCII) = 6.
*****************************************************************************/
static JIS_STATE JIS_state_table[JIS_S_NUM][JIS_C_NUM] = {
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER*/
/*ASCII*/ { A_ESC, ASCII, ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
/*A_ESC*/ { ASCII, A_ESC_DL,ASCII, ASCII, ASCII, ASCII, ASCII,ASCII,ASCII},
/*A_ESC_DL*/{ ASCII, ASCII, ASCII, JIS, JIS, ASCII, ASCII,ASCII,ASCII},
/*JIS*/ { J_ESC, JIS_1, JIS_1, JIS_1, JIS_1, JIS_1, INV, JIS_1,INV },
/*JIS_1*/ { INV, JIS_2, JIS_2, JIS_2, JIS_2, JIS_2, INV, JIS_2,INV },
/*JIS_2*/ { J2_ESC,JIS, JIS, JIS, JIS, JIS, INV, JIS, JIS },
/*J_ESC*/ { INV, INV, J_ESC_BR, INV, INV, INV, INV, INV, INV },
/*J_ESC_BR*/{ INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
/*J2_ESC*/ { INV, INV, J2_ESC_BR,INV, INV, INV, INV, INV, INV },
/*J2_ESC_BR*/{INV, INV, INV, INV, ASCII, ASCII, INV, INV, INV },
};
static JIS_ACTION JIS_action_table[JIS_S_NUM][JIS_C_NUM] = {
/* ESCAPE DOLLAR BRACKET AT B J NUL JIS_CHAR OTHER */
/*ASCII */ {NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, EMPTY, COPYA, COPYA},
/*A_ESC */ {COPYA, NOOP, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA, COPYA},
/*A_ESC_DL */{COPYA, COPYA, COPYA, MAKE_J, MAKE_J, COPYA, COPYA, COPYA, COPYA},
/*JIS */ {NOOP, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR },
/*JIS_1 */ {ERROR, NOOP, NOOP, NOOP, NOOP, NOOP, ERROR, NOOP, ERROR },
/*JIS_2 */ {NOOP, COPYJ2,COPYJ2,COPYJ2, COPYJ2, COPYJ2,ERROR, COPYJ2,COPYJ2},
/*J_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR },
/*J_ESC_BR */{ERROR, ERROR, ERROR, ERROR, NOOP, NOOP, ERROR, ERROR, ERROR },
/*J2_ESC */ {ERROR, ERROR, NOOP, ERROR, ERROR, ERROR, ERROR, ERROR, ERROR },
/*J2_ESC_BR*/{ERROR, ERROR, ERROR, ERROR, COPYJ, COPYJ, ERROR, ERROR, ERROR },
};
char *literal_codeset = NULL;
int
local_mbtowc (pwc, s, n)
wchar_t *pwc;
const char *s;
size_t n;
{
static JIS_STATE save_state = ASCII;
JIS_STATE curr_state = save_state;
unsigned char *t = (unsigned char *)s;
if (s != NULL && n == 0)
return -1;
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
{
/* This must be the "C" locale or unknown locale -- fall thru */
}
else if (! strcmp (literal_codeset, "C-SJIS"))
{
int char1;
if (s == NULL)
return 0; /* not state-dependent */
char1 = *t;
if (ISSJIS1 (char1))
{
int char2 = t[1];
if (n <= 1)
return -1;
if (ISSJIS2 (char2))
{
if (pwc != NULL)
*pwc = (((wchar_t)*t) << 8) + (wchar_t)(*(t+1));
return 2;
}
return -1;
}
if (pwc != NULL)
*pwc = (wchar_t)*t;
if (*t == '\0')
return 0;
return 1;
}
else if (! strcmp (literal_codeset, "C-EUCJP"))
{
int char1;
if (s == NULL)
return 0; /* not state-dependent */
char1 = *t;
if (ISEUCJP (char1))
{
int char2 = t[1];
if (n <= 1)
return -1;
if (ISEUCJP (char2))
{
if (pwc != NULL)
*pwc = (((wchar_t)*t) << 8) + (wchar_t)(*(t+1));
return 2;
}
return -1;
}
if (pwc != NULL)
*pwc = (wchar_t)*t;
if (*t == '\0')
return 0;
return 1;
}
else if (! strcmp (literal_codeset, "C-JIS"))
{
JIS_ACTION action;
JIS_CHAR_TYPE ch;
unsigned char *ptr;
int i, curr_ch;
if (s == NULL)
{
save_state = ASCII;
return 1; /* state-dependent */
}
ptr = t;
for (i = 0; i < n; ++i)
{
curr_ch = t[i];
switch (curr_ch)
{
case JIS_ESC_CHAR:
ch = ESCAPE;
break;
case '$':
ch = DOLLAR;
break;
case '@':
ch = AT;
break;
case '(':
ch = BRACKET;
break;
case 'B':
ch = B;
break;
case 'J':
ch = J;
break;
case '\0':
ch = NUL;
break;
default:
if (ISJIS (curr_ch))
ch = JIS_CHAR;
else
ch = OTHER;
}
action = JIS_action_table[curr_state][ch];
curr_state = JIS_state_table[curr_state][ch];
switch (action)
{
case NOOP:
break;
case EMPTY:
if (pwc != NULL)
*pwc = (wchar_t)0;
save_state = curr_state;
return i;
case COPYA:
if (pwc != NULL)
*pwc = (wchar_t)*ptr;
save_state = curr_state;
return (i + 1);
case COPYJ:
if (pwc != NULL)
*pwc = (((wchar_t)*ptr) << 8) + (wchar_t)(*(ptr+1));
save_state = curr_state;
return (i + 1);
case COPYJ2:
if (pwc != NULL)
*pwc = (((wchar_t)*ptr) << 8) + (wchar_t)(*(ptr+1));
save_state = curr_state;
return (ptr - t) + 2;
case MAKE_A:
case MAKE_J:
ptr = (char *)(t + i + 1);
break;
case ERROR:
default:
return -1;
}
}
return -1; /* n < bytes needed */
}
#ifdef CROSS_COMPILE
if (s == NULL)
return 0; /* not state-dependent */
if (pwc != NULL)
*pwc = *s;
return 1;
#else
/* This must be the "C" locale or unknown locale. */
return mbtowc (pwc, s, n);
#endif
}
int
local_mblen (s, n)
const char *s;
size_t n;
{
return local_mbtowc (NULL, s, n);
}
int
local_mb_cur_max ()
{
if (literal_codeset == NULL || strlen (literal_codeset) <= 1)
;
else if (! strcmp (literal_codeset, "C-SJIS"))
return 2;
else if (! strcmp (literal_codeset, "C-EUCJP"))
return 2;
else if (! strcmp (literal_codeset, "C-JIS"))
return 8; /* 3 + 2 + 3 */
#ifdef CROSS_COMPILE
return 1;
#else
if (MB_CUR_MAX > 0)
return MB_CUR_MAX;
return 1; /* default */
#endif
}
#endif /* MULTIBYTE_CHARS */

View File

@ -1,41 +0,0 @@
/* mbchar.h - Various declarations for functions found in mbchar.c
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU CC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU CC; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef __GCC_MBCHAR_H__
#define __GCC_MBCHAR_H__
#ifdef MULTIBYTE_CHARS
/* escape character used for JIS encoding */
#define JIS_ESC_CHAR 0x1b
#define ISSJIS1(c) ((c) >= 0x81 && (c) <= 0x9f || (c) >= 0xe0 && (c) <= 0xef)
#define ISSJIS2(c) ((c) >= 0x40 && (c) <= 0x7e || (c) >= 0x80 && (c) <= 0xfc)
#define ISEUCJP(c) ((c) >= 0xa1 && (c) <= 0xfe)
#define ISJIS(c) ((c) >= 0x21 && (c) <= 0x7e)
int local_mbtowc (wchar_t *, const char *, size_t);
int local_mblen (const char *, size_t);
int local_mb_cur_max (void);
/* The locale being used for multibyte characters in string/char literals. */
extern char *literal_codeset;
#endif /* MULTIBYTE_CHARS */
#endif /* __GCC_MBCHAR_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1.1.1 1999/01/13 23:06:47 law Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp" 1>&2
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

View File

@ -1,317 +0,0 @@
/* Utility to update paths from internal to external forms.
Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This file contains routines to update a path, both to canonicalize
the directory format and to handle any prefix translation.
This file must be compiled with -DPREFIX= to specify the "prefix"
value used by configure. If a filename does not begin with this
prefix, it will not be affected other than by directory canonicalization.
Each caller of 'update_path' may specify both a filename and
a translation prefix and consist of the name of the package that contains
the file ("@GCC", "@BINUTIL", "@GNU", etc).
If the prefix is not specified, the filename will only undergo
directory canonicalization.
If it is specified, the string given by PREFIX will be replaced
by the specified prefix (with a '@' in front unless the prefix begins
with a '$') and further translation will be done as follows
until none of the two conditions below are met:
1) If the filename begins with '@', the string between the '@' and
the end of the name or the first '/' or directory separator will
be considered a "key" and looked up as follows:
-- If this is a Win32 OS, then the Registry will be examined for
an entry of "key" in
HKEY_LOCAL_MACHINE\SOFTWARE\Free Software Foundation\
if found, that value will be used.
-- If not found (or not a Win32 OS), the environment variable
key_ROOT (the value of "key" concatenated with the constant "_ROOT")
is tried. If that fails, then PREFIX (see above) is used.
2) If the filename begins with a '$', the rest of the string up
to the end or the first '/' or directory separator will be used
as an environment variable, whose value will be returned.
Once all this is done, any '/' will be converted to DIR_SEPARATOR,
if they are different.
NOTE: using resolve_keyed_path under Win32 requires linking with
advapi32.dll. */
#include "config.h"
#include "system.h"
#ifdef _WIN32
#include <windows.h>
#endif
#include "prefix.h"
static const char *std_prefix = PREFIX;
static const char *get_key_value (char *);
static const char *translate_name (const char *);
static char *save_string (const char *, int);
#ifdef _WIN32
static char *lookup_key (char *);
static HKEY reg_key = (HKEY) INVALID_HANDLE_VALUE;
#endif
/* Given KEY, as above, return its value. */
static const char *
get_key_value (key)
char *key;
{
const char *prefix = 0;
char *temp = 0;
#ifdef _WIN32
prefix = lookup_key (key);
#endif
if (prefix == 0)
prefix = getenv (temp = concat (key, "_ROOT", NULL));
if (prefix == 0)
prefix = std_prefix;
if (temp)
free (temp);
return prefix;
}
/* Concatenate a sequence of strings, returning the result.
This function is based on the one in libiberty. */
char *
concat (const char *first, ...)
{
register int length;
register char *newstr;
register char *end;
register const char *arg;
va_list args;
/* First compute the size of the result and get sufficient memory. */
va_start (args, first);
arg = first;
length = 0;
while (arg != 0)
{
length += strlen (arg);
arg = va_arg (args, const char *);
}
newstr = (char *) malloc (length + 1);
va_end (args);
/* Now copy the individual pieces to the result string. */
va_start (args, first);
end = newstr;
arg = first;
while (arg != 0)
{
while (*arg)
*end++ = *arg++;
arg = va_arg (args, const char *);
}
*end = '\000';
va_end (args);
return (newstr);
}
/* Return a copy of a string that has been placed in the heap. */
static char *
save_string (s, len)
const char *s;
int len;
{
register char *result = xmalloc (len + 1);
copy_memory (s, result, len);
result[len] = 0;
return result;
}
#ifdef _WIN32
/* Look up "key" in the registry, as above. */
static char *
lookup_key (key)
char *key;
{
char *dst;
DWORD size;
DWORD type;
LONG res;
if (reg_key == (HKEY) INVALID_HANDLE_VALUE)
{
res = RegOpenKeyExA (HKEY_LOCAL_MACHINE, "SOFTWARE", 0,
KEY_READ, &reg_key);
if (res == ERROR_SUCCESS)
res = RegOpenKeyExA (reg_key, "Free Software Foundation", 0,
KEY_READ, &reg_key);
if (res != ERROR_SUCCESS)
{
reg_key = (HKEY) INVALID_HANDLE_VALUE;
return 0;
}
}
size = 32;
dst = (char *) malloc (size);
res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
if (res == ERROR_MORE_DATA && type == REG_SZ)
{
dst = (char *) realloc (dst, size);
res = RegQueryValueExA (reg_key, key, 0, &type, dst, &size);
}
if (type != REG_SZ || res != ERROR_SUCCESS)
{
free (dst);
dst = 0;
}
return dst;
}
#endif
/* If NAME starts with a '@' or '$', apply the translation rules above
and return a new name. Otherwise, return the given name. */
static const char *
translate_name (name)
const char *name;
{
char code = name[0];
char *key;
const char *prefix = 0;
int keylen;
if (code != '@' && code != '$')
return name;
for (keylen = 0;
(name[keylen + 1] != 0 && name[keylen + 1] != '/'
#ifdef DIR_SEPARATOR
&& name[keylen + 1] != DIR_SEPARATOR
#endif
);
keylen++)
;
key = (char *) alloca (keylen + 1);
strncpy (key, &name[1], keylen);
key[keylen] = 0;
name = &name[keylen + 1];
if (code == '@')
{
prefix = get_key_value (key);
if (prefix == 0)
prefix = std_prefix;
}
else
prefix = getenv (key);
if (prefix == 0)
prefix = PREFIX;
/* Remove any trailing directory separator from what we got. */
if (prefix[strlen (prefix) - 1] == '/'
#ifdef DIR_SEPARATOR
|| prefix[strlen (prefix) - 1] == DIR_SEPARATOR
#endif
)
{
char * temp = save_string (prefix, strlen (prefix));
temp[strlen (temp) - 1] = 0;
prefix = temp;
}
return concat (prefix, name, NULL);
}
/* Update PATH using KEY if PATH starts with PREFIX. */
const char *
update_path (path, key)
const char *path;
const char *key;
{
if (! strncmp (path, std_prefix, strlen (std_prefix)) && key != 0)
{
if (key[0] != '$')
key = concat ("@", key, NULL);
path = concat (key, &path[strlen (std_prefix)], NULL);
while (path[0] == '@' || path[0] == '$')
path = translate_name (path);
}
#ifdef DIR_SEPARATOR
if (DIR_SEPARATOR != '/')
{
int i;
int len = strlen (path);
path = save_string (path, len);
for (i = 0; i < len; i++)
if (path[i] == '/')
path[i] = DIR_SEPARATOR;
}
#endif
return path;
}
/* Reset the standard prefix */
void
set_std_prefix (prefix, len)
const char *prefix;
int len;
{
std_prefix = save_string (prefix, len);
}

View File

@ -1,28 +0,0 @@
/* Provide prototypes for functions exported from prefix.c.
Copyright (C) 1999 Free Software Foundation, Inc.
This file is part of GNU CC.
GNU CC is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
GCC is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifndef __GCC_PREFIX_H__
#define __GCC_PREFIX_H__
extern const char *update_path (const char *, const char *);
extern void set_std_prefix (const char *, int);
#endif /* ! __GCC_PREFIX_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -23,31 +23,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
Lewis, Harry R. and Denenberg, Larry. Data Structures and Their
Algorithms. Harper-Collins, Inc. 1991. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#include "libiberty.h"
#include "splay-tree.h"
static void splay_tree_delete_helper PARAMS((splay_tree,
splay_tree_node));
static void splay_tree_splay PARAMS((splay_tree,
splay_tree_key));
static void splay_tree_delete_helper (splay_tree, splay_tree_node);
static void splay_tree_splay (splay_tree, splay_tree_key);
static splay_tree_node splay_tree_splay_helper
PARAMS((splay_tree,
(splay_tree,
splay_tree_key,
splay_tree_node*,
splay_tree_node*,
splay_tree_node*));
static int splay_tree_foreach_helper PARAMS((splay_tree,
splay_tree_node*);
static int splay_tree_foreach_helper (splay_tree,
splay_tree_node,
splay_tree_foreach_fn,
void*));
void*);
/* Deallocate NODE (a member of SP), and all its sub-trees. */

View File

@ -30,12 +30,6 @@ Boston, MA 02111-1307, USA. */
#ifndef _SPLAY_TREE_H
#define _SPLAY_TREE_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include <ansidecl.h>
/* Use typedefs for the key and data types to facilitate changing
these types, if necessary. These types should be sufficiently wide
that any pointer or scalar can be cast to these types, and then
@ -48,18 +42,18 @@ typedef struct splay_tree_node *splay_tree_node;
/* The type of a function which compares two splay-tree keys. The
function should return values as for qsort. */
typedef int (*splay_tree_compare_fn) PARAMS((splay_tree_key, splay_tree_key));
typedef int (*splay_tree_compare_fn) (splay_tree_key, splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the key. */
typedef void (*splay_tree_delete_key_fn) PARAMS((splay_tree_key));
typedef void (*splay_tree_delete_key_fn) (splay_tree_key);
/* The type of a function used to deallocate any resources associated
with the value. */
typedef void (*splay_tree_delete_value_fn) PARAMS((splay_tree_value));
typedef void (*splay_tree_delete_value_fn) (splay_tree_value);
/* The type of a function used to iterate over the tree. */
typedef int (*splay_tree_foreach_fn) PARAMS((splay_tree_node, void*));
typedef int (*splay_tree_foreach_fn) (splay_tree_node, void*);
/* The nodes in the splay tree. */
struct splay_tree_node
@ -91,22 +85,18 @@ typedef struct splay_tree
splay_tree_delete_value_fn delete_value;
} *splay_tree;
extern splay_tree splay_tree_new PARAMS((splay_tree_compare_fn,
extern splay_tree splay_tree_new (splay_tree_compare_fn,
splay_tree_delete_key_fn,
splay_tree_delete_value_fn));
extern void splay_tree_delete PARAMS((splay_tree));
extern void splay_tree_insert PARAMS((splay_tree,
splay_tree_delete_value_fn);
extern void splay_tree_delete (splay_tree);
extern void splay_tree_insert (splay_tree,
splay_tree_key,
splay_tree_value));
splay_tree_value);
extern splay_tree_node splay_tree_lookup
PARAMS((splay_tree,
splay_tree_key));
extern int splay_tree_foreach PARAMS((splay_tree,
(splay_tree,
splay_tree_key);
extern int splay_tree_foreach (splay_tree,
splay_tree_foreach_fn,
void*));
#ifdef __cplusplus
}
#endif /* __cplusplus */
void*);
#endif /* _SPLAY_TREE_H */

View File

@ -102,6 +102,9 @@ Boston, MA 02111-1307, USA. */
#define _(String) String
#define N_(String) String
#include "libiberty.h"
extern void *xmalloc (size_t);
extern void *xrealloc (void *, size_t);
extern void *xcalloc (size_t, size_t);
extern char *xstrdup (const char *);
#endif /* __GCC_SYSTEM_H__ */

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,6 @@ extern int size_directive_output;
extern tree last_assemble_variable_decl;
extern void check_line_directive();
extern void cpplib_init();
extern char *init_parse (char *);
extern void finish_parse ();
@ -569,15 +568,6 @@ int flag_verbose_asm = 0;
int flag_debug_asm = 0;
/* -fgnu-linker specifies use of the GNU linker for initializations.
(Or, more generally, a linker that handles initializations.)
-fno-gnu-linker says that collect2 will be used. */
#ifdef USE_COLLECT2
int flag_gnu_linker = 0;
#else
int flag_gnu_linker = 1;
#endif
/* CYGNUS LOCAL unaligned-struct-hack */
/* This is a hack. Disable the effect of SLOW_BYTE_ACCESS, so that references
to aligned fields inside of unaligned structures can work. That is, we
@ -755,8 +745,6 @@ lang_independent_options f_options[] =
"place data items into their own section" },
{"verbose-asm", &flag_verbose_asm, 1,
"Add extra commentry to assembler output"},
{"gnu-linker", &flag_gnu_linker, 1,
"Output GNU ld formatted global initialisers"},
/* CYGNUS LOCAL unaligned-struct-hack */
{"unaligned-struct-hack", &flag_unaligned_struct_hack, 1,
"Assume structure fields may be unaligned" },
@ -797,8 +785,8 @@ lang_independent_options f_options[] =
static struct lang_opt
{
char * option;
char * description;
char *option;
char *description;
}
documented_lang_options[] =
{
@ -815,10 +803,6 @@ documented_lang_options[] =
{ "-funsigned-bitfields","Make bitfields by unsigned by default" },
{ "-fno-signed-bitfields", "" },
{ "-fno-unsigned-bitfields","" },
{ "-fsigned-char", "Make 'char' be signed by default"},
{ "-funsigned-char", "Make 'char' be unsigned by default"},
{ "-fno-signed-char", "" },
{ "-fno-unsigned-char", "" },
{ "-ftraditional", "" },
{ "-traditional", "Attempt to support traditional K&R style C"},
@ -836,8 +820,6 @@ documented_lang_options[] =
{ "-fno-freestanding", "" },
{ "-fcond-mismatch", "Allow different types as args of ? operator"},
{ "-fno-cond-mismatch", "" },
{ "-fdollars-in-identifiers", "Allow the use of $ inside indentifiers" },
{ "-fno-dollars-in-identifiers", "" },
{ "-fident", "" },
{ "-fno-ident", "Ignore #ident directives" },
{ "-fshort-double", "Use the same size for double as for float" },
@ -899,42 +881,14 @@ documented_lang_options[] =
{ "-Wno-redundant-decls", "" },
{ "-Wsign-compare", "Warn about signed/unsigned comparisons" },
{ "-Wno-sign-compare", "" },
{ "-Wunknown-pragmas", "Warn about unrecognised pragmas" },
{ "-Wno-unknown-pragmas", "" },
{ "-Wstrict-prototypes", "Warn about non-prototyped function decls" },
{ "-Wno-strict-prototypes", "" },
{ "-Wtraditional", "Warn about constructs whose meaning change in ANSI C"},
{ "-Wno-traditional", "" },
{ "-Wtrigraphs", "Warn when trigraphs are encountered" },
{ "-Wno-trigraphs", "" },
{ "-Wundef", "" },
{ "-Wno-undef", "" },
{ "-Wwrite-strings", "Mark strings as 'const char *'"},
{ "-Wno-write-strings", "" },
/* These are for languages with USE_CPPLIB. */
/* These options are already documented in cpplib.c */
{ "--help", "" },
{ "-A", "" },
{ "-D", "" },
{ "-I", "" },
{ "-U", "" },
{ "-H", "" },
{ "-idirafter", "" },
{ "-imacros", "" },
{ "-include", "" },
{ "-iprefix", "" },
{ "-isystem", "" },
{ "-iwithprefix", "" },
{ "-iwithprefixbefore", "" },
{ "-lang-c", "" },
{ "-lang-c89", "" },
{ "-lang-c++", "" },
{ "-remap", "" },
{ "-nostdinc", "" },
{ "-nostdinc++", "" },
{ "-trigraphs", "" },
{ "-undef", "" }
};
/* Here is a table, controlled by the tm.h file, listing each -m switch
@ -3679,6 +3633,8 @@ display_help ()
unsigned long i;
char * lang;
printf ("Usage: %s input [switches]\n", progname);
printf ("Switches:\n");
printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
@ -3944,15 +3900,11 @@ main (argc, argv)
decl_printable_name = decl_name;
lang_expand_expr = (lang_expand_expr_t) do_abort;
/* Initialize whether `char' is signed. */
flag_signed_char = DEFAULT_SIGNED_CHAR;
#ifdef DEFAULT_SHORT_ENUMS
/* Initialize how much space enums occupy, by default. */
flag_short_enums = DEFAULT_SHORT_ENUMS;
#endif
cpplib_init();
/* Scan to see what optimization level has been specified. That will
determine the default value of many flags. */
for (i = 1; i < argc; i++)
@ -4035,6 +3987,12 @@ main (argc, argv)
for (i = 1; i < argc; i++)
{
if (!strcmp (argv[i], "--help"))
{
display_help ();
exit (0);
}
size_t j;
/* If this is a language-specific option,
@ -4045,16 +4003,7 @@ main (argc, argv)
if (j != (size_t)-1)
{
int strings_processed = c_decode_option (argc - i, argv + i);
if (!strcmp (argv[i], "--help"))
{
display_help ();
exit (0);
}
if (strings_processed != 0)
i += strings_processed - 1;
c_decode_option (argv[i]);
}
else if (argv[i][0] == '-' && argv[i][1] != 0)
{
@ -4571,7 +4520,9 @@ print_version (file, indent)
{
fprintf (file, "%s%s%s version %s", indent, *indent != 0 ? " " : "",
language_string, version_string);
fprintf (file, " (%s)", TARGET_NAME);
char *target_name = "thumb-elf";
fprintf (file, " (%s)", target_name);
#ifdef __GNUC__
#ifndef __VERSION__
#define __VERSION__ "[unknown]"

View File

@ -42,7 +42,6 @@ Boston, MA 02111-1307, USA. */
#include "real.h"
#include "toplev.h"
#include "obstack.h"
#include "c-pragma.h"
#ifndef TRAMPOLINE_ALIGNMENT
@ -4087,25 +4086,9 @@ declare_weak (decl)
/* Emit any pending weak declarations. */
#ifdef HANDLE_PRAGMA_WEAK
struct weak_syms * weak_decls;
#endif
void
weak_finish ()
{
#ifdef HANDLE_PRAGMA_WEAK
if (HANDLE_PRAGMA_WEAK)
{
struct weak_syms *t;
for (t = weak_decls; t; t = t->next)
{
ASM_WEAKEN_LABEL (asm_out_file, t->name);
if (t->value)
ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
}
}
#endif
}
void

View File

@ -1,482 +0,0 @@
GNU LIBRARY GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the library GPL. It is
numbered 2 because it goes with version 2 of the ordinary GPL.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Library General Public License, applies to some
specially designated Free Software Foundation software, and to any
other libraries whose authors decide to use it. You can use it for
your libraries, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if
you distribute copies of the library, or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link a program with the library, you must provide
complete object files to the recipients so that they can relink them
with the library, after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
Our method of protecting your rights has two steps: (1) copyright
the library, and (2) offer you this license which gives you legal
permission to copy, distribute and/or modify the library.
Also, for each distributor's protection, we want to make certain
that everyone understands that there is no warranty for this free
library. If the library is modified by someone else and passed on, we
want its recipients to know that what they have is not the original
version, so that any problems introduced by others will not reflect on
the original authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that companies distributing free
software will individually obtain patent licenses, thus in effect
transforming the program into proprietary software. To prevent this,
we have made it clear that any patent must be licensed for everyone's
free use or not licensed at all.
Most GNU software, including some libraries, is covered by the ordinary
GNU General Public License, which was designed for utility programs. This
license, the GNU Library General Public License, applies to certain
designated libraries. This license is quite different from the ordinary
one; be sure to read it in full, and don't assume that anything in it is
the same as in the ordinary license.
The reason we have a separate public license for some libraries is that
they blur the distinction we usually make between modifying or adding to a
program and simply using it. Linking a program with a library, without
changing the library, is in some sense simply using the library, and is
analogous to running a utility program or application program. However, in
a textual and legal sense, the linked executable is a combined work, a
derivative of the original library, and the ordinary General Public License
treats it as such.
Because of this blurred distinction, using the ordinary General
Public License for libraries did not effectively promote software
sharing, because most developers did not use the libraries. We
concluded that weaker conditions might promote sharing better.
However, unrestricted linking of non-free programs would deprive the
users of those programs of all benefit from the free status of the
libraries themselves. This Library General Public License is intended to
permit developers of non-free programs to use free libraries, while
preserving your freedom as a user of such programs to change the free
libraries that are incorporated in them. (We have not seen how to achieve
this as regards changes in header files, but we have achieved it as regards
changes in the actual functions of the Library.) The hope is that this
will lead to faster development of free libraries.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, while the latter only
works together with the library.
Note that it is possible for a library to be covered by the ordinary
General Public License rather than by this special one.
GNU LIBRARY GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library which
contains a notice placed by the copyright holder or other authorized
party saying it may be distributed under the terms of this Library
General Public License (also called "this License"). Each licensee is
addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also compile or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
c) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
d) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the source code distributed need not include anything that is normally
distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Library General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,203 +0,0 @@
/* Utility to pick a temporary filename prefix.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This file exports two functions: choose_temp_base and make_temp_file. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h> /* May get P_tmpdir. */
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h> /* May get R_OK, etc. on some systems. */
#endif
#ifndef R_OK
#define R_OK 4
#define W_OK 2
#define X_OK 1
#endif
#include "libiberty.h"
extern int mkstemps ();
#ifndef IN_GCC
#if defined (__MSDOS__) || defined (_WIN32)
#define DIR_SEPARATOR '\\'
#endif
#endif
#ifndef DIR_SEPARATOR
#define DIR_SEPARATOR '/'
#endif
/* On MSDOS, write temp files in current dir
because there's no place else we can expect to use. */
/* ??? Although the current directory is tried as a last resort,
this is left in so that on MSDOS it is preferred to /tmp on the
off chance that someone requires this, since that was the previous
behaviour. */
#ifdef __MSDOS__
#ifndef P_tmpdir
#define P_tmpdir "."
#endif
#endif
/* Name of temporary file.
mktemp requires 6 trailing X's. */
#define TEMP_FILE "ccXXXXXX"
/* Subroutine of choose_temp_base.
If BASE is non-NULL, return it.
Otherwise it checks if DIR is a usable directory.
If success, DIR is returned.
Otherwise NULL is returned. */
static char *
try (dir, base)
char *dir, *base;
{
if (base != 0)
return base;
if (dir != 0
&& access (dir, R_OK | W_OK | X_OK) == 0)
return dir;
return 0;
}
/* Return a prefix for temporary file names or NULL if unable to find one.
The current directory is chosen if all else fails so the program is
exited if a temporary directory can't be found (mktemp fails).
The buffer for the result is obtained with xmalloc.
This function is provided for backwards compatability only. It use
is not recommended. */
char *
choose_temp_base ()
{
char *base = 0;
char *temp_filename;
int len;
static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
base = try (getenv ("TMPDIR"), base);
base = try (getenv ("TMP"), base);
base = try (getenv ("TEMP"), base);
#ifdef P_tmpdir
base = try (P_tmpdir, base);
#endif
/* Try /usr/tmp, then /tmp. */
base = try (usrtmp, base);
base = try (tmp, base);
/* If all else fails, use the current directory! */
if (base == 0)
base = ".";
len = strlen (base);
temp_filename = xmalloc (len + 1 /*DIR_SEPARATOR*/
+ strlen (TEMP_FILE) + 1);
strcpy (temp_filename, base);
if (len != 0
&& temp_filename[len-1] != '/'
&& temp_filename[len-1] != DIR_SEPARATOR)
temp_filename[len++] = DIR_SEPARATOR;
strcpy (temp_filename + len, TEMP_FILE);
mktemp (temp_filename);
if (strlen (temp_filename) == 0)
abort ();
return temp_filename;
}
/* Return a temporary file name (as a string) or NULL if unable to create
one. */
char *
make_temp_file (suffix)
char *suffix;
{
char *base = 0;
char *temp_filename;
int base_len, suffix_len;
int fd;
static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 };
static char usrtmp[] = { DIR_SEPARATOR, 'u', 's', 'r', DIR_SEPARATOR, 't', 'm', 'p', 0 };
base = try (getenv ("TMPDIR"), base);
base = try (getenv ("TMP"), base);
base = try (getenv ("TEMP"), base);
#ifdef P_tmpdir
base = try (P_tmpdir, base);
#endif
/* Try /usr/tmp, then /tmp. */
base = try (usrtmp, base);
base = try (tmp, base);
/* If all else fails, use the current directory! */
if (base == 0)
base = ".";
base_len = strlen (base);
if (suffix)
suffix_len = strlen (suffix);
else
suffix_len = 0;
temp_filename = xmalloc (base_len + 1 /*DIR_SEPARATOR*/
+ strlen (TEMP_FILE)
+ suffix_len + 1);
strcpy (temp_filename, base);
if (base_len != 0
&& temp_filename[base_len-1] != '/'
&& temp_filename[base_len-1] != DIR_SEPARATOR)
temp_filename[base_len++] = DIR_SEPARATOR;
strcpy (temp_filename + base_len, TEMP_FILE);
if (suffix)
strcat (temp_filename, suffix);
fd = mkstemps (temp_filename, suffix_len);
/* If mkstemps failed, then something bad is happening. Maybe we should
issue a message about a possible security attack in progress? */
if (fd == -1)
abort ();
/* Similarly if we can not close the file. */
if (close (fd))
abort ();
return temp_filename;
}

View File

@ -1,167 +0,0 @@
/* Concatenate variable number of strings.
Copyright (C) 1991, 1994 Free Software Foundation, Inc.
Written by Fred Fish @ Cygnus Support
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/*
NAME
concat -- concatenate a variable number of strings
SYNOPSIS
#include <varargs.h>
char *concat (s1, s2, s3, ..., NULL)
DESCRIPTION
Concatenate a variable number of strings and return the result
in freshly malloc'd memory.
Returns NULL if insufficient memory is available. The argument
list is terminated by the first NULL pointer encountered. Pointers
to empty strings are ignored.
NOTES
This function uses xmalloc() which is expected to be a front end
function to malloc() that deals with low memory situations. In
typical use, if malloc() returns NULL then xmalloc() diverts to an
error handler routine which never returns, and thus xmalloc will
never return a NULL pointer. If the client application wishes to
deal with low memory situations itself, it should supply an xmalloc
that just directly invokes malloc and blindly returns whatever
malloc returns.
*/
#include "ansidecl.h"
#include "libiberty.h"
#ifdef ANSI_PROTOTYPES
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#ifdef __STDC__
#include <stddef.h>
extern size_t strlen (const char *s);
#else
extern int strlen ();
#endif
#define NULLP (char *)0
/* VARARGS */
#ifdef ANSI_PROTOTYPES
char *
concat (const char *first, ...)
#else
char *
concat (va_alist)
va_dcl
#endif
{
register int length;
register char *newstr;
register char *end;
register const char *arg;
va_list args;
#ifndef ANSI_PROTOTYPES
const char *first;
#endif
/* First compute the size of the result and get sufficient memory. */
#ifdef ANSI_PROTOTYPES
va_start (args, first);
#else
va_start (args);
first = va_arg (args, const char *);
#endif
if (first == NULLP)
length = 0;
else
{
length = strlen (first);
while ((arg = va_arg (args, const char *)) != NULLP)
{
length += strlen (arg);
}
}
newstr = (char *) xmalloc (length + 1);
va_end (args);
/* Now copy the individual pieces to the result string. */
if (newstr != NULLP)
{
#ifdef ANSI_PROTOTYPES
va_start (args, first);
#else
va_start (args);
first = va_arg (args, const char *);
#endif
end = newstr;
if (first != NULLP)
{
arg = first;
while (*arg)
{
*end++ = *arg++;
}
while ((arg = va_arg (args, const char *)) != NULLP)
{
while (*arg)
{
*end++ = *arg++;
}
}
}
*end = '\000';
va_end (args);
}
return (newstr);
}
#ifdef MAIN
/* Simple little test driver. */
#include <stdio.h>
int
main ()
{
printf ("\"\" = \"%s\"\n", concat (NULLP));
printf ("\"a\" = \"%s\"\n", concat ("a", NULLP));
printf ("\"ab\" = \"%s\"\n", concat ("a", "b", NULLP));
printf ("\"abc\" = \"%s\"\n", concat ("a", "b", "c", NULLP));
printf ("\"abcd\" = \"%s\"\n", concat ("ab", "cd", NULLP));
printf ("\"abcde\" = \"%s\"\n", concat ("ab", "c", "de", NULLP));
printf ("\"abcdef\" = \"%s\"\n", concat ("", "a", "", "bcd", "ef", NULLP));
return 0;
}
#endif

View File

@ -1,128 +0,0 @@
/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This file is derived from mkstemp.c from the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
#endif
#ifdef HAVE_STRING_H
#include <string.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <fcntl.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#include "ansidecl.h"
/* We need to provide a type for gcc_uint64_t. */
#ifdef __GNUC__
typedef unsigned long long gcc_uint64_t;
#else
typedef unsigned long gcc_uint64_t;
#endif
#ifndef TMP_MAX
#define TMP_MAX 16384
#endif
/* Generate a unique temporary file name from TEMPLATE.
TEMPLATE has the form:
<path>/ccXXXXXX<suffix>
SUFFIX_LEN tells us how long <suffix> is (it can be zero length).
The last six characters of TEMPLATE before <suffix> must be "XXXXXX";
they are replaced with a string that makes the filename unique.
Returns a file descriptor open on the file for reading and writing. */
int
mkstemps (template, suffix_len)
char *template;
int suffix_len;
{
static const char letters[]
= "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
static gcc_uint64_t value;
#ifdef HAVE_GETTIMEOFDAY
struct timeval tv;
#endif
char *XXXXXX;
size_t len;
int count;
len = strlen (template);
if ((int) len < 6 + suffix_len
|| strncmp (&template[len - 6 - suffix_len], "XXXXXX", 6))
{
return -1;
}
XXXXXX = &template[len - 6 - suffix_len];
#ifdef HAVE_GETTIMEOFDAY
/* Get some more or less random data. */
gettimeofday (&tv, NULL);
value += ((gcc_uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid ();
#else
value += getpid ();
#endif
for (count = 0; count < TMP_MAX; ++count)
{
gcc_uint64_t v = value;
int fd;
/* Fill in the random bits. */
XXXXXX[0] = letters[v % 62];
v /= 62;
XXXXXX[1] = letters[v % 62];
v /= 62;
XXXXXX[2] = letters[v % 62];
v /= 62;
XXXXXX[3] = letters[v % 62];
v /= 62;
XXXXXX[4] = letters[v % 62];
v /= 62;
XXXXXX[5] = letters[v % 62];
fd = open (template, O_RDWR|O_CREAT|O_EXCL, 0600);
if (fd >= 0)
/* The file does not exist. */
return fd;
/* This is a random value. It is only necessary that the next
TMP_MAX values generated by adding 7777 to VALUE are different
with (module 2^32). */
value += 7777;
}
/* We return the null string if we can't find a unique file name. */
template[0] = '\0';
return -1;
}

View File

@ -1,435 +0,0 @@
/* Utilities to execute a program in a subprocess (possibly linked by pipes
with other subprocesses), and wait for it.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the libiberty library.
Libiberty is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
Libiberty is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with libiberty; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* This file exports two functions: pexecute and pwait. */
/* This file lives in at least two places: libiberty and gcc.
Don't change one without the other. */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdio.h>
#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#define ISSPACE (x) isspace(x)
#ifdef HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#ifdef vfork /* Autoconf may define this to fork for us. */
# define VFORK_STRING "fork"
#else
# define VFORK_STRING "vfork"
#endif
#ifdef HAVE_VFORK_H
#include <vfork.h>
#endif
#include "libiberty.h"
/* stdin file number. */
#define STDIN_FILE_NO 0
/* stdout file number. */
#define STDOUT_FILE_NO 1
/* value of `pipe': port index for reading. */
#define READ_PORT 0
/* value of `pipe': port index for writing. */
#define WRITE_PORT 1
static char *install_error_msg = "installation problem, cannot exec `%s'";
/* pexecute: execute a program.
PROGRAM and ARGV are the arguments to execv/execvp.
THIS_PNAME is name of the calling program (i.e. argv[0]).
TEMP_BASE is the path name, sans suffix, of a temporary file to use
if needed. This is currently only needed for MSDOS ports that don't use
GO32 (do any still exist?). Ports that don't need it can pass NULL.
(FLAGS & PEXECUTE_SEARCH) is non-zero if $PATH should be searched
(??? It's not clear that GCC passes this flag correctly).
(FLAGS & PEXECUTE_FIRST) is nonzero for the first process in chain.
(FLAGS & PEXECUTE_FIRST) is nonzero for the last process in chain.
FIRST_LAST could be simplified to only mark the last of a chain of processes
but that requires the caller to always mark the last one (and not give up
early if some error occurs). It's more robust to require the caller to
mark both ends of the chain.
The result is the pid on systems like Unix where we fork/exec and on systems
like WIN32 and OS2 where we use spawn. It is up to the caller to wait for
the child.
The result is the WEXITSTATUS on systems like MSDOS where we spawn and wait
for the child here.
Upon failure, ERRMSG_FMT and ERRMSG_ARG are set to the text of the error
message with an optional argument (if not needed, ERRMSG_ARG is set to
NULL), and -1 is returned. `errno' is available to the caller to use.
pwait: cover function for wait.
PID is the process id of the task to wait for.
STATUS is the `status' argument to wait.
FLAGS is currently unused (allows future enhancement without breaking
upward compatibility). Pass 0 for now.
The result is the pid of the child reaped,
or -1 for failure (errno says why).
On systems that don't support waiting for a particular child, PID is
ignored. On systems like MSDOS that don't really multitask pwait
is just a mechanism to provide a consistent interface for the caller.
pfinish: finish generation of script
pfinish is necessary for systems like MPW where a script is generated that
runs the requested programs.
*/
#if defined (_WIN32)
#include <process.h>
#ifdef __CYGWIN32__
#define fix_argv(argvec) (argvec)
extern int _spawnv ();
extern int _spawnvp ();
#else /* ! __CYGWIN32__ */
/* This is a kludge to get around the Microsoft C spawn functions' propensity
to remove the outermost set of double quotes from all arguments. */
const char * const *
fix_argv (argvec)
char **argvec;
{
int i;
for (i = 1; argvec[i] != 0; i++)
{
int len, j;
char *temp, *newtemp;
temp = argvec[i];
len = strlen (temp);
for (j = 0; j < len; j++)
{
if (temp[j] == '"')
{
newtemp = xmalloc (len + 2);
strncpy (newtemp, temp, j);
newtemp [j] = '\\';
strncpy (&newtemp [j+1], &temp [j], len-j);
newtemp [len+1] = 0;
temp = newtemp;
len++;
j++;
}
}
argvec[i] = temp;
}
return (const char * const *) argvec;
}
#endif /* __CYGWIN32__ */
#include <io.h>
#include <fcntl.h>
#include <signal.h>
/* mingw32 headers may not define the following. */
#ifndef _P_WAIT
# define _P_WAIT 0
# define _P_NOWAIT 1
# define _P_OVERLAY 2
# define _P_NOWAITO 3
# define _P_DETACH 4
# define WAIT_CHILD 0
# define WAIT_GRANDCHILD 1
#endif
/* Win32 supports pipes */
int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program;
char * const *argv;
const char *this_pname;
const char *temp_base;
char **errmsg_fmt, **errmsg_arg;
int flags;
{
int pid;
int pdes[2], org_stdin, org_stdout;
int input_desc, output_desc;
int retries, sleep_interval;
/* Pipe waiting from last process, to be used as input for the next one.
Value is STDIN_FILE_NO if no pipe is waiting
(i.e. the next command is the first of a group). */
static int last_pipe_input;
/* If this is the first process, initialize. */
if (flags & PEXECUTE_FIRST)
last_pipe_input = STDIN_FILE_NO;
input_desc = last_pipe_input;
/* If this isn't the last process, make a pipe for its output,
and record it as waiting to be the input to the next process. */
if (! (flags & PEXECUTE_LAST))
{
if (_pipe (pdes, 256, O_BINARY) < 0)
{
*errmsg_fmt = "pipe";
*errmsg_arg = NULL;
return -1;
}
output_desc = pdes[WRITE_PORT];
last_pipe_input = pdes[READ_PORT];
}
else
{
/* Last process. */
output_desc = STDOUT_FILE_NO;
last_pipe_input = STDIN_FILE_NO;
}
if (input_desc != STDIN_FILE_NO)
{
org_stdin = dup (STDIN_FILE_NO);
dup2 (input_desc, STDIN_FILE_NO);
close (input_desc);
}
if (output_desc != STDOUT_FILE_NO)
{
org_stdout = dup (STDOUT_FILE_NO);
dup2 (output_desc, STDOUT_FILE_NO);
close (output_desc);
}
pid = (flags & PEXECUTE_SEARCH ? _spawnvp : _spawnv)
(_P_NOWAIT, program, fix_argv(argv));
if (input_desc != STDIN_FILE_NO)
{
dup2 (org_stdin, STDIN_FILE_NO);
close (org_stdin);
}
if (output_desc != STDOUT_FILE_NO)
{
dup2 (org_stdout, STDOUT_FILE_NO);
close (org_stdout);
}
if (pid == -1)
{
*errmsg_fmt = install_error_msg;
*errmsg_arg = program;
return -1;
}
return pid;
}
/* MS CRTDLL doesn't return enough information in status to decide if the
child exited due to a signal or not, rather it simply returns an
integer with the exit code of the child; eg., if the child exited with
an abort() call and didn't have a handler for SIGABRT, it simply returns
with status = 3. We fix the status code to conform to the usual WIF*
macros. Note that WIFSIGNALED will never be true under CRTDLL. */
int
pwait (pid, status, flags)
int pid;
int *status;
int flags;
{
#ifdef __CYGWIN32__
return wait (status);
#else
int termstat;
pid = _cwait (&termstat, pid, WAIT_CHILD);
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
/* cwait returns the child process exit code in termstat.
A value of 3 indicates that the child caught a signal, but not
which one. Since only SIGABRT, SIGFPE and SIGINT do anything, we
report SIGABRT. */
if (termstat == 3)
*status = SIGABRT;
else
*status = (((termstat) & 0xff) << 8);
return pid;
#endif /* __CYGWIN32__ */
}
#endif /* _WIN32 */
/* include for Unix-like environments but not for Dos-like environments */
#if ! defined (_WIN32)
extern int execv ();
extern int execvp ();
int
pexecute (program, argv, this_pname, temp_base, errmsg_fmt, errmsg_arg, flags)
const char *program;
char * const *argv;
const char *this_pname;
const char *temp_base;
char **errmsg_fmt, **errmsg_arg;
int flags;
{
int (*func)() = (flags & PEXECUTE_SEARCH ? execvp : execv);
int pid;
int pdes[2];
int input_desc, output_desc;
int retries, sleep_interval;
/* Pipe waiting from last process, to be used as input for the next one.
Value is STDIN_FILE_NO if no pipe is waiting
(i.e. the next command is the first of a group). */
static int last_pipe_input;
/* If this is the first process, initialize. */
if (flags & PEXECUTE_FIRST)
last_pipe_input = STDIN_FILE_NO;
input_desc = last_pipe_input;
/* If this isn't the last process, make a pipe for its output,
and record it as waiting to be the input to the next process. */
if (! (flags & PEXECUTE_LAST))
{
if (pipe (pdes) < 0)
{
*errmsg_fmt = "pipe";
*errmsg_arg = NULL;
return -1;
}
output_desc = pdes[WRITE_PORT];
last_pipe_input = pdes[READ_PORT];
}
else
{
/* Last process. */
output_desc = STDOUT_FILE_NO;
last_pipe_input = STDIN_FILE_NO;
}
/* Fork a subprocess; wait and retry if it fails. */
sleep_interval = 1;
for (retries = 0; retries < 4; retries++)
{
pid = vfork ();
if (pid >= 0)
break;
sleep (sleep_interval);
sleep_interval *= 2;
}
switch (pid)
{
case -1:
{
*errmsg_fmt = VFORK_STRING;
*errmsg_arg = NULL;
return -1;
}
case 0: /* child */
/* Move the input and output pipes into place, if necessary. */
if (input_desc != STDIN_FILE_NO)
{
close (STDIN_FILE_NO);
dup (input_desc);
close (input_desc);
}
if (output_desc != STDOUT_FILE_NO)
{
close (STDOUT_FILE_NO);
dup (output_desc);
close (output_desc);
}
/* Close the parent's descs that aren't wanted here. */
if (last_pipe_input != STDIN_FILE_NO)
close (last_pipe_input);
/* Exec the program. */
(*func) (program, argv);
/* Note: Calling fprintf and exit here doesn't seem right for vfork. */
fprintf (stderr, "%s: ", this_pname);
fprintf (stderr, install_error_msg, program);
fprintf (stderr, ": %s\n", xstrerror (errno));
exit (-1);
/* NOTREACHED */
return 0;
default:
/* In the parent, after forking.
Close the descriptors that we made for this child. */
if (input_desc != STDIN_FILE_NO)
close (input_desc);
if (output_desc != STDOUT_FILE_NO)
close (output_desc);
/* Return child's process number. */
return pid;
}
}
int
pwait (pid, status, flags)
int pid;
int *status;
int flags;
{
/* ??? Here's an opportunity to canonicalize the values in STATUS.
Needed? */
pid = wait (status);
return pid;
}
#endif /* ! __MSDOS__ && ! OS2 && ! MPW && ! _WIN32 */