From cae8fa8120c70195f34a2456f18c4c848a2d3e0c Mon Sep 17 00:00:00 2001 From: obrien Date: Sat, 16 Oct 1999 06:09:09 +0000 Subject: Virgin import of the GCC 2.95.1 compilers --- contrib/gcc/objc/Make-lang.in | 161 ++------------------------------------- contrib/gcc/objc/Makefile.in | 48 ++++-------- contrib/gcc/objc/config-lang.in | 2 - contrib/gcc/objc/lang-specs.h | 96 +++++++++++++++++++++++ contrib/gcc/objc/objc-act.c | 165 ++++++++++++++++++++++++++++++++++------ contrib/gcc/objc/objc-tree.def | 2 +- 6 files changed, 260 insertions(+), 214 deletions(-) create mode 100644 contrib/gcc/objc/lang-specs.h (limited to 'contrib/gcc/objc') diff --git a/contrib/gcc/objc/Make-lang.in b/contrib/gcc/objc/Make-lang.in index 3774e22..9a84f0f 100644 --- a/contrib/gcc/objc/Make-lang.in +++ b/contrib/gcc/objc/Make-lang.in @@ -50,21 +50,17 @@ OBJC_FLAGS_TO_PASS = \ # # Define the names for selecting Objective-C in LANGUAGES. -OBJC objc: cc1obj$(exeext) objc-runtime -OBJECTIVE-C objective-c: cc1obj$(exeext) objc-runtime +OBJC objc: cc1obj$(exeext) +OBJECTIVE-C objective-c: cc1obj$(exeext) # Tell GNU make to ignore these if they exist. .PHONY: objective-c objc ObjC -# The Objective C thread file -OBJC_THREAD_FILE=thr-$(GCC_THREAD_FILE) - # Language-specific object files for Objective C. OBJC_OBJS = objc-parse.o objc-act.o $(C_AND_OBJC_OBJS) -cc1obj$(exeext): $(P) $(OBJC_OBJS) $(OBJS) $(LIBDEPS) - $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJC_OBJS) $(OBJS) \ - $(LIBS) +cc1obj$(exeext): $(P) $(OBJS) $(OBJC_OBJS) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(OBJC_OBJS) $(LIBS) # Objective C language specific files. @@ -75,9 +71,10 @@ objc-parse.o : $(srcdir)/objc/objc-parse.c \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-parse.c +$(INTL_TARGETS): $(srcdir)/objc/objc-parse.c $(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y cd $(srcdir)/objc; \ - $(BISON) $(BISONFLAGS) objc-parse.y -o objc-parse.c + $(BISON) $(BISONFLAGS) -o objc-parse.c objc-parse.y $(srcdir)/objc/objc-parse.y: $(srcdir)/c-parse.in echo '/*WARNING: This file is automatically generated!*/' >tmp-objc-prs.y @@ -94,125 +91,6 @@ objc-act.o : $(srcdir)/objc/objc-act.c \ $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \ -c $(srcdir)/objc/objc-act.c -objc-runtime: objc-headers libobjc.a - -# copy objc header files into build directory -objc-headers: stmp-fixinc - if [ -d include ]; then true; else mkdir include; fi - cd objc; \ - if [ -f Makefile ]; then \ - $(MAKE) copy-headers \ - tooldir=$(tooldir) \ - AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \ - GCC_FOR_TARGET="../xgcc -B../" \ - GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=../include; \ - fi - touch objc-headers - -# Objective C runtime library specific files. - -OBJC_O = objc/hash.o objc/sarray.o \ - objc/class.o objc/sendmsg.o \ - objc/init.o objc/archive.o \ - objc/encoding.o objc/selector.o \ - objc/objects.o objc/misc.o \ - objc/NXConstStr.o objc/Object.o \ - objc/Protocol.o objc/nil_method.o \ - objc/thr.o objc/linking.o \ - objc/$(OBJC_THREAD_FILE).o - -objc/hash.o: $(srcdir)/objc/hash.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/hash.c -o $@ -objc/sarray.o: $(srcdir)/objc/sarray.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/sarray.c -o $@ -objc/class.o: $(srcdir)/objc/class.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/class.c -o $@ -objc/sendmsg.o: $(srcdir)/objc/sendmsg.c $(GCC_PASSES) objc/runtime-info.h - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) -Iobjc \ - -c $(srcdir)/objc/sendmsg.c -o $@ -objc/init.o: $(srcdir)/objc/init.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/init.c -o $@ -objc/archive.o: $(srcdir)/objc/archive.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/archive.c -o $@ -objc/encoding.o: $(srcdir)/objc/encoding.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/encoding.c -o $@ -objc/selector.o: $(srcdir)/objc/selector.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/selector.c -o $@ -objc/objects.o: $(srcdir)/objc/objects.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/objects.c -o $@ -objc/misc.o: $(srcdir)/objc/misc.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/misc.c -o $@ -objc/NXConstStr.o: $(srcdir)/objc/NXConstStr.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/NXConstStr.m -o $@ -objc/Object.o: $(srcdir)/objc/Object.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/Object.m -o $@ -objc/Protocol.o: $(srcdir)/objc/Protocol.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/Protocol.m -o $@ -objc/thr.o: $(srcdir)/objc/thr.h $(srcdir)/objc/thr.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/thr.c -o $@ -objc/$(OBJC_THREAD_FILE).o: $(srcdir)/objc/$(OBJC_THREAD_FILE).c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/$(OBJC_THREAD_FILE).c -o $@ -objc/nil_method.o: $(srcdir)/objc/nil_method.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/nil_method.c -o $@ -objc/linking.o: $(srcdir)/objc/linking.m $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -fgnu-runtime -c $(srcdir)/objc/linking.m -o $@ - -objc/libobjc_entry.o: $(srcdir)/objc/libobjc_entry.c $(GCC_PASSES) - $(GCC_FOR_TARGET) $(GCC_CFLAGS) $(INCLUDES) \ - -c $(srcdir)/objc/libobjc_entry.c -o $@ - -$(OBJC_O): $(GCC_PASSES) cc1obj$(exeext) - -# Build the Objective C runtime library. -libobjc.a: cc1obj$(exeext) specs stmp-int-hdrs libgcc2.ready \ - $(USE_COLLECT2) $(EXTRA_PARTS) objc/runtime-info.h $(OBJC_O) - -rm -f libobjc.a - $(AR) $(AR_FLAGS) libobjc.a $(OBJC_O) - -if $(RANLIB_TEST) ; then $(RANLIB) libobjc.a; else true; fi - -libobjc_s.a: libobjc.a - mv libobjc.a libobjc_s.a - -# Create a relocatable DLL -libobjc.dll: libobjc_s.a objc/libobjc_entry.o - $(GCC_FOR_TARGET) -mdll -Wl,--base-file -Wl,libobjc.base \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) -mdll -Wl,--base-file libobjc.base libobjc.exp \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --base-file libobjc.base --output-exp libobjc.exp - $(GCC_FOR_TARGET) libobjc.exp -mdll \ - -o libobjc.dll libobjc_s.a \ - objc/libobjc_entry.o -lkernel32 - $(DLLTOOL) --dllname libobjc.dll --def $(srcdir)/objc/libobjc.def \ - --output-lib libobjc.a - -# Platform generated information needed by ObjC runtime -objc/runtime-info.h: cc1obj$(exeext) - echo "" > tmp-runtime - echo "/* This file is automatically generated */" >$@ - ./cc1obj -print-objc-runtime-info tmp-runtime >>$@ - rm -f tmp-runtime # # Build hooks: @@ -228,25 +106,7 @@ objc.dvi: # Install hooks: # cc1obj is installed elsewhere as part of $(COMPILERS). -objc.install-normal: installdirs - -if [ -f libobjc.a ] ; then \ - rm -f $(libsubdir)/libobjc.a; \ - $(INSTALL_DATA) libobjc.a $(libsubdir)/libobjc.a; \ - if $(RANLIB_TEST) ; then \ - (cd $(libsubdir); $(RANLIB) libobjc.a); else true; fi; \ - chmod a-x $(libsubdir)/libobjc.a; \ - else true; fi - -if [ -f libobjc_s.a ] ; then \ - rm -f $(libsubdir)/libobjc_s.a; \ - $(INSTALL_DATA) libobjc_s.a $(libsubdir)/libobjc_s.a; \ - if $(RANLIB_TEST) ; then \ - (cd $(libsubdir); $(RANLIB) libobjc_s.a); else true; fi; \ - chmod a-x $(libsubdir)/libobjc_s.a; \ - else true; fi - -if [ -f libobjc.dll ] ; then \ - rm -f $(bindir)/libobjc.dll; \ - $(INSTALL_DATA) libobjc.dll $(bindir)/libobjc.dll; \ - else true; fi +objc.install-normal: objc.install-common: @@ -262,9 +122,6 @@ objc.uninstall: objc.mostlyclean: -rm -f tmp-objc-prs.y -rm -f objc/*$(objext) objc/xforward objc/fflags - -rm -f objc/runtime-info.h - -rm -f libobjc.a libobjc_s.a libobjc.dll - -rm -f libobjc.base libobjc.exp objc.clean: objc.mostlyclean -rm -rf objc-headers objc.distclean: @@ -282,19 +139,15 @@ objc.maintainer-clean: objc.stage1: stage1-start -mv objc/*$(objext) stage1/objc -mv cc1obj$(exeext) stage1 - -mv libobjc.a stage1 objc.stage2: stage2-start -mv objc/*$(objext) stage2/objc -mv cc1obj$(exeext) stage2 - -mv libobjc.a stage2 objc.stage3: stage3-start -mv objc/*$(objext) stage3/objc -mv cc1obj$(exeext) stage3 - -mv libobjc.a stage3 objc.stage4: stage4-start -mv objc/*$(objext) stage4/objc -mv cc1obj$(exeext) stage4 - -mv libobjc.a stage4 # # Maintenance hooks: diff --git a/contrib/gcc/objc/Makefile.in b/contrib/gcc/objc/Makefile.in index 5f1bc88..71c564c 100644 --- a/contrib/gcc/objc/Makefile.in +++ b/contrib/gcc/objc/Makefile.in @@ -1,5 +1,5 @@ -# GNU Objective C Runtime Makefile -# Copyright (C) 1993, 1995, 1996, 1997 Free Software Foundation, Inc. +# GNU Objective C frontend Makefile +# Copyright (C) 1993, 1995, 1996, 1997, 1998 Free Software Foundation, Inc. # # This file is part of GNU CC. # @@ -17,21 +17,19 @@ # Foundation, 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. -# This makefile is run by the parent dir's makefile. -# thisdir1=`pwd`; \ -# srcdir1=`cd $(srcdir); pwd`; \ -# cd objc; \ -# $(MAKE) $(MAKEFLAGS) -f $$srcdir1/objc/Makefile libobjc.a \ -# srcdir=$$srcdir1 tooldir=$(tooldir) AR="$(AR)" AR_FLAGS="$(AR_FLAGS)" \ -# GCC_FOR_TARGET="$$thisdir1/xgcc -B$$thisdir1/" \ -# GCC_CFLAGS="$(GCC_CFLAGS)" incinstalldir=$$thisdir1/include -# OBJC_THREAD_FILE="$(OBJC_THREAD_FILE)" -# Two targets are used by ../Makefile: `all' and `mostlyclean'. +# The Makefile built from this file lives in the objc language subdirectory. +# Its purpose is to provide support for: +# +# 1. recursion where necessary, and only then (building .o's), and +# 2. building and debugging cc1objc from the language subdirectory. +# +# The parent Makefile handles all other chores, with help from the language +# Makefile fragment. +# +# The targets for external use are `all' and `mostlyclean'. SHELL=/bin/sh -.SUFFIXES: .m - OPTIMIZE= -O srcdir = . @@ -56,33 +54,17 @@ all: all.indirect ####build overrides # -OBJC_H = hash.h objc-list.h sarray.h objc.h objc-api.h \ - NXConstStr.h Object.h Protocol.h encoding.h typedstream.h thr.h - # Now figure out from those variables how to compile and link. -all.indirect: Makefile compiler objc-runtime +all.indirect: Makefile frontend -compiler: +frontend: cd ..; $(MAKE) cc1obj$(exeext) -objc-runtime: - cd ..; $(MAKE) libobjc.a - -# copy objc headers to installation include directory -copy-headers: - -rm -fr $(incinstalldir)/objc - -mkdir $(incinstalldir)/objc - for file in $(OBJC_H); do \ - realfile=$(srcdir)/$${file}; \ - cp $${realfile} $(incinstalldir)/objc; \ - chmod a+r $(incinstalldir)/objc/$${file}; \ - done - Makefile: $(srcdir)/Makefile.in $(srcdir)/../configure cd ..; $(SHELL) config.status mostlyclean: - -rm -f *.o libobjc.a xforward fflags + -rm -f *.o xforward fflags clean: mostlyclean distclean: mostlyclean extraclean: mostlyclean diff --git a/contrib/gcc/objc/config-lang.in b/contrib/gcc/objc/config-lang.in index 6c9b203..5287c8d 100644 --- a/contrib/gcc/objc/config-lang.in +++ b/contrib/gcc/objc/config-lang.in @@ -33,5 +33,3 @@ compilers="cc1obj\$(exeext)" stagestuff="" diff_excludes="-x objc-parse.c -x objc-parse.y " - -echo "Using \`$srcdir/objc/thr-${thread_file}.c' as Objective-C Runtime thread file." diff --git a/contrib/gcc/objc/lang-specs.h b/contrib/gcc/objc/lang-specs.h new file mode 100644 index 0000000..41dc097 --- /dev/null +++ b/contrib/gcc/objc/lang-specs.h @@ -0,0 +1,96 @@ +/* Definitions for specs for Objective-C. + Copyright (C) 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 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 is the contribution to the `default_compilers' array in gcc.c for + objc. */ + + {".m", {"@objective-c"}}, + {"@objective-c", +#if USE_CPPLIB + {"%{E|M|MM:cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}}\n}", + "%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{nostdinc*} %{A*} %{I*} %{P} %I\ + %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#else /* ! USE_CPPLIB */ + {"cpp -lang-objc %{nostdinc*} %{C} %{v} %{A*} %{I*} %{P} %{$} %I\ + %{C:%{!E:%eGNU C does not support -C without using -E}}\ + %{M} %{MM} %{MD:-MD %b.d} %{MMD:-MMD %b.d} %{MG}\ + -D__OBJC__ %{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2}\ + %{ansi:-trigraphs -D__STRICT_ANSI__}\ + %{!undef:%{!ansi:%p} %P} %{trigraphs}\ + %c %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\ + %{ffast-math:-D__FAST_MATH__}\ + %{traditional} %{ftraditional:-traditional}\ + %{traditional-cpp:-traditional}\ + %{fleading-underscore} %{fno-leading-underscore}\ + %{g*} %{W*} %{w} %{pedantic*} %{H} %{d*} %C %{D*} %{U*} %{i*} %Z\ + %i %{!M:%{!MM:%{!E:%{!pipe:%g.mi}}}}%{E:%W{o*}}%{M:%W{o*}}%{MM:%W{o*}} |\n", + "%{!M:%{!MM:%{!E:cc1obj %{!pipe:%g.mi} %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n\ + %{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"} +#endif /* ! USE_CPPLIB */ + }, + {".mi", {"@objc-cpp-output"}}, + {"@objc-cpp-output", + {"%{!M:%{!MM:%{!E:cc1obj %i %1 \ + %{!Q:-quiet} -dumpbase %b.m %{d*} %{m*} %{a*}\ + %{g*} %{O*} %{W*} %{w} %{pedantic*} %{ansi} \ + %{traditional} %{v:-version} %{pg:-p} %{p} %{f*} \ + -lang-objc %{gen-decls} \ + %{aux-info*} %{Qn:-fno-ident}\ + %{pg:%{fomit-frame-pointer:%e-pg and -fomit-frame-pointer are incompatible}}\ + %{S:%W{o*}%{!o*:-o %b.s}}%{!S:-o %{|!pipe:%g.s}} |\n", + "%{!S:as %a %Y\ + %{c:%W{o*}%{!o*:-o %w%b%O}}%{!c:-o %d%w%u%O}\ + %{!pipe:%g.s} %A\n }}}}"}}, diff --git a/contrib/gcc/objc/objc-act.c b/contrib/gcc/objc/objc-act.c index 0f4058b..a2842c8 100644 --- a/contrib/gcc/objc/objc-act.c +++ b/contrib/gcc/objc/objc-act.c @@ -55,7 +55,6 @@ Boston, MA 02111-1307, USA. */ #include "cpplib.h" extern cpp_reader parse_in; extern cpp_options parse_options; -static int cpp_initialized; #endif /* This is the default way of generating a method name. */ @@ -284,7 +283,8 @@ static void dump_interface PROTO((FILE *, tree)); /* Everything else. */ -static void objc_fatal PROTO((void)); +static void objc_fatal PROTO((void)) + ATTRIBUTE_NORETURN; static tree define_decl PROTO((tree, tree)); static tree lookup_method_in_protocol_list PROTO((tree, tree, int)); static tree lookup_protocol_in_reflist PROTO((tree, tree)); @@ -591,9 +591,18 @@ generate_struct_by_value_array () exit (0); } +#if USE_CPPLIB +extern char *yy_cur; +#endif + void lang_init_options () { +#if USE_CPPLIB + cpp_reader_init (&parse_in); + parse_in.opts = &parse_options; + cpp_options_init (&parse_options); +#endif } void @@ -604,7 +613,10 @@ lang_init () With luck, we discover the real source file's name from that and put it in input_filename. */ ungetc (check_newline (), finput); -#endif +#else + check_newline (); + yy_cur--; +#endif /* The line number can be -1 if we had -g3 and the input file had a directive specifying line 0. But we want predefined @@ -682,15 +694,6 @@ lang_decode_option (argc, argv) char **argv; { char *p = argv[0]; -#if USE_CPPLIB - if (! cpp_initialized) - { - cpp_reader_init (&parse_in); - parse_in.data = &parse_options; - cpp_options_init (&parse_options); - cpp_initialized = 1; - } -#endif if (!strcmp (p, "-lang-objc")) doing_objc_thang = 1; else if (!strcmp (p, "-gen-decls")) @@ -1317,7 +1320,7 @@ my_build_string (len, str) tree build_objc_string (len, str) int len; - char *str; + const char *str; { tree s = build_string (len, str); @@ -1855,6 +1858,8 @@ get_objc_string_decl (ident, section) chain = meth_var_names_chain; else if (section == meth_var_types) chain = meth_var_types_chain; + else + abort (); for (; chain != 0; chain = TREE_VALUE (chain)) if (TREE_VALUE (chain) == ident) @@ -2078,7 +2083,7 @@ build_selector_translation_table () tree sc_spec, decl_specs; tree chain, initlist = NULL_TREE; int offset = 0; - tree decl, var_decl, name; + tree decl = NULL_TREE, var_decl, name; /* The corresponding pop_obstacks is in finish_decl, called at the end of this function. */ @@ -2350,6 +2355,8 @@ add_objc_string (ident, section) chain = &meth_var_names_chain; else if (section == meth_var_types) chain = &meth_var_types_chain; + else + abort (); while (*chain) { @@ -3380,6 +3387,7 @@ build_selector_template () struct objc_class *sibling_class; } struct objc_protocol_list *protocols; + void *gc_object_type; }; */ static void @@ -3515,6 +3523,21 @@ build_class_template () decl_specs, NULL_TREE); chainon (field_decl_chain, field_decl); + /* void *sel_id; */ + + decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]); + field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("sel_id")); + field_decl + = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE); + chainon (field_decl_chain, field_decl); + + /* void *gc_object_type; */ + + decl_specs = build_tree_list (NULL_TREE, ridpointers[(int) RID_VOID]); + field_decl = build1 (INDIRECT_REF, NULL_TREE, get_identifier ("gc_object_type")); + field_decl + = grokfield (input_filename, lineno, field_decl, decl_specs, NULL_TREE); + chainon (field_decl_chain, field_decl); finish_struct (objc_class_template, field_decl_chain, NULL_TREE); } @@ -4203,6 +4226,8 @@ generate_protocol_list (i_or_p) synth_id_with_class_suffix ("_OBJC_CATEGORY_PROTOCOLS", i_or_p), build_int_2 (size + 2, 0)); + else + abort (); expr_decl = build1 (INDIRECT_REF, NULL_TREE, expr_decl); @@ -4287,6 +4312,7 @@ build_category_initializer (type, cat_name, class_name, struct objc_class *sibling_class; } struct objc_protocol_list *protocols; + void *gc_object_type; }; */ static tree @@ -4377,6 +4403,9 @@ build_shared_structure_initializer (type, isa, super, name, size, status, initlist = tree_cons (NULL_TREE, expr, initlist); } + /* gc_object_type = NULL */ + initlist = tree_cons (NULL_TREE, build_int_2 (0, 0), initlist); + return build_constructor (type, nreverse (initlist)); } @@ -4576,6 +4605,9 @@ synth_id_with_class_suffix (preamble, ctxt) = (char *) alloca (strlen (preamble) + strlen (protocol_name) + 3); sprintf (string, "%s_%s", preamble, protocol_name); } + else + abort (); + return get_identifier (string); } @@ -4590,6 +4622,7 @@ is_objc_type_qualifier (node) || node == ridpointers [(int) RID_OUT] || node == ridpointers [(int) RID_INOUT] || node == ridpointers [(int) RID_BYCOPY] + || node == ridpointers [(int) RID_BYREF] || node == ridpointers [(int) RID_ONEWAY])); } @@ -4676,6 +4709,8 @@ build_keyword_selector (selector) key_name = KEYWORD_KEY_NAME (key_chain); else if (TREE_CODE (selector) == TREE_LIST) key_name = TREE_PURPOSE (key_chain); + else + abort (); if (key_name) len += IDENTIFIER_LENGTH (key_name) + 1; @@ -4693,6 +4728,8 @@ build_keyword_selector (selector) key_name = KEYWORD_KEY_NAME (key_chain); else if (TREE_CODE (selector) == TREE_LIST) key_name = TREE_PURPOSE (key_chain); + else + abort (); if (key_name) strcat (buf, IDENTIFIER_POINTER (key_name)); @@ -4945,6 +4982,8 @@ build_message_expr (mess) sel_name = args; else if (TREE_CODE (args) == TREE_LIST) sel_name = build_keyword_selector (args); + else + abort (); /* Build the parameter list to give to the method. */ @@ -5351,6 +5390,8 @@ build_selector_expr (selnamelist) selname = selnamelist; else if (TREE_CODE (selnamelist) == TREE_LIST) selname = build_keyword_selector (selnamelist); + else + abort (); if (flag_typed_selectors) return build_typed_selector_reference (selname, 0); @@ -6475,6 +6516,8 @@ encode_type_qualifiers (declspecs) obstack_1grow (&util_obstack, 'o'); else if (ridpointers[(int) RID_BYCOPY] == TREE_VALUE (spec)) obstack_1grow (&util_obstack, 'O'); + else if (ridpointers[(int) RID_BYREF] == TREE_VALUE (spec)) + obstack_1grow (&util_obstack, 'R'); else if (ridpointers[(int) RID_ONEWAY] == TREE_VALUE (spec)) obstack_1grow (&util_obstack, 'V'); } @@ -6819,6 +6862,62 @@ encode_type (type, curtype, format) } static void +encode_complete_bitfield (int position, tree type, int size) +{ + enum tree_code code = TREE_CODE (type); + char buffer[40]; + char charType = '?'; + + if (code == INTEGER_TYPE) + { + if (TREE_INT_CST_LOW (TYPE_MIN_VALUE (type)) == 0 + && TREE_INT_CST_HIGH (TYPE_MIN_VALUE (type)) == 0) + { + /* Unsigned integer types. */ + + if (TYPE_MODE (type) == QImode) + charType = 'C'; + else if (TYPE_MODE (type) == HImode) + charType = 'S'; + else if (TYPE_MODE (type) == SImode) + { + if (type == long_unsigned_type_node) + charType = 'L'; + else + charType = 'I'; + } + else if (TYPE_MODE (type) == DImode) + charType = 'Q'; + } + + else + /* Signed integer types. */ + { + if (TYPE_MODE (type) == QImode) + charType = 'c'; + else if (TYPE_MODE (type) == HImode) + charType = 's'; + else if (TYPE_MODE (type) == SImode) + { + if (type == long_integer_type_node) + charType = 'l'; + else + charType = 'i'; + } + + else if (TYPE_MODE (type) == DImode) + charType = 'q'; + } + } + + else + abort (); + + sprintf (buffer, "b%d%c%d", position, charType, size); + obstack_grow (&util_obstack, buffer, strlen (buffer)); +} + +static void encode_field_decl (field_decl, curtype, format) tree field_decl; int curtype; @@ -6826,18 +6925,36 @@ encode_field_decl (field_decl, curtype, format) { tree type; - /* If this field is obviously a bitfield, or is a bitfield that has been + type = TREE_TYPE (field_decl); + + /* If this field is obviously a bitfield, or is a bitfield that has been clobbered to look like a ordinary integer mode, go ahead and generate the bitfield typing information. */ - type = TREE_TYPE (field_decl); - if (DECL_BIT_FIELD (field_decl)) - encode_bitfield (DECL_FIELD_SIZE (field_decl), format); - else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST - && DECL_FIELD_SIZE (field_decl) - && TYPE_MODE (type) > DECL_MODE (field_decl)) - encode_bitfield (DECL_FIELD_SIZE (field_decl), format); + if (flag_next_runtime) + { + if (DECL_BIT_FIELD (field_decl)) + encode_bitfield (DECL_FIELD_SIZE (field_decl), format); + else if (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST + && DECL_FIELD_SIZE (field_decl) + && TYPE_MODE (type) > DECL_MODE (field_decl)) + encode_bitfield (DECL_FIELD_SIZE (field_decl), format); + else + encode_type (TREE_TYPE (field_decl), curtype, format); + } else - encode_type (TREE_TYPE (field_decl), curtype, format); + { + if (DECL_BIT_FIELD (field_decl) + || (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST + && DECL_FIELD_SIZE (field_decl) + && TYPE_MODE (type) > DECL_MODE (field_decl))) + { + encode_complete_bitfield (TREE_INT_CST_LOW (DECL_FIELD_BITPOS (field_decl)), + DECL_BIT_FIELD_TYPE (field_decl), + DECL_FIELD_SIZE (field_decl)); + } + else + encode_type (TREE_TYPE (field_decl), curtype, format); + } } static tree @@ -7535,7 +7652,7 @@ gen_declarator (decl, buf, name) return buf; default: - break; + abort (); } return str; diff --git a/contrib/gcc/objc/objc-tree.def b/contrib/gcc/objc/objc-tree.def index 9d6765b..a661624 100644 --- a/contrib/gcc/objc/objc-tree.def +++ b/contrib/gcc/objc/objc-tree.def @@ -1,7 +1,7 @@ /* This file contains the definitions and documentation for the additional tree codes used in the Objective C front end (see tree.def for the standard codes). - Copyright (C) 1990 Free Software Foundation, Inc. + Copyright (C) 1990, 1997 Free Software Foundation, Inc. This file is part of GNU CC. -- cgit v1.1