diff options
Diffstat (limited to 'gcc-4.2.1-5666.3/gcc/objcp')
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/ChangeLog | 124 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/ChangeLog.apple | 46 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/Make-lang.in | 161 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/config-lang.in | 45 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/lang-specs.h | 61 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.c | 127 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.h | 94 | ||||
-rw-r--r-- | gcc-4.2.1-5666.3/gcc/objcp/objcp-lang.c | 238 |
8 files changed, 896 insertions, 0 deletions
diff --git a/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog b/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog new file mode 100644 index 000000000..40def45f5 --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog @@ -0,0 +1,124 @@ +2007-07-19 Release Manager + + * GCC 4.2.1 released. + +2007-05-13 Release Manager + + * GCC 4.2.0 released. + +2006-10-10 Brooks Moses <bmoses@stanford.edu> + + * Make-lang.in: Added empty "obj-c++.pdf" target. + +2006-08-20 Mark Mitchell <mark@codesourcery.com> + + * objcp-lang.c (objcp_tsubst_copy_and_build): Adjust call to + tsubst_copy_and_build. + +2006-07-28 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + * Make-lang.in: Use $(HEADER_H) instead of header.h in dependencies. + +2006-07-03 Paolo Bonzini <bonzini@gnu.org> + + PR other/27063 + * config-lang.in: Add subdir_requires. + +2006-06-30 Jason Merrill <jason@redhat.com> + + * objcp-decl.c (objcp_start_struct): Pass null attributes argument + to begin_class_definition. + +2006-05-14 H.J. Lu <hongjiu.lu@intel.com> + + * Make-lang.in (objcp/objcp-decl.o): Add dependency on + $(TARGET_H). + +2006-02-20 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> + + * Make-lang.in (OBJ-C++): Remove + (.PHONY): Remove Obj-c++ and obj-C++. Add obj-c++ + +2005-12-14 Andrew Pinski <pinskia@physics.uc.edu> + + * Make-lang.in (objcp/objcp-decl.o): Add depends on $(EXPR_H). + +2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> + + * Make-lang.in (obj-c++.all.build, obj-c++.install-normal): Remove. + +2005-12-07 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> + + * Make-lang.in: Remove all dependencies on s-gtype. + +2005-11-22 Andrew Pinski <pinskia@physics.uc.edu> + + * objcp-decl.c (objcp_lookup_name): Remove. + * objcp-decl.h (objcp_lookup_name): Delete. + (lookup_name): Kill define. + +2005-09-11 Richard Henderson <rth@redhat.com> + + * objcp-lang.c (objcxx_init_ts): Remove ALIAS_DECL. + +2005-07-09 Andrew Pinski <pinskia@physics.uc.edu> + + * config-lang.in (gtfiles): Add cp-objcp-common.c. + * objcp-lang.c (objcxx_init_ts): New function. + (LANG_HOOKS_INIT_TS): Define. + +2005-07-03 Kazu Hirata <kazu@codesourcery.com> + + * Make-lang.in (cc1plus-checksum.c): Use + build/genchecksum$(build_exeext), not build/genchecksum$(exeext). + +2005-06-30 Zack Weinberg <zack@codesourcery.com> + Jakub Jelinek <jakub@redhat.com> + + * objcp-lang.c: No need to include cxx-pretty-print.h. + * Make-lang.in: Update dependencies. + +2005-06-25 Kelley Cook <kcook@gcc.gnu.org> + + * all files: Update FSF in copyright headers. + +2005-06-20 Ziemowit Laski <zlaski@apple.com> + + * config-lang.in (gtfiles): Add cp/rtti.c. + +2005-05-24 Ziemowit Laski <zlaski@apple.com> + + * objcp-decl.c (objcp_start_struct, objcp_xref_tag): Adjust + call to xref_tag(). + (objcp_build_component_ref): Remove function. + * objcp-decl.h (objcp_build_component_ref): Remove prototype. + (build_component_ref): Remove macro. + * objcp-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. + +2005-05-18 Geoffrey Keating <geoffk@apple.com> + + * Make-lang.in (cc1objplus-dummy): New. + (cc1objplus-checksum.c): New. + (cc1objplus-checksum.o): New. + (cc1objplus): Add cc1objplus-checksum.o. + +2005-05-17 Ziemowit Laski <zlaski@apple.com> + Mike Stump <mrs@apple.com> + + Yet more Objective-C++... + + * Make-lang.in (objcp/objcp-lang.o): Add tree-gimple.h + (objcp/objcp-decl.o): Likewise. + (objcp/objcp-act.o): Likewise. + * objcp-lang.c (LANG_HOOKS_GIMPLIFY_EXPR): Add. + +2005-04-21 Ziemowit Laski <zlaski@apple.com> + Mike Stump <mrs@apple.com> + + * ChangeLog: New. + * Make-lang.in: Likewise. + * config-lang.in: Likewise. + * lang-specs.h: Likewise. + * objcp-decl.c: Likewise. + * objcp-decl.h: Likewise. + * objcp-lang.c: Likewise. diff --git a/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog.apple b/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog.apple new file mode 100644 index 000000000..0fdbdebba --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/ChangeLog.apple @@ -0,0 +1,46 @@ +2008-06-03 Fariborz Jahanian <fjahanian@apple.com> + + Radar 5887355 + * objcp-lang.c (objcp_tsubst_copy_and_build): Build + cfstring tree during template instantiation. + +2008-02-20 Fariborz Jahanian <fjahanian@apple.com> + + Radar 5732232 - code gen part 2. + * objcp-lang.c (c_finish_return): Defined these + templates to get a clean compile. + +2006-10-04 Fariborz Jahanian <fjahanian@apple.com> + + Radar 3904178 + Define LANG_HOOKS_FOLD_OBJ_TYPE_REF for objective-c++ + +2005-10-12 Fariborz Jahanian <fjahanian@apple.com> + + Radar 4291785 + + * objcp-decl.c (objcp_finish_struct): Call objc_detect_field_duplicates for + ivar duplicate detection. + +2005-06-30 Devang Patel <dpatel@apple.com> + + * lang-specs.h: While making PCH, invoke as if -fsave-repository + is used. + +2005-05-19 Ziemowit Laski <zlaski@apple.com> + + Radar 4035492 + * objcp-decl.c (objcp_start_struct, objcp_xref_tag): Adjust call + to xref_tag(). + (objcp_build_component_ref): Remove function. + * objcp-decl.h (objcp_build_component_ref): Remove prototype. + (build_component_ref): Remove macro. + * objcp-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Remove. + +2005-02-10 Ziemowit Laski <zlaski@apple.com> + + Radar 3982256 + * ChangeLog.apple-ppc: New file. + * objcp-lang.c (LANG_HOOKS_TYPES_COMPATIBLE_P): Point at + objc_types_compatible_p(). + diff --git a/gcc-4.2.1-5666.3/gcc/objcp/Make-lang.in b/gcc-4.2.1-5666.3/gcc/objcp/Make-lang.in new file mode 100644 index 000000000..7052e4e2f --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/Make-lang.in @@ -0,0 +1,161 @@ +# Top level -*- makefile -*- fragment for GNU Objective-C++ +# Copyright (C) 2005 Free Software Foundation, Inc. +# Contributed by Ziemowit Laski <zlaski@apple.com> + +#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, 51 Franklin Street, Fifth Floor, +#Boston, MA 02110-1301, USA. + +# This file provides the language dependent support in the main Makefile. +# Each language makefile fragment must provide the following targets: +# +# foo.all.cross, foo.start.encap, foo.rest.encap, +# foo.install-common, foo.install-man, foo.install-info, foo.dvi, foo.pdf +# foo.uninstall, +# foo.mostlyclean, foo.clean, foo.distclean, +# 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. +obj-c++: cc1objplus$(exeext) + +# Tell GNU make to ignore these if they exist. +.PHONY: obj-c++ + +# Use maximal warnings for this front end. Also, make ObjC and C++ +# headers accessible. +objcp-warn = $(STRICT_WARN) -DOBJCPLUS -I$(srcdir)/objc -I$(srcdir)/cp + +# 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++. +OBJCXX_OBJS = objcp/objcp-act.o objcp/objcp-lang.o objcp/objcp-decl.o \ + $(CXX_AND_OBJCXX_OBJS) + +# APPLE LOCAL begin order files --ilr +cc1objplus-dummy$(exeext): $(OBJCXX_OBJS) dummy-checksum.o $(BACKEND) \ + $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ + $(OBJCXX_OBJS) dummy-checksum.o $(BACKEND) $(LIBS) \ + $(CC1OBJPLUS_ORDER_FLAGS) + +cc1objplus-checksum.c : cc1objplus-dummy$(exeext) build/genchecksum$(build_exeext) + build/genchecksum$(build_exeext) cc1objplus-dummy$(exeext) > $@ + +cc1objplus-checksum.o : cc1objplus-checksum.c + +cc1objplus$(exeext): $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBDEPS) + $(CC) $(ALL_CFLAGS) $(LDFLAGS) -o $@ \ + $(OBJCXX_OBJS) cc1objplus-checksum.o $(BACKEND) $(LIBS) \ + $(CC1OBJPLUS_ORDER_FLAGS) +# APPLE LOCAL end order files --ilr + +# Objective C++ language specific files. + +objcp/objcp-lang.o : objcp/objcp-lang.c \ + $(CXX_TREE_H) $(TM_H) toplev.h debug.h langhooks.h objc/objc-act.h \ + $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objcp.h \ + $(DIAGNOSTIC_H) cp/cp-objcp-common.h $(TREE_GIMPLE_H) + +objcp/objcp-decl.o : objcp/objcp-decl.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \ + toplev.h $(GGC_H) $(C_PRAGMA_H) input.h $(FLAGS_H) output.h \ + objc/objc-act.h objcp/objcp-decl.h $(TREE_GIMPLE_H) $(EXPR_H) $(TARGET_H) + +# The following must be an explicit rule; please keep in sync with the implicit +# one in Makefile.in. +objcp/objcp-act.o : objc/objc-act.c \ + $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) $(TM_P_H) \ + $(EXPR_H) $(TARGET_H) $(CXX_TREE_H) $(DIAGNOSTIC_H) toplev.h $(FLAGS_H) \ + objc/objc-act.h input.h $(FUNCTION_H) output.h debug.h langhooks.h \ + objcp/objcp-decl.h $(LANGHOOKS_DEF_H) $(HASHTAB_H) gt-objc-objc-act.h \ + $(TREE_GIMPLE_H) + $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $< $(OUTPUT_OPTION) + +po-generated: + +# +# Build hooks: + +obj-c++.all.cross: +obj-c++.start.encap: +obj-c++.rest.encap: +obj-c++.info: +obj-c++.install-info: +obj-c++.dvi: +obj-c++.pdf: +obj-c++.html: +obj-c++.srcinfo: +obj-c++.srcextra: +obj-c++.man: + +obj-c++.tags: force + cd $(srcdir)/objcp; etags -o TAGS.sub *.y *.c *.h; \ + etags --include TAGS.sub --include ../TAGS.sub + +lang_checks += check-obj-c++ + +# +# Install hooks: +# cc1objplus is installed elsewhere as part of $(COMPILERS). + +obj-c++.install-common: + +obj-c++.install-man: + +obj-c++.uninstall: +# +# Clean hooks: +# A lot of the ancillary files are deleted by the main makefile. +# We just have to delete files specific to us. +obj-c++.mostlyclean: + -rm -f objcp/*$(objext) + -rm -f objcp/*$(coverageexts) +obj-c++.clean: obj-c++.mostlyclean +obj-c++.distclean: + -rm -f objcp/config.status objcp/Makefile +obj-c++.maintainer-clean: + +# +# Stage hooks: + +obj-c++.stage1: stage1-start + -mv objcp/*$(objext) stage1/objcp +obj-c++.stage2: stage2-start + -mv objcp/*$(objext) stage2/objcp +obj-c++.stage3: stage3-start + -mv objcp/*$(objext) stage3/objcp +obj-c++.stage4: stage4-start + -mv objcp/*$(objext) stage4/objcp +obj-c++.stageprofile: stageprofile-start + -mv objcp/*$(objext) stageprofile/objcp +obj-c++.stagefeedback: stagefeedback-start + -mv objcp/*$(objext) stagefeedback/objcp diff --git a/gcc-4.2.1-5666.3/gcc/objcp/config-lang.in b/gcc-4.2.1-5666.3/gcc/objcp/config-lang.in new file mode 100644 index 000000000..30b240833 --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/config-lang.in @@ -0,0 +1,45 @@ +# Top level configure fragment for GNU Objective-C++. +# Copyright (C) 2005 Free Software Foundation, Inc. +# Contributed by Ziemowit Laski <zlaski@apple.com> + +#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, 51 Franklin Street, Fifth Floor, +#Boston, MA 02110-1301, 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) + +language="obj-c++" + +compilers="cc1objplus\$(exeext)" + +stagestuff="" + +# Per GCC Steering Committee. +build_by_default="no" + +# 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++" +subdir_requires="objc cp" + +# APPLE LOCAL objcp added class.c +gtfiles="\$(srcdir)/objcp/objcp-decl.c \$(srcdir)/objc/objc-act.c \$(srcdir)/objc/objc-act.h \$(srcdir)/cp/rtti.c \$(srcdir)/cp/mangle.c \$(srcdir)/cp/name-lookup.h \$(srcdir)/cp/name-lookup.c \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/semantics.c \$(srcdir)/cp/tree.c \$(srcdir)/cp/parser.c \$(srcdir)/cp/method.c \$(srcdir)/cp/typeck2.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-lex.c \$(srcdir)/c-pragma.c \$(srcdir)/cp/cp-objcp-common.c \$(srcdir)/cp/class.c" diff --git a/gcc-4.2.1-5666.3/gcc/objcp/lang-specs.h b/gcc-4.2.1-5666.3/gcc/objcp/lang-specs.h new file mode 100644 index 000000000..2c5af2ad2 --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/lang-specs.h @@ -0,0 +1,61 @@ +/* Definitions for specs for Objective-C++. + Copyright (C) 2005 Free Software Foundation, Inc. + Contributed by Ziemowit Laski <zlaski@apple.com> + +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, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +/* This is the contribution to the `default_compilers' array in gcc.c for + obj-c++. It is based on -- and should be kept in sync with -- the g++ + spec (found in cp/lang-specs.h). */ + +#ifndef CPLUSPLUS_CPP_SPEC +#define CPLUSPLUS_CPP_SPEC 0 +#endif + + {".mm", "@objective-c++", 0, 0, 0}, + {".M", "@objective-c++", 0, 0, 0}, + {"@objective-c++-header", + "%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\ + %{!E:%{!M:%{!MM:\ + %{save-temps|no-integrated-cpp:cc1objplus -E\ + %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ + cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ + %(cc1_options) %2 %{+e1*}\ + "/* APPLE LOCAL ss2 */" \ + -o %g.s %{!o*:--output-pch=%i.gch} %W{o*:--output-pch=%*} %{fsave-repository=*: \n as %a -o %w%* %g.s %A}%V}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {"@objective-c++", + "%{E|M|MM:cc1objplus -E %(cpp_options) %2 %(cpp_debug_options)}\ + %{!E:%{!M:%{!MM:\ + %{save-temps|no-integrated-cpp:cc1objplus -E\ + %(cpp_options) %2 -o %{save-temps:%b.mii} %{!save-temps:%g.mii} \n}\ + cc1objplus %{save-temps|no-integrated-cpp:-fpreprocessed %{save-temps:%b.mii} %{!save-temps:%g.mii}}\ + %{!save-temps:%{!no-integrated-cpp:%(cpp_unique_options)}}\ + %(cc1_options) %2 %{+e1*}\ + %{!fsyntax-only:%(invoke_as)}}}}", + CPLUSPLUS_CPP_SPEC, 0, 0}, + {".mii", "@objective-c++-cpp-output", 0, 0, 0}, + {"@objective-c++-cpp-output", + "%{!M:%{!MM:%{!E:\ + cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, + {"@objc++-cpp-output", + "%{!M:%{!MM:%{!E:\ + cc1objplus -fpreprocessed %i %(cc1_options) %2 %{+e*}\ + %{!fsyntax-only:%(invoke_as)}}}}", 0, 0, 0}, diff --git a/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.c b/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.c new file mode 100644 index 000000000..88558f1c0 --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.c @@ -0,0 +1,127 @@ +/* Process the ObjC-specific declarations and variables for + the Objective-C++ compiler. + Copyright (C) 2005 Free Software Foundation, Inc. + Contributed by Ziemowit Laski <zlaski@apple.com> + +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, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "rtl.h" +#include "expr.h" +#include "cp-tree.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" + +/* Hacks to simulate start_struct() and finish_struct(). */ + +tree +objcp_start_struct (enum tree_code code ATTRIBUTE_UNUSED, tree name) +{ + tree s; + /* The idea here is to mimic the actions that the C++ parser takes when + constructing 'extern "C" struct NAME {'. */ + push_lang_context (lang_name_c); + + if (!name) + name = make_anon_name (); + + s = xref_tag (record_type, name, ts_global, 0); + CLASSTYPE_DECLARED_CLASS (s) = 0; /* this is a 'struct', not a 'class'. */ + xref_basetypes (s, NULL_TREE); /* no base classes here! */ + + return begin_class_definition (s, NULL_TREE); +} + +tree +objcp_finish_struct (tree t, tree fieldlist, tree attributes) +{ + tree field, next_field; + + 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); + } + t = finish_struct (t, attributes); + /* APPLE LOCAL begin radar 4291785 */ + /* Check for duplicate ivars. */ + field = fieldlist; + if (fieldlist && (fieldlist = objc_get_interface_ivars (fieldlist)) != field) + objc_detect_field_duplicates (fieldlist); + /* APPLE LOCAL end radar 4291785 */ + pop_lang_context (); + + return t; +} + +void +objcp_finish_function (void) +{ + /* The C++ flavor of 'finish_function' does not generate RTL -- one has + to call 'expand_or_defer_fn' to do that. */ + expand_or_defer_fn (finish_function (0)); +} + +tree +objcp_xref_tag (enum tree_code code ATTRIBUTE_UNUSED, tree name) +{ + return xref_tag (record_type, name, ts_global, false); +} + +int +objcp_comptypes (tree type1, tree type2) +{ + return comptypes (type1, type2, COMPARE_STRICT); +} + +tree +objcp_begin_compound_stmt (int flags ATTRIBUTE_UNUSED) +{ + return begin_compound_stmt (0); +} + +tree +objcp_end_compound_stmt (tree stmt, int flags ATTRIBUTE_UNUSED) +{ + /* The following has been snarfed from + cp/semantics.c:finish_compound_stmt(). */ + if (TREE_CODE (stmt) == BIND_EXPR) + BIND_EXPR_BODY (stmt) = do_poplevel (BIND_EXPR_BODY (stmt)); + else if (STATEMENT_LIST_NO_SCOPE (stmt)) + stmt = pop_stmt_list (stmt); + else + stmt = do_poplevel (stmt); + + return stmt; +} diff --git a/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.h b/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.h new file mode 100644 index 000000000..41eafafac --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/objcp-decl.h @@ -0,0 +1,94 @@ +/* Process the ObjC-specific declarations and variables for + the Objective-C++ compiler. + Copyright (C) 2005 Free Software Foundation, Inc. + Contributed by Ziemowit Laski <zlaski@apple.com> + +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, 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301, USA. */ + +#ifndef GCC_OBJCP_DECL_H +#define GCC_OBJCP_DECL_H + +extern tree objcp_start_struct (enum tree_code, tree); +extern tree objcp_finish_struct (tree, tree, tree); +extern void objcp_finish_function (void); +extern tree objcp_build_function_call (tree, tree); +extern tree objcp_xref_tag (enum tree_code, tree); +extern int objcp_comptypes (tree, tree); +extern tree objcp_builtin_function (const char *, tree, int, + enum built_in_class, const char *, tree); +extern tree objcp_begin_compound_stmt (int); +extern tree objcp_end_compound_stmt (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 finish_function() \ + objcp_finish_function () +#define xref_tag(code, name) \ + objcp_xref_tag (code, name) +#define comptypes(type1, type2) \ + objcp_comptypes (type1, type2) +#define c_begin_compound_stmt(flags) \ + objcp_begin_compound_stmt (flags) +#define c_end_compound_stmt(stmt, flags) \ + objcp_end_compound_stmt (stmt, flags) + +#undef OBJC_TYPE_NAME +#define OBJC_TYPE_NAME(type) \ + (TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL \ + ? DECL_NAME (TYPE_NAME (type)) \ + : TYPE_NAME (type)) +#undef OBJC_SET_TYPE_NAME +#define OBJC_SET_TYPE_NAME(type, name) \ + if(TYPE_NAME (type) && TREE_CODE (TYPE_NAME (type)) == TYPE_DECL) \ + DECL_NAME (TYPE_NAME (type)) = name; \ + else \ + TYPE_NAME (type) = name; + +#undef TYPE_OBJC_INFO +#define TYPE_OBJC_INFO(TYPE) LANG_TYPE_CLASS_CHECK (TYPE)->objc_info +#undef SIZEOF_OBJC_TYPE_LANG_SPECIFIC +#define SIZEOF_OBJC_TYPE_LANG_SPECIFIC sizeof (struct lang_type_class) +#undef ALLOC_OBJC_TYPE_LANG_SPECIFIC +#define ALLOC_OBJC_TYPE_LANG_SPECIFIC(NODE) \ + do { \ + TYPE_LANG_SPECIFIC (NODE) = GGC_CNEWVAR \ + (struct lang_type, sizeof (struct lang_type_class)); \ + TYPE_LANG_SPECIFIC (NODE)->u.c.h.is_lang_type_class = 1; \ + } while (0) + +#define OBJCP_ORIGINAL_FUNCTION(name, args) (name)args + +/* APPLE LOCAL begin radar 6386976 */ +#define TYPE_HAS_OBJCXX_INFO(TYPE) \ + (TYPE_LANG_SPECIFIC (TYPE) && TYPE_OBJC_INFO (TYPE)) +/* APPLE LOCAL end radar 6386976 */ + +/* C++ marks ellipsis-free function parameters differently from C. */ +#undef OBJC_VOID_AT_END +#define OBJC_VOID_AT_END void_list_node + +#endif /* OBJCP_REMAP_FUNCTIONS */ + +#endif /* ! GCC_OBJCP_DECL_H */ diff --git a/gcc-4.2.1-5666.3/gcc/objcp/objcp-lang.c b/gcc-4.2.1-5666.3/gcc/objcp/objcp-lang.c new file mode 100644 index 000000000..fd3f3bdc4 --- /dev/null +++ b/gcc-4.2.1-5666.3/gcc/objcp/objcp-lang.c @@ -0,0 +1,238 @@ +/* Language-dependent hooks for Objective-C++. + Copyright 2005 Free Software Foundation, Inc. + Contributed by Ziemowit Laski <zlaski@apple.com> + +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, 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "tree.h" +#include "cp-tree.h" +#include "c-common.h" +#include "toplev.h" +#include "objc-act.h" +/* APPLE LOCAL begin radar 6386976 */ +#define OBJCP_REMAP_FUNCTIONS +#include "objcp-decl.h" +/* APPLE LOCAL end radar 6386976 */ +#include "langhooks.h" +#include "langhooks-def.h" +#include "diagnostic.h" +#include "debug.h" +#include "cp-objcp-common.h" + +enum c_language_kind c_language = clk_objcxx; +static void objcxx_init_ts (void); +/* APPLE LOCAL radar 6386976 */ +static bool objcxx_is_runtime_type (tree); + +/* Lang hooks common to C++ and ObjC++ are declared in cp/cp-objcp-common.h; + consequently, there should be very few hooks below. */ + +#undef LANG_HOOKS_NAME +#define LANG_HOOKS_NAME "GNU Objective-C++" +#undef LANG_HOOKS_INIT +#define LANG_HOOKS_INIT objc_init +#undef LANG_HOOKS_DECL_PRINTABLE_NAME +#define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name +#undef LANG_HOOKS_GIMPLIFY_EXPR +#define LANG_HOOKS_GIMPLIFY_EXPR objc_gimplify_expr +#undef LANG_HOOKS_GET_CALLEE_FNDECL +#define LANG_HOOKS_GET_CALLEE_FNDECL objc_get_callee_fndecl +#undef LANG_HOOKS_INIT_TS +#define LANG_HOOKS_INIT_TS objcxx_init_ts +/* APPLE LOCAL begin radar 3904178 */ +#undef LANG_HOOKS_FOLD_OBJ_TYPE_REF +#define LANG_HOOKS_FOLD_OBJ_TYPE_REF objc_fold_obj_type_ref +/* APPLE LOCAL end radar 3904178 */ +/* APPLE LOCAL begin radar 6386976 */ +#undef LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE +#define LANG_HOOKS_IS_RUNTIME_SPECIFIC_TYPE objcxx_is_runtime_type +/* APPLE LOCAL end radar 6386976 */ + +/* Each front end provides its own lang hook initializer. */ +const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER; + +/* Tree code classes. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) TYPE, + +const enum tree_code_class tree_code_type[] = { +#include "tree.def" + tcc_exceptional, +#include "c-common.def" + tcc_exceptional, +#include "cp-tree.def" + tcc_exceptional, +#include "objc-tree.def" +}; +#undef DEFTREECODE + +/* Table indexed by tree code giving number of expression + operands beyond the fixed part of the node structure. + Not used for types or decls. */ + +#define DEFTREECODE(SYM, NAME, TYPE, LENGTH) LENGTH, + +const unsigned char tree_code_length[] = { +#include "tree.def" + 0, +#include "c-common.def" + 0, +#include "cp-tree.def" + 0, +#include "objc-tree.def" +}; +#undef DEFTREECODE + +/* Names of tree components. + Used for printing out the tree and error messages. */ +#define DEFTREECODE(SYM, NAME, TYPE, LEN) NAME, + +const char *const tree_code_name[] = { +#include "tree.def" + "@@dummy", +#include "c-common.def" + "@@dummy", +#include "cp-tree.def" + "@@dummy", +#include "objc-tree.def" +}; +#undef DEFTREECODE + +/* Lang hook routines common to C++ and ObjC++ appear in cp/cp-objcp-common.c; + there should be very few (if any) routines below. */ + +tree +objcp_tsubst_copy_and_build (tree t, tree args, tsubst_flags_t complain, + tree in_decl, bool function_p ATTRIBUTE_UNUSED) +{ +#define RECURSE(NODE) \ + tsubst_copy_and_build (NODE, args, complain, in_decl, \ + /*function_p=*/false, \ + /*integral_constant_expression_p=*/false) + + /* The following two can only occur in Objective-C++. */ + + switch ((int) TREE_CODE (t)) + { + case MESSAGE_SEND_EXPR: + return objc_finish_message_expr + (RECURSE (TREE_OPERAND (t, 0)), + TREE_OPERAND (t, 1), /* No need to expand the selector. */ + RECURSE (TREE_OPERAND (t, 2))); + + case CLASS_REFERENCE_EXPR: + return objc_get_class_reference + (RECURSE (TREE_OPERAND (t, 0))); + + /* APPLE LOCAL begin radar 5887355 */ + case OBJC_STRING_REFERENCE: + return objc_build_string_object + (RECURSE (TREE_OPERAND (t, 0))); + /* APPLE LOCAL end radar 5887355 */ + + default: + break; + } + + /* Fall back to C++ processing. */ + return NULL_TREE; + +#undef RECURSE +} + +static void +objcxx_init_ts (void) +{ + /* objc decls */ + tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_NON_COMMON] = 1; + tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_NON_COMMON] = 1; + tree_contains_struct[KEYWORD_DECL][TS_DECL_NON_COMMON] = 1; + /* APPLE LOCAL objc v2 */ + tree_contains_struct[PROPERTY_DECL][TS_DECL_NON_COMMON] = 1; + + tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WITH_VIS] = 1; + tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WITH_VIS] = 1; + tree_contains_struct[KEYWORD_DECL][TS_DECL_WITH_VIS] = 1; + /* APPLE LOCAL objc v2 */ + tree_contains_struct[PROPERTY_DECL][TS_DECL_WITH_VIS] = 1; + + tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_WRTL] = 1; + tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_WRTL] = 1; + tree_contains_struct[KEYWORD_DECL][TS_DECL_WRTL] = 1; + /* APPLE LOCAL objc v2 */ + tree_contains_struct[PROPERTY_DECL][TS_DECL_WRTL] = 1; + + tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_MINIMAL] = 1; + tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_MINIMAL] = 1; + tree_contains_struct[KEYWORD_DECL][TS_DECL_MINIMAL] = 1; + /* APPLE LOCAL objc v2 */ + tree_contains_struct[PROPERTY_DECL][TS_DECL_MINIMAL] = 1; + + tree_contains_struct[CLASS_METHOD_DECL][TS_DECL_COMMON] = 1; + tree_contains_struct[INSTANCE_METHOD_DECL][TS_DECL_COMMON] = 1; + tree_contains_struct[KEYWORD_DECL][TS_DECL_COMMON] = 1; + /* APPLE LOCAL objc v2 */ + tree_contains_struct[PROPERTY_DECL][TS_DECL_COMMON] = 1; + + /* C++ decls */ + tree_contains_struct[NAMESPACE_DECL][TS_DECL_NON_COMMON] = 1; + tree_contains_struct[USING_DECL][TS_DECL_NON_COMMON] = 1; + tree_contains_struct[TEMPLATE_DECL][TS_DECL_NON_COMMON] = 1; + + tree_contains_struct[NAMESPACE_DECL][TS_DECL_WITH_VIS] = 1; + tree_contains_struct[USING_DECL][TS_DECL_WITH_VIS] = 1; + tree_contains_struct[TEMPLATE_DECL][TS_DECL_WITH_VIS] = 1; + + tree_contains_struct[NAMESPACE_DECL][TS_DECL_WRTL] = 1; + tree_contains_struct[USING_DECL][TS_DECL_WRTL] = 1; + tree_contains_struct[TEMPLATE_DECL][TS_DECL_WRTL] = 1; + + tree_contains_struct[NAMESPACE_DECL][TS_DECL_COMMON] = 1; + tree_contains_struct[USING_DECL][TS_DECL_COMMON] = 1; + tree_contains_struct[TEMPLATE_DECL][TS_DECL_COMMON] = 1; + + tree_contains_struct[NAMESPACE_DECL][TS_DECL_MINIMAL] = 1; + tree_contains_struct[USING_DECL][TS_DECL_MINIMAL] = 1; + tree_contains_struct[TEMPLATE_DECL][TS_DECL_MINIMAL] = 1; + + init_shadowed_var_for_decl (); +} + + +void +finish_file (void) +{ + objc_finish_file (); +} + +/* APPLE LOCAL begin radar 6386976 */ +static bool +objcxx_is_runtime_type (tree type) +{ + if (TREE_CODE (type) != RECORD_TYPE) + return false; + else + return (TYPE_HAS_OBJCXX_INFO (type)); +} +/* APPLE LOCAL end radar 6386976 */ + +#include "gtype-objcp.h" |