Makefile.in (C_PRETTY_PRINT_H): Add c-pretty-print.h.
authorZiemowit Laski <zlaski@apple.com>
Sun, 15 Aug 2004 21:47:32 +0000 (21:47 +0000)
committerZiemowit Laski <zlaski@gcc.gnu.org>
Sun, 15 Aug 2004 21:47:32 +0000 (21:47 +0000)
[gcc/ChangeLog]
2004-08-15  Ziemowit Laski  <zlaski@apple.com>

       * Makefile.in (C_PRETTY_PRINT_H): Add c-pretty-print.h.
       (c-lang.o): Depend on c-objc-common.h.
       (c-objc-common.o): Depend on $(C_PRETTY_PRINT_H) and
       c-objc-common.h; remove duplicate $(C_TREE_H) dependency.
       * c-lang.c: Include c-objc-common.h.
       (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS,
       LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION,
       LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS,
       LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P,
       LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE,
       LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION,
       LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL,
       LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME,
       LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL,
       LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED,
       LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL,
       LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT,
       LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
       LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
       LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
       LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P,
       LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING,
       LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS,
       LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN,
       LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE,
       LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE,
       LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE,
       LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO,
       LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS):
       Move to c-objc-common.h.
       * c-objc-common.c: Include c-objc-common.h.
       * c-objc-common.h: New file.

[gcc/objc/ChangeLog]
2004-08-15  Ziemowit Laski  <zlaski@apple.com>

       * Make-lang.in (objc/objc-lang.o): Depend on $(C_PRETTY_PRINT_H),
       $(DIAGNOSTIC_H), c-objc-common.h and gtype-objc.h, but not on toplev.h.
       (objc/objc-parse.o): Do not depend on gtype-objc.h.
       * objc-act.c: Do not include gtype-objc.h.
       (finish_file): Rename to objc_finish_file().
       * objc-act.h (finish_file): Update copyright notice; remove prototype.
       * objc-lang.c: Update copyright notice; include diagnostic.h,
       c-objc-common.h, c-pretty-print.h and gtype-objc.h; do not include
       toplev.h.
       (finish_file): New hook routine.
       (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS,
       LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION,
       LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS,
       LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P,
       LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE,
       LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION,
       LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL,
       LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME,
       LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL,
       LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED,
       LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL,
       LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT,
       LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
       LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
       LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
       LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P,
       LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING,
       LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS,
       LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN,
       LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE,
       LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE,
       LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE,
       LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO,
       LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS):
       Move to c-objc-common.h.

From-SVN: r86037

gcc/ChangeLog
gcc/Makefile.in
gcc/c-lang.c
gcc/c-objc-common.c
gcc/c-objc-common.h [new file with mode: 0644]
gcc/objc/ChangeLog [new file with mode: 0644]
gcc/objc/Make-lang.in
gcc/objc/objc-act.c
gcc/objc/objc-act.h
gcc/objc/objc-lang.c

index f223443922653dd33e85184f8051617068fb4967..430dc1960e4de8c188b94c824decd16e23cedcf1 100644 (file)
@@ -1,3 +1,38 @@
+2004-08-15  Ziemowit Laski  <zlaski@apple.com>
+
+       * Makefile.in (C_PRETTY_PRINT_H): Add c-pretty-print.h.
+       (c-lang.o): Depend on c-objc-common.h.
+       (c-objc-common.o): Depend on $(C_PRETTY_PRINT_H) and 
+       c-objc-common.h; remove duplicate $(C_TREE_H) dependency.
+       * c-lang.c: Include c-objc-common.h.
+       (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS,
+       LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION,
+       LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS,
+       LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P, 
+       LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE, 
+       LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION,
+       LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL,
+       LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, 
+       LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL,
+       LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED,
+       LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL,
+       LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT,
+       LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
+       LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
+       LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
+       LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P,
+       LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING,
+       LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS,
+       LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN,
+       LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE,
+       LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE,
+       LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE,
+       LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO,
+       LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS):
+       Move to c-objc-common.h.
+       * c-objc-common.c: Include c-objc-common.h.
+       * c-objc-common.h: New file.
+
 2004-08-15  Andreas Tobler  <a.tobler@schweiz.ch>
            Andrew Pinski  <pinskia@physics.uc.edu>
 
index 1358b01546499bfbf70da6592d9487d85cd46354..6f54478a5472762d46a9efd58bd7c8aaf9319119 100644 (file)
@@ -729,7 +729,7 @@ TREE_FLOW_H = tree-flow.h tree-flow-inline.h tree-ssa-operands.h \
 TREE_SSA_LIVE_H = tree-ssa-live.h $(PARTITION_H)
 PRETTY_PRINT_H = pretty-print.h input.h $(OBSTACK_H)
 DIAGNOSTIC_H = diagnostic.h diagnostic.def $(PRETTY_PRINT_H)
-C_PRETTY_PRINT_H = $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
+C_PRETTY_PRINT_H = c-pretty-print.h $(PRETTY_PRINT_H) $(C_COMMON_H) $(TREE_H)
 SCEV_H = tree-scalar-evolution.h $(GGC_H) tree-chrec.h
 
 #\f
@@ -1371,7 +1371,8 @@ c-typeck.o : c-typeck.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(
     langhooks.h
 c-lang.o : c-lang.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \
-    $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h
+    $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-c.h \
+    c-objc-common.h
 stub-objc.o : stub-objc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TREE_H) \
     $(GGC_H) $(C_COMMON_H)
 c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
@@ -1381,9 +1382,9 @@ c-lex.o : c-lex.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
 c-ppoutput.o : c-ppoutput.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
     $(C_COMMON_H) $(TREE_H) $(CPPLIB_H) $(srcdir)/../libcpp/internal.h $(TM_P_H) $(C_PRAGMA_H)
 c-objc-common.o : c-objc-common.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
-    $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) $(C_TREE_H) \
+    $(C_TREE_H) $(RTL_H) insn-config.h $(INTEGRATE_H) $(EXPR_H) \
     $(FLAGS_H) toplev.h tree-inline.h $(DIAGNOSTIC_H) $(VARRAY_H) \
-    langhooks.h $(GGC_H) $(TARGET_H) cgraph.h
+    langhooks.h $(GGC_H) $(TARGET_H) cgraph.h $(C_PRETTY_PRINT_H) c-objc-common.h
 c-aux-info.o : c-aux-info.c  $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
     $(C_TREE_H) $(FLAGS_H) toplev.h
 c-convert.o : c-convert.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
index 72d21010c29292ee35430b40e0e9ba97dda9831d..af4932a83ced2fb5de7364d087fb7c2ad9a1b16f 100644 (file)
@@ -33,123 +33,21 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "tree-inline.h"
 #include "diagnostic.h"
 #include "c-pretty-print.h"
+#include "c-objc-common.h"
 
 enum c_language_kind c_language = clk_c;
 
-/* ### When changing hooks, consider if ObjC needs changing too!! ### */
+/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
+   consequently, there should be very few hooks below.  */
 
 #undef LANG_HOOKS_NAME
 #define LANG_HOOKS_NAME "GNU C"
-#undef LANG_HOOKS_IDENTIFIER_SIZE
-#define LANG_HOOKS_IDENTIFIER_SIZE C_SIZEOF_STRUCT_LANG_IDENTIFIER
 #undef LANG_HOOKS_INIT
 #define LANG_HOOKS_INIT c_objc_common_init
-#undef LANG_HOOKS_FINISH
-#define LANG_HOOKS_FINISH c_common_finish
-#undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
-#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
-#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS c_initialize_diagnostics
-#undef LANG_HOOKS_HANDLE_OPTION
-#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
-#undef LANG_HOOKS_MISSING_ARGUMENT
-#define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument
-#undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS c_common_post_options
-#undef LANG_HOOKS_GET_ALIAS_SET
-#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
-#undef LANG_HOOKS_EXPAND_EXPR
-#define LANG_HOOKS_EXPAND_EXPR c_expand_expr
-#undef LANG_HOOKS_EXPAND_DECL
-#define LANG_HOOKS_EXPAND_DECL c_expand_decl
-#undef LANG_HOOKS_MARK_ADDRESSABLE
-#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
-#undef LANG_HOOKS_PARSE_FILE
-#define LANG_HOOKS_PARSE_FILE c_common_parse_file
-#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
-#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
-#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
-#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
-#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
-#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
-#undef LANG_HOOKS_STATICP
-#define LANG_HOOKS_STATICP c_staticp
-#undef LANG_HOOKS_NO_BODY_BLOCKS
-#define LANG_HOOKS_NO_BODY_BLOCKS true
-#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
-#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
-#undef LANG_HOOKS_PRINT_IDENTIFIER
-#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
-#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
-#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
-#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
-#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
-#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
-#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
-#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
-#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
-
-/* Attribute hooks.  */
-#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
-#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
-#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
-#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
-
-#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
-#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
-  c_cannot_inline_tree_fn
-#undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
-#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
-  c_disregard_inline_limits
-#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
-#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
-  anon_aggr_type_p
-#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
-#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
-  c_convert_parm_for_inlining
-#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
-#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN c_dump_tree
-
-#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
-
-#undef LANG_HOOKS_TYPE_FOR_MODE
-#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
-#undef LANG_HOOKS_TYPE_FOR_SIZE
-#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
-#undef LANG_HOOKS_SIGNED_TYPE
-#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
-#undef LANG_HOOKS_UNSIGNED_TYPE
-#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
-#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
-#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
-#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
-#undef LANG_HOOKS_TYPE_PROMOTES_TO
-#define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
-#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
-#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
-
-/* The C front end's scoping structure is very different from
-   that expected by the language-independent code; it is best
-   to disable getdecls.
-   This means it must also provide its own write_globals.  */
-
-#undef LANG_HOOKS_GETDECLS
-#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
-#undef LANG_HOOKS_WRITE_GLOBALS
-#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
-
-/* Hooks for tree gimplification.  */
-#undef LANG_HOOKS_GIMPLIFY_EXPR
-#define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr
-
 #undef LANG_HOOKS_TYPES_COMPATIBLE_P
 #define LANG_HOOKS_TYPES_COMPATIBLE_P c_types_compatible_p
 
-/* ### When changing hooks, consider if ObjC needs changing too!! ### */
-
-/* Each front end provides its own.  */
+/* Each front end provides its own lang hook initializer.  */
 const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
 /* Tree code classes.  */
index 69f0810df8646825aaf1864e186b2412cdd33f0d..a4bb683ca937ca0c9a1cfbddd088e6bed977dc8e 100644 (file)
@@ -38,6 +38,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "langhooks.h"
 #include "tree-mudflap.h"
 #include "target.h"
+#include "c-objc-common.h"
 
 static bool c_tree_printer (pretty_printer *, text_info *);
 
diff --git a/gcc/c-objc-common.h b/gcc/c-objc-common.h
new file mode 100644 (file)
index 0000000..48b22a1
--- /dev/null
@@ -0,0 +1,133 @@
+/* Language hooks common to C and ObjC front ends.
+   Copyright (C) 2004 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, 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.  */
+
+#ifndef GCC_C_OBJC_COMMON
+#define GCC_C_OBJC_COMMON
+
+/* In c-objc-common.c.  */
+extern void c_initialize_diagnostics (diagnostic_context *);
+
+/* Lang hooks that are shared between C and ObjC are defined here.  Hooks
+   specific to C or ObjC go in c-lang.c and objc/objc-lang.c, respectively.  */
+
+#undef LANG_HOOKS_IDENTIFIER_SIZE
+#define LANG_HOOKS_IDENTIFIER_SIZE C_SIZEOF_STRUCT_LANG_IDENTIFIER
+#undef LANG_HOOKS_FINISH
+#define LANG_HOOKS_FINISH c_common_finish
+#undef LANG_HOOKS_INIT_OPTIONS
+#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
+#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
+#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS c_initialize_diagnostics
+#undef LANG_HOOKS_HANDLE_OPTION
+#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
+#undef LANG_HOOKS_MISSING_ARGUMENT
+#define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument
+#undef LANG_HOOKS_POST_OPTIONS
+#define LANG_HOOKS_POST_OPTIONS c_common_post_options
+#undef LANG_HOOKS_GET_ALIAS_SET
+#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
+#undef LANG_HOOKS_EXPAND_EXPR
+#define LANG_HOOKS_EXPAND_EXPR c_expand_expr
+#undef LANG_HOOKS_EXPAND_DECL
+#define LANG_HOOKS_EXPAND_DECL c_expand_decl
+#undef LANG_HOOKS_MARK_ADDRESSABLE
+#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
+#undef LANG_HOOKS_PARSE_FILE
+#define LANG_HOOKS_PARSE_FILE c_common_parse_file
+#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
+#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
+#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
+#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
+#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
+#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
+#undef LANG_HOOKS_STATICP
+#define LANG_HOOKS_STATICP c_staticp
+#undef LANG_HOOKS_NO_BODY_BLOCKS
+#define LANG_HOOKS_NO_BODY_BLOCKS true
+#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
+#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
+#undef LANG_HOOKS_PRINT_IDENTIFIER
+#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
+#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
+#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
+#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
+#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
+#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
+#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
+#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
+#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
+
+/* Attribute hooks.  */
+#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
+#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
+#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
+#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
+
+#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
+#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
+  c_cannot_inline_tree_fn
+#undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
+#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
+  c_disregard_inline_limits
+#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
+#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
+  anon_aggr_type_p
+#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
+#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
+  c_convert_parm_for_inlining
+#undef LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN
+#define LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN c_dump_tree
+
+#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
+#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
+
+#undef LANG_HOOKS_TYPE_FOR_MODE
+#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
+#undef LANG_HOOKS_TYPE_FOR_SIZE
+#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
+#undef LANG_HOOKS_SIGNED_TYPE
+#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
+#undef LANG_HOOKS_UNSIGNED_TYPE
+#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
+#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
+#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
+#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
+#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
+#undef LANG_HOOKS_TYPE_PROMOTES_TO
+#define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
+#undef LANG_HOOKS_REGISTER_BUILTIN_TYPE
+#define LANG_HOOKS_REGISTER_BUILTIN_TYPE c_register_builtin_type
+
+/* The C front end's scoping structure is very different from
+   that expected by the language-independent code; it is best
+   to disable getdecls.
+   This means it must also provide its own write_globals.  */
+
+#undef LANG_HOOKS_GETDECLS
+#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
+#undef LANG_HOOKS_WRITE_GLOBALS
+#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
+
+/* Hooks for tree gimplification.  */
+#undef LANG_HOOKS_GIMPLIFY_EXPR
+#define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr
+
+#endif /* GCC_C_OBJC_COMMON */
diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog
new file mode 100644 (file)
index 0000000..d9f42f9
--- /dev/null
@@ -0,0 +1,37 @@
+2004-08-15  Ziemowit Laski  <zlaski@apple.com>
+
+       * Make-lang.in (objc/objc-lang.o): Depend on $(C_PRETTY_PRINT_H),
+       $(DIAGNOSTIC_H), c-objc-common.h and gtype-objc.h, but not on toplev.h.
+       (objc/objc-parse.o): Do not depend on gtype-objc.h.
+       * objc-act.c: Do not include gtype-objc.h.
+       (finish_file): Rename to objc_finish_file().
+       * objc-act.h (finish_file): Update copyright notice; remove prototype.
+       * objc-lang.c: Update copyright notice; include diagnostic.h,
+       c-objc-common.h, c-pretty-print.h and gtype-objc.h; do not include
+       toplev.h.
+       (finish_file): New hook routine.
+       (LANG_HOOKS_FINISH, LANG_HOOKS_INIT_OPTIONS,
+       LANG_HOOKS_INITIALIZE_DIAGNOSTICS, LANG_HOOKS_HANDLE_OPTION,
+       LANG_HOOKS_MISSING_ARGUMENT, LANG_HOOKS_POST_OPTIONS,
+       LANG_HOOKS_GET_ALIAS_SET, LANG_HOOKS_SAFE_FROM_P, 
+       LANG_HOOKS_EXPAND_EXPR, LANG_HOOKS_MARK_ADDRESSABLE, 
+       LANG_HOOKS_PARSE_FILE, LANG_HOOKS_TRUTHVALUE_CONVERSION,
+       LANG_HOOKS_FINISH_INCOMPLETE_DECL, LANG_HOOKS_UNSAFE_FOR_REEVAL,
+       LANG_HOOKS_STATICP, LANG_HOOKS_SET_DECL_ASSEMBLER_NAME, 
+       LANG_HOOKS_NO_BODY_BLOCKS, LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL,
+       LANG_HOOKS_PRINT_IDENTIFIER, LANG_HOOKS_FUNCTION_ENTER_NESTED,
+       LANG_HOOKS_FUNCTION_LEAVE_NESTED, LANG_HOOKS_DUP_LANG_SPECIFIC_DECL,
+       LANG_HOOKS_DECL_UNINIT, LANG_HOOKS_RTL_EXPAND_STMT,
+       LANG_HOOKS_COMMON_ATTRIBUTE_TABLE, LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE,
+       LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN,
+       LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS,
+       LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P,
+       LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING,
+       LANG_HOOKS_TREE_INLINING_ESTIMATE_NUM_INSNS,
+       LANG_HOOKS_TREE_DUMP_DUMP_TREE_FN,
+       LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION, LANG_HOOKS_TYPE_FOR_MODE,
+       LANG_HOOKS_TYPE_FOR_SIZE, LANG_HOOKS_SIGNED_TYPE,
+       LANG_HOOKS_UNSIGNED_TYPE, LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE,
+       LANG_HOOKS_INCOMPLETE_TYPE_ERROR, LANG_HOOKS_TYPE_PROMOTES_TO,
+       LANG_HOOKS_REGISTER_BUILTIN_TYPE, LANG_HOOKS_WRITE_GLOBALS):
+       Move to c-objc-common.h.
index 12a20569c67761ec2ee5b009646b82ed2804df51..a6d93b208d128811be91036dc26ff32c811160c9 100644 (file)
@@ -59,8 +59,10 @@ cc1obj$(exeext): $(OBJC_OBJS) $(C_AND_OBJC_OBJS) $(BACKEND) $(LIBDEPS)
 # Objective C language specific files.
 
 objc/objc-lang.o : objc/objc-lang.c \
-   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) c-tree.h \
-   c-common.h toplev.h objc/objc-act.h langhooks.h $(LANGHOOKS_DEF_H)
+   $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
+   $(C_TREE_H) $(C_PRETTY_PRINT_H) $(DIAGNOSTIC_H) \
+   $(GGC_H) langhooks.h $(LANGHOOKS_DEF_H) $(C_COMMON_H) gtype-objc.h \
+   c-objc-common.h objc/objc-act.h
 
 objc/objc-parse.o : objc/objc-parse.c \
    $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(C_TREE_H) \
@@ -71,7 +73,7 @@ objc/objc-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) $(C_TREE_H) diagnostic.h toplev.h flags.h \
    objc/objc-act.h input.h function.h output.h debug.h langhooks.h \
-   $(LANGHOOKS_DEF_H) gt-objc-objc-act.h gtype-objc.h
+   $(LANGHOOKS_DEF_H) gt-objc-objc-act.h
 
 objc.srcextra: objc/objc-parse.c objc/objc-parse.y
        -cp -p $^ $(srcdir)/objc
index b718714c9964ae87dd949c29f39c19a78c3ad60c..a97ca68d50feeb6179c4b5861fd11894e59c751a 100644 (file)
@@ -516,7 +516,7 @@ objc_init (void)
 }
 
 void
-finish_file (void)
+objc_finish_file (void)
 {
   mark_referenced_methods ();
 
@@ -9086,4 +9086,3 @@ lookup_objc_ivar (tree id)
 }
 
 #include "gt-objc-objc-act.h"
-#include "gtype-objc.h"
index dab0950c3f1af48b3a5d3e98475ba50124c40f1d..eb324b9c52070a68a47e9360626725d4ee0cb960 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations for objc-act.c.
-   Copyright (C) 1990, 2000, 2001, 2002, 2003
+   Copyright (C) 1990, 2000, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -22,14 +22,14 @@ Boston, MA 02111-1307, USA.  */
 #ifndef GCC_OBJC_ACT_H
 #define GCC_OBJC_ACT_H
 
-/*** Public Interface (procedures) ***/
+/*** Language hooks ***/
 
 bool objc_init (void);
 const char *objc_printable_name (tree, int);
+void objc_finish_file (void);
 
 /* used by yyparse */
 
-void finish_file (void);
 tree start_class (enum tree_code, tree, tree, tree);
 tree continue_class (tree);
 void finish_class (tree);
index 5856ad599d3358306b0d0b47f2c8650ddc1aa465..0b657725306d8abd2718ef744a6b975b8c42e9c9 100644 (file)
@@ -26,123 +26,28 @@ Boston, MA 02111-1307, USA.  */
 #include "tree.h"
 #include "c-tree.h"
 #include "c-common.h"
-#include "toplev.h"
+#include "ggc.h"
 #include "objc-act.h"
 #include "langhooks.h"
 #include "langhooks-def.h"
+#include "diagnostic.h"
+#include "c-pretty-print.h"
+#include "c-objc-common.h"
 
 enum c_language_kind c_language = clk_objc;
 
+/* Lang hooks common to C and ObjC are declared in c-objc-common.h;
+   consequently, there should be very few hooks below.  */
+
 #undef LANG_HOOKS_NAME
 #define LANG_HOOKS_NAME "GNU Objective-C"
-#undef LANG_HOOKS_IDENTIFIER_SIZE
-#define LANG_HOOKS_IDENTIFIER_SIZE C_SIZEOF_STRUCT_LANG_IDENTIFIER
 #undef LANG_HOOKS_INIT
 #define LANG_HOOKS_INIT objc_init
-#undef LANG_HOOKS_FINISH
-#define LANG_HOOKS_FINISH c_common_finish
-#undef LANG_HOOKS_INIT_OPTIONS
-#define LANG_HOOKS_INIT_OPTIONS c_common_init_options
-#undef LANG_HOOKS_INITIALIZE_DIAGNOSTICS
-#define LANG_HOOKS_INITIALIZE_DIAGNOSTICS c_initialize_diagnostics
-#undef LANG_HOOKS_HANDLE_OPTION
-#define LANG_HOOKS_HANDLE_OPTION c_common_handle_option
-#undef LANG_HOOKS_HANDLE_FILENAME
-#define LANG_HOOKS_HANDLE_FILENAME c_common_handle_filename
-#undef LANG_HOOKS_MISSING_ARGUMENT
-#define LANG_HOOKS_MISSING_ARGUMENT c_common_missing_argument
-#undef LANG_HOOKS_POST_OPTIONS
-#define LANG_HOOKS_POST_OPTIONS c_common_post_options
-#undef LANG_HOOKS_GET_ALIAS_SET
-#define LANG_HOOKS_GET_ALIAS_SET c_common_get_alias_set
-#undef LANG_HOOKS_PARSE_FILE
-#define LANG_HOOKS_PARSE_FILE c_common_parse_file
-#undef LANG_HOOKS_EXPAND_EXPR
-#define LANG_HOOKS_EXPAND_EXPR c_expand_expr
-#undef LANG_HOOKS_EXPAND_DECL
-#define LANG_HOOKS_EXPAND_DECL c_expand_decl
-#undef LANG_HOOKS_MARK_ADDRESSABLE
-#define LANG_HOOKS_MARK_ADDRESSABLE c_mark_addressable
-#undef LANG_HOOKS_TRUTHVALUE_CONVERSION
-#define LANG_HOOKS_TRUTHVALUE_CONVERSION c_objc_common_truthvalue_conversion
-#undef LANG_HOOKS_FINISH_INCOMPLETE_DECL
-#define LANG_HOOKS_FINISH_INCOMPLETE_DECL c_finish_incomplete_decl
-#undef LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS
-#define LANG_HOOKS_REDUCE_BIT_FIELD_OPERATIONS true
-#undef LANG_HOOKS_STATICP
-#define LANG_HOOKS_STATICP c_staticp
-#undef LANG_HOOKS_NO_BODY_BLOCKS
-#define LANG_HOOKS_NO_BODY_BLOCKS true
-#undef LANG_HOOKS_DUP_LANG_SPECIFIC_DECL
-#define LANG_HOOKS_DUP_LANG_SPECIFIC_DECL c_dup_lang_specific_decl
-#undef LANG_HOOKS_PRINT_IDENTIFIER
-#define LANG_HOOKS_PRINT_IDENTIFIER c_print_identifier
 #undef LANG_HOOKS_DECL_PRINTABLE_NAME
 #define LANG_HOOKS_DECL_PRINTABLE_NAME objc_printable_name
-#undef LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL
-#define LANG_HOOKS_WARN_UNUSED_GLOBAL_DECL c_warn_unused_global_decl
-
-#undef LANG_HOOKS_FUNCTION_ENTER_NESTED
-#define LANG_HOOKS_FUNCTION_ENTER_NESTED c_push_function_context
-#undef LANG_HOOKS_FUNCTION_LEAVE_NESTED
-#define LANG_HOOKS_FUNCTION_LEAVE_NESTED c_pop_function_context
-#undef LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P
-#define LANG_HOOKS_FUNCTION_MISSING_NORETURN_OK_P c_missing_noreturn_ok_p
-
-/* Attribute hooks.  */
-#undef LANG_HOOKS_COMMON_ATTRIBUTE_TABLE
-#define LANG_HOOKS_COMMON_ATTRIBUTE_TABLE c_common_attribute_table
-#undef LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE
-#define LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE c_common_format_attribute_table
-
-/* Inlining hooks same as the C front end.  */
-#undef LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN
-#define LANG_HOOKS_TREE_INLINING_CANNOT_INLINE_TREE_FN \
-  c_cannot_inline_tree_fn
-#undef LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS
-#define LANG_HOOKS_TREE_INLINING_DISREGARD_INLINE_LIMITS \
-  c_disregard_inline_limits
-#undef LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P
-#define LANG_HOOKS_TREE_INLINING_ANON_AGGR_TYPE_P \
-  anon_aggr_type_p
-#undef LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING
-#define LANG_HOOKS_TREE_INLINING_CONVERT_PARM_FOR_INLINING \
-  c_convert_parm_for_inlining
-
-#undef LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION
-#define LANG_HOOKS_CALLGRAPH_EXPAND_FUNCTION c_expand_body
-
-#undef LANG_HOOKS_TYPE_FOR_MODE
-#define LANG_HOOKS_TYPE_FOR_MODE c_common_type_for_mode
-#undef LANG_HOOKS_TYPE_FOR_SIZE
-#define LANG_HOOKS_TYPE_FOR_SIZE c_common_type_for_size
-#undef LANG_HOOKS_SIGNED_TYPE
-#define LANG_HOOKS_SIGNED_TYPE c_common_signed_type
-#undef LANG_HOOKS_UNSIGNED_TYPE
-#define LANG_HOOKS_UNSIGNED_TYPE c_common_unsigned_type
-#undef LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE
-#define LANG_HOOKS_SIGNED_OR_UNSIGNED_TYPE c_common_signed_or_unsigned_type
-#undef LANG_HOOKS_INCOMPLETE_TYPE_ERROR
-#define LANG_HOOKS_INCOMPLETE_TYPE_ERROR c_incomplete_type_error
-#undef LANG_HOOKS_TYPE_PROMOTES_TO
-#define LANG_HOOKS_TYPE_PROMOTES_TO c_type_promotes_to
-#undef  LANG_HOOKS_GIMPLIFY_EXPR
-#define LANG_HOOKS_GIMPLIFY_EXPR c_gimplify_expr
-
-/* The C front end's scoping structure is very different from
-   that expected by the language-independent code; it is best
-   to disable getdecls.
-   This means it must also provide its own write_globals.  */
-
-#undef LANG_HOOKS_GETDECLS
-#define LANG_HOOKS_GETDECLS lhd_return_null_tree_v
-#undef LANG_HOOKS_WRITE_GLOBALS
-#define LANG_HOOKS_WRITE_GLOBALS c_write_global_declarations
-
-/* Each front end provides its own hooks, for toplev.c.  */
-const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
-/* Define the special tree codes that we use.  */
+/* Each front end provides its own lang hook initializer.  */
+const struct lang_hooks lang_hooks = LANG_HOOKS_INITIALIZER;
 
 /* Table indexed by tree code giving a string containing a character
    classifying the tree code.  */
@@ -185,3 +90,14 @@ const char * const tree_code_name[] = {
 #include "objc-tree.def"
 };
 #undef DEFTREECODE
+
+/* Lang hook routines common to C and ObjC appear in c-objc-common.c;
+   there should be very few (if any) routines below.  */
+
+void
+finish_file (void)
+{
+  objc_finish_file ();
+}
+
+#include "gtype-objc.h"