OSDN Git Service

Replace inclusion of <stdio.h> with "system.h"
[pf3gnuchains/gcc-fork.git] / gcc / c-lang.c
index 918bf6a..331ff54 100644 (file)
@@ -1,5 +1,6 @@
 /* Language-specific hook definitions for C front end.
-   Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1991, 1995, 1997, 1998,
+   1999, 2000 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -22,11 +23,21 @@ Boston, MA 02111-1307, USA.  */
 #include "config.h"
 #include "system.h"
 #include "tree.h"
+#include "function.h"
 #include "input.h"
 #include "c-tree.h"
 #include "c-lex.h"
 #include "toplev.h"
 #include "output.h"
+#include "flags.h"
+#include "ggc.h"
+
+#if USE_CPPLIB
+#include "cpplib.h"
+extern char *yy_cur;
+extern cpp_reader  parse_in;
+extern cpp_options parse_options;
+#endif
 
 /* Each of the functions defined here
    is an alternative to a function in objc-actions.c.  */
@@ -42,17 +53,37 @@ lang_decode_option (argc, argv)
 void
 lang_init_options ()
 {
+#if USE_CPPLIB
+  cpp_reader_init (&parse_in);
+  parse_in.opts = &parse_options;
+  cpp_options_init (&parse_options);
+#endif
+  /* Mark as "unspecified".  */
+  flag_bounds_check = -1;
 }
 
 void
 lang_init ()
 {
-#if !USE_CPPLIB
+  /* If still "unspecified", make it match -fbounded-pointers.  */
+  if (flag_bounds_check < 0)
+    flag_bounds_check = flag_bounded_pointers;
+
   /* the beginning of the file is a new line; check for # */
   /* With luck, we discover the real source file's name from that
      and put it in input_filename.  */
+#if !USE_CPPLIB
   ungetc (check_newline (), finput);
-#endif
+#else
+  check_newline ();
+  yy_cur--;
+#endif 
+
+  save_lang_status = &push_c_function_context;
+  restore_lang_status = &pop_c_function_context;
+  mark_lang_status = &mark_c_function_context;
+
+  c_parse_init ();
 }
 
 void
@@ -60,7 +91,7 @@ lang_finish ()
 {
 }
 
-char *
+const char *
 lang_identify ()
 {
   return "c";
@@ -134,24 +165,12 @@ recognize_objc_keyword ()
 tree
 build_objc_string (len, str)
     int len ATTRIBUTE_UNUSED;
-    char *str ATTRIBUTE_UNUSED;
+    const char *str ATTRIBUTE_UNUSED;
 {
   abort ();
   return NULL_TREE;
 }
 
-void
-GNU_xref_begin ()
-{
-  fatal ("GCC does not yet support XREF");
-}
-
-void
-GNU_xref_end ()
-{
-  fatal ("GCC does not yet support XREF");
-}
-
 /* Called at end of parsing, but before end-of-file processing.  */
 
 void
@@ -163,18 +182,20 @@ finish_file ()
 #ifndef ASM_OUTPUT_DESTRUCTOR
   extern tree static_dtors;
 #endif
-  extern tree build_function_call                 PROTO((tree, tree));
+  extern tree build_function_call                 PARAMS ((tree, tree));
 #if !defined(ASM_OUTPUT_CONSTRUCTOR) || !defined(ASM_OUTPUT_DESTRUCTOR)
-  tree void_list_node = build_tree_list (NULL_TREE, void_type_node);
+  tree void_list_node_1 = build_tree_list (NULL_TREE, void_type_node);
 #endif
 #ifndef ASM_OUTPUT_CONSTRUCTOR
   if (static_ctors)
     {
       tree fnname = get_file_function_name ('I');
-      start_function (void_list_node,
-                     build_parse_node (CALL_EXPR, fnname, void_list_node,
+      start_function (void_list_node_1,
+                     build_parse_node (CALL_EXPR, fnname, 
+                                       tree_cons (NULL_TREE, NULL_TREE, 
+                                                  void_list_node_1),
                                        NULL_TREE),
-                     NULL_TREE, NULL_TREE, 0);
+                     NULL_TREE, NULL_TREE);
       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
       store_parm_decls ();
 
@@ -191,10 +212,12 @@ finish_file ()
   if (static_dtors)
     {
       tree fnname = get_file_function_name ('D');
-      start_function (void_list_node,
-                     build_parse_node (CALL_EXPR, fnname, void_list_node,
+      start_function (void_list_node_1,
+                     build_parse_node (CALL_EXPR, fnname, 
+                                       tree_cons (NULL_TREE, NULL_TREE,
+                                                  void_list_node_1),
                                        NULL_TREE),
-                     NULL_TREE, NULL_TREE, 0);
+                     NULL_TREE, NULL_TREE);
       fnname = DECL_ASSEMBLER_NAME (current_function_decl);
       store_parm_decls ();