/* Some code common to C and ObjC front ends.
- Copyright (C) 2001 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002 Free Software Foundation, Inc.
This file is part of GCC.
#include "config.h"
#include "system.h"
+#include "coretypes.h"
+#include "tm.h"
#include "tree.h"
#include "rtl.h"
#include "insn-config.h"
#include "ggc.h"
#include "langhooks.h"
#include "target.h"
+#include "cgraph.h"
static bool c_tree_printer PARAMS ((output_buffer *, text_info *));
static tree inline_forbidden_p PARAMS ((tree *, int *, void *));
break;
+ case RECORD_TYPE:
+ case UNION_TYPE:
+ /* We cannot inline a function of the form
+
+ void F (int i) { struct S { int ar[i]; } s; }
+
+ Attempting to do so produces a catch-22 in tree-inline.c.
+ If walk_tree examines the TYPE_FIELDS chain of RECORD_TYPE/
+ UNION_TYPE nodes, then it goes into infinite recursion on a
+ structure containing a pointer to its own type. If it doesn't,
+ then the type node for S doesn't get adjusted properly when
+ F is inlined, and we abort in find_function_data. */
+ for (t = TYPE_FIELDS (node); t; t = TREE_CHAIN (t))
+ if (variably_modified_type_p (TREE_TYPE (t)))
+ return node;
+
default:
break;
}
}
/* Initialization common to C and Objective-C front ends. */
-const char *
-c_objc_common_init (filename)
- const char *filename;
+bool
+c_objc_common_init ()
{
+ static const enum tree_code stmt_codes[] = {
+ c_common_stmt_codes
+ };
+
+ INIT_STATEMENT_CODES (stmt_codes);
+
c_init_decl_processing ();
- filename = c_common_init (filename);
- if (filename == NULL)
- return NULL;
+ if (c_common_init () == false)
+ return false;
lang_expand_decl_stmt = c_expand_decl_stmt;
VARRAY_TREE_INIT (deferred_fns, 32, "deferred_fns");
- return filename;
+ return true;
}
/* Register a function tree, so that its optimization and conversion
void
c_objc_common_finish_file ()
{
- expand_deferred_fns ();
+ if (pch_file)
+ c_common_write_pch ();
+
+ if (flag_unit_at_a_time)
+ {
+ cgraph_finalize_compilation_unit ();
+ cgraph_optimize ();
+ }
+ else
+ expand_deferred_fns ();
if (static_ctors)
{