diff options
Diffstat (limited to 'gcc/objcp')
-rw-r--r-- | gcc/objcp/.cvsignore | 4 | ||||
-rw-r--r-- | gcc/objcp/Make-lang.in | 222 | ||||
-rw-r--r-- | gcc/objcp/config-lang.in | 43 | ||||
-rw-r--r-- | gcc/objcp/lang-specs.h | 59 | ||||
-rw-r--r-- | gcc/objcp/objcp-decl.c | 306 | ||||
-rw-r--r-- | gcc/objcp/objcp-decl.h | 100 | ||||
-rw-r--r-- | gcc/objcp/objcp-root.h | 4 |
7 files changed, 738 insertions, 0 deletions
diff --git a/gcc/objcp/.cvsignore b/gcc/objcp/.cvsignore new file mode 100644 index 00000000000..69944476744 --- /dev/null +++ b/gcc/objcp/.cvsignore @@ -0,0 +1,4 @@ +# APPLE LOCAL entire file +objcp-parse.h +objcp-parse.c +g++int.info* diff --git a/gcc/objcp/Make-lang.in b/gcc/objcp/Make-lang.in new file mode 100644 index 00000000000..74b72211b09 --- /dev/null +++ b/gcc/objcp/Make-lang.in @@ -0,0 +1,222 @@ +# APPLE LOCAL Objective-C++ +# Top level makefile fragment for GNU Objective-C++ +# Copyright (C) 1997, 1998, 2000 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 file provides the language dependent support in the main Makefile. +# Each language makefile fragment must provide the following targets: +# +# foo.all.build, foo.all.cross, foo.start.encap, foo.rest.encap, +# foo.info, foo.dvi, +# foo.install-normal, foo.install-common, foo.install-info, foo.install-man, +# foo.uninstall, +# foo.mostlyclean, foo.clean, foo.distclean, foo.extraclean, +# foo.maintainer-clean, foo.stage1, foo.stage2, foo.stage3, foo.stage4 +# +# where `foo' is the name of the language. +# +# It should also provide rules for: +# +# - making any compiler driver (eg: g++) +# - the compiler proper (eg: cc1plus) +# - define the names for selecting the language in LANGUAGES. + +# +# Define the names for selecting Objective-C++ in LANGUAGES. +OBJC++ objc++: cc1objplus$(exeext) +OBJECTIVE-C++ objective-c++: cc1objplus$(exeext) + +# Tell GNU make to ignore these if they exist. +.PHONY: objective-c++ objc++ ObjC++ + +# Use maximal warnings for this front end (actually, this applies to the ObjC files, +# not the C++ files, which have been compiled elsewhere). +objc++-warn = $(STRICT_WARN) + +# APPLE LOCAL begin order files ilr +ifeq ($(ORDER_FILES),yes) +CC1OBJPLUS_ORDER_FLAGS = `if [ -f $(srcdir)/../order-files/cc1objplus.order ]; then \ + echo -sectorder __TEXT __text $(srcdir)/../order-files/cc1objplus.order -e start ; fi` +else +CC1OBJPLUS_ORDER_FLAGS = +endif +# APPLE LOCAL end order files ilr + +# Language-specific object files for Objective C++. +# APPLE LOCAL new tree dump +# APPLE LOCAL debugging +# APPLE LOCAL separate outputdir +OBJCP_OBJS = $(CXX_AND_OBJCP_OBJS) $(CXX_C_OBJS) objcp/objcp-lang.o \ + objcp/objcp-parse.o objcp/objcp-decl.o objcp/objcp-act.o \ + objcp/objcp-idebug.o objcp/objcp-dmp-tree.o + +# APPLE LOCAL order files ilr +cc1objplus$(exeext): $(OBJCP_OBJS) $(BACKEND) libcpp.a $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ $(OBJCP_OBJS) $(BACKEND) libcpp.a $(LIBS) \ + $(CC1OBJPLUS_ORDER_FLAGS) + +# Objective C++ language specific files. + +# APPLE LOCAL separate outputdir +objcp/objcp-decl.o : $(srcdir)/objcp/objcp-decl.c $(srcdir)/objcp/objcp-decl.h \ + $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \ + $(srcdir)/cp/lex.h $(srcdir)/cp/cp-tree.h $(srcdir)/c-common.h \ + $(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \ + $(srcdir)/objc/objc-act.h $(SYSTEM_H) $(CPPLIB_H) + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \ + -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objcp/objcp-decl.c $(OUTPUT_OPTION) + +# APPLE LOCAL separate outputdir +objcp/objcp-lang.o : $(srcdir)/cp/cp-lang.c \ + $(CONFIG_H) $(TREE_H) $(srcdir)/toplev.h $(srcdir)/ggc.h \ + $(srcdir)/cp/lex.h $(srcdir)/cp/cp-tree.h $(srcdir)/c-common.h \ + $(srcdir)/input.h $(srcdir)/flags.h $(srcdir)/output.h \ + $(srcdir)/objc/objc-act.h $(SYSTEM_H) $(CPPLIB_H) + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \ + -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/cp/cp-lang.c $(OUTPUT_OPTION) + +objcp/objcp-parse.o : $(parsedir)/objcp/objcp-parse.c $(CXX_TREE_H) flags.h cp/lex.h \ + except.h output.h \ + $(SYSTEM_H) toplev.h $(GGC_H) objc/objc-act.h objcp/objcp-decl.h + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp \ + -I$(srcdir)/objc $(BIG_SWITCHFLAG) \ + -DOBJCPLUS $(parsedir)/objcp/objcp-parse.c $(OUTPUT_OPTION) + +# APPLE LOCAL parsedir +po-generated: $(parsedir)/objcp/objcp-parse.c + +# APPLE LOCAL parsedir +# APPLE LOCAL Objective-C++ +$(parsedir)/objcp/objcp-parse.c : $(parsedir)/objcp/objcp-parse.y + cd $(parsedir)/objcp; \ + $(BISON) $(BISONFLAGS) -d -v -o p$$$$.c objcp-parse.y ; \ + mv -f p$$$$.c objcp-parse.c + +# APPLE LOCAL parsedir +$(parsedir)/objcp/objcp-parse.y : $(srcdir)/cp/cp-parse.in + echo '/*WARNING: This file is automatically generated!*/' >tmp-objcp-prs.y + sed -e "/^ifcp$$/,/^end ifcp$$/d" \ + -e "/^ifobjcp$$/d" -e "/^end ifobjcp$$/d" \ + -e "/^...ifobjcp...$$/d" -e "/^...end ifobjcp...$$/d" \ + $(srcdir)/cp/cp-parse.in >>tmp-objcp-prs.y + $(SHELL) $(srcdir)/move-if-change tmp-objcp-prs.y $(parsedir)/objcp/objcp-parse.y + +# APPLE LOCAL separate outputdir +objcp/objcp-act.o : $(srcdir)/objc/objc-act.c $(srcdir)/objcp/objcp-decl.h \ + $(CONFIG_H) $(TREE_H) $(RTL_H) $(SYSTEM_H) $(EXPR_H) $(TARGET_H) \ + $(srcdir)/c-tree.h $(srcdir)/c-common.h $(VARRAY_H) \ + $(srcdir)/toplev.h $(srcdir)/flags.h objc/objc-act.h objcp/objcp-decl.h \ + $(srcdir)/input.h $(srcdir)/function.h $(srcdir)/output.h $(srcdir)/debug.h \ + $(srcdir)/langhooks.h $(srcdir)/langhooks-def.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \ + -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objc/objc-act.c $(OUTPUT_OPTION) + +# APPLE LOCAL debugging +# Suppress all warnings explicitly for the idebug builds since there can be +# many when, and if, -traditional-cpp is used. +# APPLE LOCAL separate outputdir +objcp/objcp-idebug.o : $(srcdir)/objc/objc-idebug.c $(CONFIG_H) $(TREE_H) $(C_TREE_H) \ + $(RTL_H) $(srcdir)/objc/objc-act.h flags.h c-idebug.c idebug.c + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \ + -I$(srcdir)/objcp -DOBJCPLUS -c -w $(srcdir)/objc/objc-idebug.c $(OUTPUT_OPTION) + +# APPLE LOCAL new tree dump +# APPLE LOCAL separate outputdir +objcp/objcp-dmp-tree.o: $(srcdir)/objc/objc-dmp-tree.c $(srcdir)/cp/cp-dmp-tree.c \ + $(srcdir)/c-dmp-tree.c $(CONFIG_H) $(TREE_H) $(SYSTEM_H) $(srcdir)/c-common.h \ + $(srcdir)/objc/objc-act.h \ + $(srcdir)/cp/cp-tree.h \ + $(srcdir)/dmp-tree.c $(srcdir)/dmp-tree.h + $(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/cp -I$(srcdir)/objc \ + -I$(srcdir)/objcp -DOBJCPLUS -c $(srcdir)/objc/objc-dmp-tree.c $(OUTPUT_OPTION) + +# APPLE LOCAL separate outputdir +objcp/objcp-act.o : config.h + +gtype-objcp.h : s-gtype ; @true + +# +# Build hooks: + +objc++.all.build: +objc++.all.cross: +objc++.start.encap: +objc++.rest.encap: + +objc++.info: +objc++.dvi: +objc++.generated-manpages: + +# +# Install hooks: +# cc1objplus is installed elsewhere as part of $(COMPILERS). + +objc++.install-normal: + +objc++.install-common: + +objc++.install-info: + +objc++.install-man: + +objc++.uninstall: +# +# Clean hooks: +# A lot of the ancillary files are deleted by the main makefile. +# We just have to delete files specific to us. +objc++.mostlyclean: + -rm -f objcp/*$(objext) +objc++.clean: objc++.mostlyclean + -rm -rf objcp-headers +objc++.distclean: + -rm -f objcp/config.status objcp/Makefile + -rm -f $(parsedir)/objcp/objcp-parse.output +objc++.extraclean: +# APPLE LOCAL: parsedir +objc++.maintainer-clean: + -rm -f $(parsedir)/objcp/objcp-parse.y + -rm -f $(parsedir)/objcp/objcp-parse.c $(parsedir)/objcp/objcp-parse.output + +# +# Stage hooks: + +objc++.stage1: stage1-start + -mv objcp/*$(objext) stage1/objcp + -mv cc1objplus$(exeext) stage1 +objc++.stage2: stage2-start + -mv objcp/*$(objext) stage2/objcp + -mv cc1objplus$(exeext) stage2 +objc++.stage3: stage3-start + -mv objcp/*$(objext) stage3/objcp + -mv cc1objplus$(exeext) stage3 +objc++.stage4: stage4-start + -mv objcp/*$(objext) stage4/objcp + -mv cc1objplus$(exeext) stage4 + +# These exist for maintenance purposes. + +# APPLE LOCAL Objective-C++ +# Update the tags table. +objcp/TAGS: force + cd $(srcdir)/objcp ; \ + etags --no-globals -l c `echo *.c | sed 's/objcp-parse.c//'` \ + objcp-parse.y *.h ../*.c ../*.h; + +.PHONY: objcp/TAGS + diff --git a/gcc/objcp/config-lang.in b/gcc/objcp/config-lang.in new file mode 100644 index 00000000000..b6c0ac8cb63 --- /dev/null +++ b/gcc/objcp/config-lang.in @@ -0,0 +1,43 @@ +# APPLE LOCAL Objective-C++ +# Top level configure fragment for GNU Objective-C++. +# Copyright (C) 1997, 1998, 2000, 2001 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. + +# Configure looks for the existence of this file to auto-config each language. +# We define several parameters used by configure: +# +# language - name of language as it would appear in $(LANGUAGES) +# compilers - value to add to $(COMPILERS) +# stagestuff - files to add to $(STAGESTUFF) +# diff_excludes - files to ignore when building diffs between two versions. + +language="objc++" + +compilers="cc1objplus\$(exeext)" + +stagestuff="" + +diff_excludes="-x objcp-parse.c -x objcp-parse.y " + +# By building the Objective-C and C++ front-ends, we will get +# the object files we need, along with the libraries (libstdc++, +# libobjc). +lang_requires="objc c++" + +gtfiles="\$(srcdir)/objcp/objcp-root.h \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/tree.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c" diff --git a/gcc/objcp/lang-specs.h b/gcc/objcp/lang-specs.h new file mode 100644 index 00000000000..e8672070a0e --- /dev/null +++ b/gcc/objcp/lang-specs.h @@ -0,0 +1,59 @@ +/* APPLE LOCAL Objective-C++ */ +/* Definitions for specs for C++. + Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 + 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 + objective-c++. */ + +#ifndef OBJCPLUSPLUS_CPP_SPEC +#define OBJCPLUSPLUS_CPP_SPEC 0 +#endif + + {".mm", "@objective-c++", 0}, + {".M", "@objective-c++", 0}, + {"@objective-c++", + "%{E|M|MM:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\ + %(cpp_options) %2 %(cpp_debug_options)}\ + "/* APPLE LOCAL prohibit -arch with -E and -S */"\ + %{E|S:%{@:%e-E and -S are not allowed with multiple -arch flags}}\ + %{!E:%{!M:%{!MM:\ + %{save-temps:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\ + %(cpp_options) %2 %b.mii \n}\ + cc1objplus %{save-temps:-fpreprocessed %b.mii}\ + %{!save-temps:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}\ + %(cc1_options) %{gen-decls} %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + OBJCPLUSPLUS_CPP_SPEC}, + {".mii", "@objc++-cpp-output", 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ + cc1objplus -fpreprocessed %i %(cc1_options) %{gen-decls} %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0}, + {"@objective-c++-header", + "%{E|M|MM:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\ + %(cpp_options) %2 %(cpp_debug_options)}\ + %{!E:%{!M:%{!MM:\ + %{save-temps:cc1objplus -E %{!no-gcc:-D__GNUG__=%v1}\ + %(cpp_options) %2 %b.mii \n}\ + cc1objplus %{save-temps:-fpreprocessed %b.mii}\ + %{!save-temps:%(cpp_unique_options) %{!no-gcc:-D__GNUG__=%v1}}\ + %(cc1_options) %{gen-decls} %2 %{+e1*}\ + %(pch) %(dbg_ss)}}}", 0}, diff --git a/gcc/objcp/objcp-decl.c b/gcc/objcp/objcp-decl.c new file mode 100644 index 00000000000..8c6848ab87b --- /dev/null +++ b/gcc/objcp/objcp-decl.c @@ -0,0 +1,306 @@ +/* APPLE LOCAL file Objective-C++ */ +/* Process the ObjC-specific declarations and variables for + the Objective-C++ compiler. + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC 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. + +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 General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +/* Process declarations and symbol lookup for C front end. + Also constructs types; the standard scalar types at initialization, + and structure, union, array and enum types when they are declared. */ + +/* ??? not all decl nodes are given the most useful possible + line numbers. For example, the CONST_DECLs for enum values. */ + +#include "config.h" +#include "system.h" +#include "tree.h" +#include "rtl.h" +#include "expr.h" +#include "cp-tree.h" +#include "lex.h" +#include "c-common.h" +#include "flags.h" +#include "input.h" +#include "except.h" +#include "output.h" +#include "toplev.h" +#include "cpplib.h" +#include "debug.h" +#include "target.h" +#include "varray.h" + +#include "objc-act.h" +#include "objcp-decl.h" + +/* APPLE LOCAL indexing */ +#include "genindex.h" + +static tree objcp_parmlist = NULL_TREE; + +/* Hacks to simulate start_struct() and finish_struct(). */ + +tree +objcp_start_struct (code, name) + enum tree_code code ATTRIBUTE_UNUSED; + tree name; +{ + int new_scope = 0; + tree h, s; + /* The idea here is to mimic the actions that the C++ parser takes when + constructing 'extern "C" struct {'. */ + push_lang_context (lang_name_c); + if (!name) + name = make_anon_name (); + h = handle_class_head (record_type, 0, name, 0, 1, &new_scope); + + /* APPLE LOCAL indexing dpatel */ + flag_suppress_builtin_indexing = 1; + + s = begin_class_definition (TREE_TYPE (h)); + + /* APPLE LOCAL indexing dpatel */ + flag_suppress_builtin_indexing = 0; + + return s; +} + +tree +objcp_finish_struct (t, fieldlist, attributes) + tree t; + tree fieldlist, attributes; +{ + tree s, field, next_field; + + /* APPLE LOCAL indexing dpatel */ + flag_suppress_builtin_indexing = 1; + + for (field = fieldlist; field; field = next_field) + { + next_field = TREE_CHAIN (field); /* insert one field at a time; */ + TREE_CHAIN (field) = NULL_TREE; /* otherwise, grokfield croaks. */ + finish_member_declaration (field); + } + s = finish_class_definition (t, attributes, 1, 0); + + /* APPLE LOCAL indexing dpatel */ + flag_suppress_builtin_indexing = 0; + + pop_lang_context (); + return s; +} + +int +objcp_start_function (declspecs, declarator, attributes) + tree declspecs, declarator, attributes; +{ + return start_function (declspecs, declarator, attributes, 0); +} + +void +objcp_finish_function (nested) + int nested ATTRIBUTE_UNUSED; +{ + /* The C++ flavor of 'finish_function' does not generate RTL -- one has + to call 'expand_body' to do that. */ + expand_body (finish_function (0)); +} + +tree +objcp_start_decl (declarator, declspecs, initialized, attributes) + tree declarator, declspecs; + int initialized; + tree attributes; +{ + return start_decl (declarator, declspecs, initialized, + attributes, NULL_TREE); +} + +void +objcp_finish_decl (decl, init, asmspec) + tree decl, init, asmspec; +{ + cp_finish_decl (decl, init, asmspec, 0); +} + +tree +objcp_lookup_name (name) + tree name; +{ + return lookup_name (name, -1); +} + +/* Hacks to simulate push_parm_decl() and get_parm_info(). */ + +tree +objcp_push_parm_decl (parm) + tree parm; +{ + /* C++ parms are laid out slightly differently from C parms. Adjust + for this here. */ + TREE_VALUE (parm) = TREE_PURPOSE (parm); + TREE_PURPOSE (parm) = NULL_TREE; + + if (objcp_parmlist) + objcp_parmlist = chainon (objcp_parmlist, parm); + else + objcp_parmlist = parm; + + return objcp_parmlist; +} + +tree +objcp_get_parm_info (void_at_end) + int void_at_end; +{ + tree parm_info = finish_parmlist (objcp_parmlist, !void_at_end); + + /* The C++ notion of a parameter list differs slightly from that of + C. Adjust for this. */ + parm_info = build_tree_list (parm_info, NULL_TREE); + objcp_parmlist = NULL_TREE; + + return parm_info; +} + +void +objcp_store_parm_decls () +{ + /* In C++ land, 'start_function' calls 'store_parm_decls'; hence we + do not need to do anything here. */ +} + +tree +objcp_build_function_call (function, args) + tree function, args; +{ + /* APPLE MERGE this is probably wrong */ + return build_function_call (function, args); +} + +tree +objcp_xref_tag (code, name) + enum tree_code code; + tree name; +{ + if (code != RECORD_TYPE) + abort (); /* this is sheer laziness... */ + return xref_tag (record_type, name, 0, 1); +} + +tree +objcp_grokfield (filename, line, declarator, declspecs, width) + const char *filename ATTRIBUTE_UNUSED; + int line ATTRIBUTE_UNUSED; + tree declarator, declspecs, width; +{ + return (width) ? grokbitfield (declarator, declspecs, width) + : grokfield (declarator, declspecs, 0, 0, 0); +} + +tree +objcp_build_component_ref (datum, component) + tree datum, component; +{ + /* The 'build_component_ref' routine has been removed from the C++ + front-end, but 'finish_class_member_access_expr' seems to be + a worthy substitute. */ + return finish_class_member_access_expr (datum, component); +} + +int +objcp_comptypes (type1, type2) + tree type1, type2; +{ + return comptypes (type1, type2, 0); +} + +tree +objcp_type_name (type) + tree type; +{ + if (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) + return DECL_NAME (TYPE_NAME (type)); + else + return TYPE_NAME (type); +} + +tree +objcp_type_size (type) + tree type; +{ + tree size = TYPE_SIZE (type); + if (size == NULL_TREE) + { + warning ("Requesting size of incomplete type `%s'", + IDENTIFIER_POINTER (objcp_type_name (type))); + layout_type (type); + size = TYPE_SIZE (type); + } + return build_int_2 (TREE_INT_CST_LOW (size), 0); +} + +/* C++'s version of 'builtin_function' winds up placing our precious + objc_msgSend and friends in namespace std! This will not do. + We shall hence duplicate C's 'builtin_function' here instead. */ + +tree +objcp_builtin_function (name, type, code, class, libname, attrs) + const char *name; + tree type; + int code; + enum built_in_class class; + const char *libname ATTRIBUTE_UNUSED; + tree attrs; +{ + tree decl = NULL; + decl = build_decl (FUNCTION_DECL, get_identifier (name), type); + DECL_EXTERNAL (decl) = 1; + TREE_PUBLIC (decl) = 1; + make_decl_rtl (decl, NULL); + pushdecl (decl); + DECL_BUILT_IN_CLASS (decl) = class; + DECL_FUNCTION_CODE (decl) = code; + DECL_ANTICIPATED (decl) = 1; + + /* Possibly apply some default attributes to this built-in function. */ + if (attrs) + decl_attributes (&decl, attrs, ATTR_FLAG_BUILT_IN); + else + decl_attributes (&decl, NULL_TREE, 0); + + return decl; +} + +int +objcp_lookup_identifier (token, id, check_conflict) + tree token; + tree *id; + int check_conflict; +{ + tree objc_id = lookup_objc_ivar (token); + + if (!check_conflict || objc_id && IS_SUPER (objc_id)) + *id = objc_id; + else if (objc_id && *id && IDENTIFIER_BINDING (token)) + warning ("local declaration of `%s' hides instance variable", + IDENTIFIER_POINTER (token)); + + return (objc_id != NULL_TREE); +} diff --git a/gcc/objcp/objcp-decl.h b/gcc/objcp/objcp-decl.h new file mode 100644 index 00000000000..945631d1b91 --- /dev/null +++ b/gcc/objcp/objcp-decl.h @@ -0,0 +1,100 @@ +/* Process the ObjC-specific declarations and variables for + the Objective-C++ compiler. + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, + 2001 Free Software Foundation, Inc. + +This file is part of GCC. + +GCC 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. + +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 General Public License +for more details. + +You should have received a copy of the GNU General Public License +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ + +#ifndef GCC_OBJCP_DECL_H +#define GCC_OBJCP_DECL_H + +/* APPLE LOCAL entire file */ + +extern tree objcp_start_struct PARAMS ((enum tree_code, tree)); +extern tree objcp_finish_struct PARAMS ((tree, tree, tree)); +extern int objcp_start_function PARAMS ((tree, tree, tree)); +extern void objcp_finish_function PARAMS ((int)); +extern tree objcp_start_decl PARAMS ((tree, tree, int, tree)); +extern void objcp_finish_decl PARAMS ((tree, tree, tree)); +extern tree objcp_lookup_name PARAMS ((tree)); +extern tree objcp_push_parm_decl PARAMS ((tree)); +extern tree objcp_get_parm_info PARAMS ((int)); +extern void objcp_store_parm_decls PARAMS ((void)); +extern tree objcp_build_function_call PARAMS ((tree, tree)); +extern tree objcp_xref_tag PARAMS ((enum tree_code, tree)); +extern tree objcp_grokfield PARAMS ((const char *, int, tree, tree, tree)); +extern tree objcp_build_component_ref PARAMS ((tree, tree)); +extern int objcp_comptypes PARAMS ((tree, tree)); +extern tree objcp_type_name PARAMS ((tree)); +extern tree objcp_type_size PARAMS ((tree)); +extern tree objcp_builtin_function PARAMS ((const char *, tree, int, + enum built_in_class, const char *, tree)); + +extern int objcp_lookup_identifier PARAMS ((tree, tree *, int)); + +/* Now "cover up" the corresponding C++ functions if required (NB: the + OBJCP_ORIGINAL_FUNCTION macro, shown below, can still be used to + invoke the original C++ functions if needed). */ +#ifdef OBJCP_REMAP_FUNCTIONS + +#define start_struct(code, name) \ + objcp_start_struct (code, name) +#define finish_struct(t, fieldlist, attributes) \ + objcp_finish_struct (t, fieldlist, attributes) +#define start_function(declspecs, declarator, attributes) \ + objcp_start_function (declspecs, declarator, attributes) +#define finish_function(nested) \ + objcp_finish_function (nested) +#define start_decl(declarator, declspecs, initialized, attributes) \ + objcp_start_decl (declarator, declspecs, initialized, attributes) +#define finish_decl(decl, init, asmspec) \ + objcp_finish_decl (decl, init, asmspec) +#define lookup_name(name) \ + objcp_lookup_name (name) +#define push_parm_decl(parm) \ + objcp_push_parm_decl (parm) +#define get_parm_info(void_at_end) \ + objcp_get_parm_info (void_at_end) +#define store_parm_decls() \ + objcp_store_parm_decls () +#define build_function_call(function, args) \ + objcp_build_function_call (function, args) +#define xref_tag(code, name) \ + objcp_xref_tag (code, name) +#define grokfield(filename, line, declarator, declspecs, width) \ + objcp_grokfield (filename, line, declarator, declspecs, width) +#define build_component_ref(datum, component) \ + objcp_build_component_ref (datum, component) +#define comptypes(type1, type2) \ + objcp_comptypes (type1, type2) +#define builtin_function(name, type, code, class, libname, attr) \ + objcp_builtin_function(name, type, code, class, libname, attr) + +#undef TYPE_NAME +#define TYPE_NAME(type) \ + objcp_type_name (type) + +#undef TYPE_SIZE +#define TYPE_SIZE(type) \ + objcp_type_size (type) + +#define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args + +#endif /* OBJCP_REMAP_FUNCTIONS */ + +#endif /* ! GCC_OBJCP_DECL_H */ diff --git a/gcc/objcp/objcp-root.h b/gcc/objcp/objcp-root.h new file mode 100644 index 00000000000..f55bc6a26f5 --- /dev/null +++ b/gcc/objcp/objcp-root.h @@ -0,0 +1,4 @@ +/* APPLE LOCAL file Objective-C++ */ +/* Empty file to be the base for gtype-objcp.h. */ + +extern GTY(()) tree objcp_dummy; |