OSDN Git Service

* config/alpha/vms.h (INCLUDE_DEFAULTS): Add /gnu/lib/gcc-lib/include.
[pf3gnuchains/gcc-fork.git] / gcc / ch / lex.c
index 44029b9..8b05f52 100644 (file)
@@ -1,5 +1,6 @@
 /* Lexical analyzer for GNU CHILL. -*- C -*-
-   Copyright (C) 1992, 93, 1994, 1998 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1993, 1994, 1998, 1999, 2000, 2001
+   Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -20,7 +21,6 @@ Boston, MA 02111-1307, USA.  */
 \f
 #include "config.h"
 #include "system.h"
-#include <setjmp.h>
 #include <sys/stat.h>
 
 #include "tree.h"
@@ -32,10 +32,7 @@ Boston, MA 02111-1307, USA.  */
 #include "parse.h"
 #include "obstack.h"
 #include "toplev.h"
-
-#ifdef DWARF_DEBUGGING_INFO
-#include "dwarfout.h"
-#endif
+#include "tm_p.h"
 
 #ifdef MULTIBYTE_CHARS
 #include <locale.h>
@@ -67,26 +64,26 @@ extern struct obstack permanent_obstack;
 extern struct obstack temporary_obstack;
 
 /* forward declarations */
-static void close_input_file         PROTO((const char *));
-static tree convert_bitstring        PROTO((char *));
-static tree convert_integer          PROTO((char *));
-static void maybe_downcase           PROTO((char *));
-static int  maybe_number             PROTO((const char *));
-static tree equal_number             PROTO((void));
-static void handle_use_seizefile_directive PROTO((int));
-static int  handle_name                     PROTO((tree));
-static char *readstring              PROTO((int, int *));
-static void read_directive          PROTO((void));
-static tree read_identifier         PROTO((int));
-static tree read_number              PROTO((int));
-static void skip_c_comment           PROTO((void));
-static void skip_line_comment        PROTO((void));
-static int  skip_whitespace          PROTO((void));
-static tree string_or_char           PROTO((int, const char *));
-static void ch_lex_init              PROTO((void));
-static void skip_directive           PROTO((void));
-static int same_file                 PROTO((const char *, const char *));
-static int getlc                     PROTO((FILE *));
+static void close_input_file         PARAMS ((const char *));
+static tree convert_bitstring        PARAMS ((char *));
+static tree convert_integer          PARAMS ((char *));
+static void maybe_downcase           PARAMS ((char *));
+static int  maybe_number             PARAMS ((const char *));
+static tree equal_number             PARAMS ((void));
+static void handle_use_seizefile_directive PARAMS ((int));
+static int  handle_name                     PARAMS ((tree));
+static char *readstring              PARAMS ((int, int *));
+static void read_directive          PARAMS ((void));
+static tree read_identifier         PARAMS ((int));
+static tree read_number              PARAMS ((int));
+static void skip_c_comment           PARAMS ((void));
+static void skip_line_comment        PARAMS ((void));
+static int  skip_whitespace          PARAMS ((void));
+static tree string_or_char           PARAMS ((int, const char *));
+static void ch_lex_init              PARAMS ((void));
+static void skip_directive           PARAMS ((void));
+static int same_file                 PARAMS ((const char *, const char *));
+static int getlc                     PARAMS ((FILE *));
 
 /* next variables are public, because ch-actions uses them */
 
@@ -196,9 +193,9 @@ ch_lex_init ()
 }
 
 
-char *
+const char *
 init_parse (filename)
-     char *filename;
+     const char *filename;
 {
   int lowercase_standard_names = ignore_case || ! special_UC;
 
@@ -210,8 +207,9 @@ init_parse (filename)
     }
   else
     finput = fopen (filename, "r");
+
   if (finput == 0)
-    pfatal_with_name (filename);
+    fatal_io_error ("can't open %s", filename);
 
 #ifdef IO_BUFFER_SIZE
   setvbuf (finput, (char *) xmalloc (IO_BUFFER_SIZE), _IOFBF, IO_BUFFER_SIZE);
@@ -293,8 +291,8 @@ finish_parse ()
     fclose (finput);
 }
 \f
-static int yywrap PROTO ((void));
-static int yy_refill PROTO ((void));
+static int yywrap PARAMS ((void));
+static int yy_refill PARAMS ((void));
 
 #define YY_PUTBACK_SIZE 5
 #define YY_BUF_SIZE 1000
@@ -887,8 +885,7 @@ maybe_downcase (str)
     return;
   while (*str)
     {
-      if (ISUPPER ((unsigned char) *str))
-       *str = TOLOWER (*str);
+      *str = TOLOWER (*str);
       str++;
     }
 }
@@ -1287,7 +1284,6 @@ convert_bitstring (p)
   
   /* Move p to stack so we can re-use temporary_obstack for result. */
   char *oldp = (char*) alloca (strlen (p) + 1);
-  if (oldp == 0) fatal ("stack space exhausted");
   strcpy (oldp, p);
   obstack_free (&temporary_obstack, p);
   p = oldp;
@@ -1377,16 +1373,16 @@ same_file (filename1, filename2)
   for (i = 0; i < 2; i++)
     {
       stat_status = stat (fn_input[i], &s[i]);
-      if (stat_status < 0 &&
-         strchr (fn_input[i], '/') == 0)
+      if (stat_status < 0
+         && strchr (fn_input[i], '/') == 0)
         {
          STRING_LIST *plp;
-         char        *path;
+         char *path;
          
          for (plp = seize_path_list; plp != 0; plp = plp->next)
            {
-             path = (char *)xmalloc (strlen (fn_input[i]) +
-                                     strlen (plp->str) + 2);
+             path = (char *) xmalloc (strlen (fn_input[i])
+                                      + strlen (plp->str) + 2);
              sprintf (path, "%s/%s", plp->str, fn_input[i]);
              stat_status = stat (path, &s[i]);
              free (path);
@@ -1394,8 +1390,9 @@ same_file (filename1, filename2)
                break;
            }
         }
+
       if (stat_status < 0)
-        pfatal_with_name (fn_input[i]);
+       fatal_io_error ("can't find %s", fn_input[i]);
   }
   return s[0].st_ino == s[1].st_ino && s[0].st_dev == s[1].st_dev;
 }
@@ -1524,9 +1521,9 @@ handle_generic_pragma (buffer)
          * buff ++ = c;
          c = getc (finput);
        }
-      while (c != EOF && isascii (c) && ! ISSPACE (c) && c != '\n'
-            && buff < buffer + 128); /* XXX shared knowledge about size of buffer.  */
-      
+      while (c != EOF && ! ISSPACE (c) && buff < buffer + 128);
+        /* XXX shared knowledge about size of buffer.  */
+
       ungetc (c, finput);
       
       * -- buff = 0;
@@ -1676,7 +1673,7 @@ check_newline ()
              && getlc (finput) == 't'
              && ((c = getlc (finput)) == ' ' || c == '\t'))
            {
-             /* #ident.  The pedantic warning is now in cccp.c.  */
+             /* #ident.  The pedantic warning is now in cpp.  */
 
              /* Here we have just seen `#ident '.
                 A string constant should follow.  */
@@ -2157,7 +2154,7 @@ yywrap ()
   if (next_file_to_seize && !grant_only_flag)
     {
       FILE *grt_in = NULL;
-      char *seizefile_name_chars
+      const char *seizefile_name_chars
        = IDENTIFIER_POINTER (TREE_VALUE (next_file_to_seize));
 
       /* find a seize file, open it.  If it's not at the path the
@@ -2189,7 +2186,7 @@ yywrap ()
        }
 
       if (grt_in == NULL)
-       pfatal_with_name (seizefile_name_chars);
+       fatal_io_error ("can't open %s", seizefile_name_chars);
 
       finput = grt_in;
       input_filename = seizefile_name_chars;