OSDN Git Service

* config/i386/i386.h: Remove an unnecessary #undef.
[pf3gnuchains/gcc-fork.git] / gcc / cpplex.c
index c148dad..783732f 100644 (file)
@@ -1,5 +1,5 @@
 /* CPP Library - lexical analysis.
-   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
    Contributed by Per Bothner, 1994-95.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -21,20 +21,14 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
-#include "coretypes.h"
-#include "tm.h"
 #include "cpplib.h"
 #include "cpphash.h"
 
-/* Tokens with SPELL_STRING store their spelling in the token list,
-   and it's length in the token->val.name.len.  */
 enum spell_type
 {
   SPELL_OPERATOR = 0,
-  SPELL_CHAR,
   SPELL_IDENT,
-  SPELL_NUMBER,
-  SPELL_STRING,
+  SPELL_LITERAL,
   SPELL_NONE
 };
 
@@ -48,7 +42,7 @@ static const unsigned char *const digraph_spellings[] =
 { U"%:", U"%:%:", U"<:", U":>", U"<%", U"%>" };
 
 #define OP(e, s) { SPELL_OPERATOR, U s           },
-#define TK(e, s) { s,              U STRINGX (e) },
+#define TK(e, s) { s,              U #e },
 static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
 #undef OP
 #undef TK
@@ -56,21 +50,21 @@ static const struct token_spelling token_spellings[N_TTYPES] = { TTYPE_TABLE };
 #define TOKEN_SPELL(token) (token_spellings[(token)->type].category)
 #define TOKEN_NAME(token) (token_spellings[(token)->type].name)
 
-static void add_line_note PARAMS ((cpp_buffer *, const uchar *, unsigned int));
-static int skip_line_comment PARAMS ((cpp_reader *));
-static void skip_whitespace PARAMS ((cpp_reader *, cppchar_t));
-static cpp_hashnode *lex_identifier PARAMS ((cpp_reader *, const uchar *));
-static void lex_number PARAMS ((cpp_reader *, cpp_string *));
-static bool forms_identifier_p PARAMS ((cpp_reader *, int));
-static void lex_string PARAMS ((cpp_reader *, cpp_token *));
-static void save_comment PARAMS ((cpp_reader *, cpp_token *, const uchar *,
-                                 cppchar_t));
-static int name_p PARAMS ((cpp_reader *, const cpp_string *));
-static cppchar_t maybe_read_ucn PARAMS ((cpp_reader *, const uchar **));
-static tokenrun *next_tokenrun PARAMS ((tokenrun *));
+static void add_line_note (cpp_buffer *, const uchar *, unsigned int);
+static int skip_line_comment (cpp_reader *);
+static void skip_whitespace (cpp_reader *, cppchar_t);
+static cpp_hashnode *lex_identifier (cpp_reader *, const uchar *);
+static void lex_number (cpp_reader *, cpp_string *);
+static bool forms_identifier_p (cpp_reader *, int);
+static void lex_string (cpp_reader *, cpp_token *, const uchar *);
+static void save_comment (cpp_reader *, cpp_token *, const uchar *, cppchar_t);
+static void create_literal (cpp_reader *, cpp_token *, const uchar *,
+                           unsigned int, enum cpp_ttype);
+static bool warn_in_comment (cpp_reader *, _cpp_line_note *);
+static int name_p (cpp_reader *, const cpp_string *);
+static tokenrun *next_tokenrun (tokenrun *);
 
-static unsigned int hex_digit_value PARAMS ((unsigned int));
-static _cpp_buff *new_buff PARAMS ((size_t));
+static _cpp_buff *new_buff (size_t);
 
 
 /* Utility routine:
@@ -78,9 +72,7 @@ static _cpp_buff *new_buff PARAMS ((size_t));
    Compares, the token TOKEN to the NUL-terminated string STRING.
    TOKEN must be a CPP_NAME.  Returns 1 for equal, 0 for unequal.  */
 int
-cpp_ideq (token, string)
-     const cpp_token *token;
-     const char *string;
+cpp_ideq (const cpp_token *token, const char *string)
 {
   if (token->type != CPP_NAME)
     return 0;
@@ -91,16 +83,13 @@ cpp_ideq (token, string)
 /* Record a note TYPE at byte POS into the current cleaned logical
    line.  */
 static void
-add_line_note (buffer, pos, type)
-     cpp_buffer *buffer;
-     const uchar *pos;
-     unsigned int type;
+add_line_note (cpp_buffer *buffer, const uchar *pos, unsigned int type)
 {
   if (buffer->notes_used == buffer->notes_cap)
     {
       buffer->notes_cap = buffer->notes_cap * 2 + 200;
-      buffer->notes = (_cpp_line_note *)
-       xrealloc (buffer->notes, buffer->notes_cap * sizeof (_cpp_line_note));
+      buffer->notes = xrealloc (buffer->notes,
+                               buffer->notes_cap * sizeof (_cpp_line_note));
     }
 
   buffer->notes[buffer->notes_used].pos = pos;
@@ -111,8 +100,7 @@ add_line_note (buffer, pos, type)
 /* Returns with a logical line that contains no escaped newlines or
    trigraphs.  This is a time-critical inner loop.  */
 void
-_cpp_clean_line (pfile)
-     cpp_reader *pfile;
+_cpp_clean_line (cpp_reader *pfile)
 {
   cpp_buffer *buffer;
   const uchar *s;
@@ -126,7 +114,57 @@ _cpp_clean_line (pfile)
 
   if (!buffer->from_stage3)
     {
-      d = (uchar *) s;
+      /* Short circuit for the common case of an un-escaped line with
+        no trigraphs.  The primary win here is by not writing any
+        data back to memory until we have to.  */
+      for (;;)
+       {
+         c = *++s;
+         if (c == '\n' || c == '\r')
+           {
+             d = (uchar *) s;
+
+             if (s == buffer->rlimit)
+               goto done;
+
+             /* DOS line ending? */
+             if (c == '\r' && s[1] == '\n')
+               s++;
+
+             if (s == buffer->rlimit)
+               goto done;
+
+             /* check for escaped newline */
+             p = d;
+             while (p != buffer->next_line && is_nvspace (p[-1]))
+               p--;
+             if (p == buffer->next_line || p[-1] != '\\')
+               goto done;
+
+             /* Have an escaped newline; process it and proceed to
+                the slow path.  */
+             add_line_note (buffer, p - 1, p != d ? ' ' : '\\');
+             d = p - 2;
+             buffer->next_line = p - 1;
+             break;
+           }
+         if (c == '?' && s[1] == '?' && _cpp_trigraph_map[s[2]])
+           {
+             /* Have a trigraph.  We may or may not have to convert
+                it.  Add a line note regardless, for -Wtrigraphs.  */
+             add_line_note (buffer, s, s[2]);
+             if (CPP_OPTION (pfile, trigraphs))
+               {
+                 /* We do, and that means we have to switch to the
+                    slow path.  */
+                 d = (uchar *) s;
+                 *d = _cpp_trigraph_map[s[2]];
+                 s += 2;
+                 break;
+               }
+           }
+       }
+
 
       for (;;)
        {
@@ -176,18 +214,45 @@ _cpp_clean_line (pfile)
        s++;
     }
 
+ done:
   *d = '\n';
   /* A sentinel note that should never be processed.  */
   add_line_note (buffer, d + 1, '\n');
   buffer->next_line = s + 1;
 }
 
+/* Return true if the trigraph indicated by NOTE should be warned
+   about in a comment.  */
+static bool
+warn_in_comment (cpp_reader *pfile, _cpp_line_note *note)
+{
+  const uchar *p;
+
+  /* Within comments we don't warn about trigraphs, unless the
+     trigraph forms an escaped newline, as that may change
+     behavior.  */
+  if (note->type != '/')
+    return false;
+
+  /* If -trigraphs, then this was an escaped newline iff the next note
+     is coincident.  */
+  if (CPP_OPTION (pfile, trigraphs))
+    return note[1].pos == note->pos;
+
+  /* Otherwise, see if this forms an escaped newline.  */
+  p = note->pos + 3;
+  while (is_nvspace (*p))
+    p++;
+
+  /* There might have been escaped newlines between the trigraph and the
+     newline we found.  Hence the position test.  */
+  return (*p == '\n' && p < note[1].pos);
+}
+
 /* Process the notes created by add_line_note as far as the current
    location.  */
 void
-_cpp_process_line_notes (pfile, in_comment)
-     cpp_reader *pfile;
-     int in_comment;
+_cpp_process_line_notes (cpp_reader *pfile, int in_comment)
 {
   cpp_buffer *buffer = pfile->buffer;
 
@@ -205,12 +270,12 @@ _cpp_process_line_notes (pfile, in_comment)
       if (note->type == '\\' || note->type == ' ')
        {
          if (note->type == ' ' && !in_comment)
-           cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
+           cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col,
                                 "backslash and newline separated by space");
 
          if (buffer->next_line > buffer->rlimit)
            {
-             cpp_error_with_line (pfile, DL_PEDWARN, pfile->line, col,
+             cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line, col,
                                   "backslash-newline at end of file");
              /* Prevent "no newline at end of file" warning.  */
              buffer->next_line = buffer->rlimit;
@@ -221,17 +286,21 @@ _cpp_process_line_notes (pfile, in_comment)
        }
       else if (_cpp_trigraph_map[note->type])
        {
-         if (!in_comment && CPP_OPTION (pfile, warn_trigraphs))
+         if (CPP_OPTION (pfile, warn_trigraphs)
+             && (!in_comment || warn_in_comment (pfile, note)))
            {
              if (CPP_OPTION (pfile, trigraphs))
-               cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
+               cpp_error_with_line (pfile, CPP_DL_WARNING, pfile->line, col,
                                     "trigraph ??%c converted to %c",
                                     note->type,
                                     (int) _cpp_trigraph_map[note->type]);
              else
-               cpp_error_with_line (pfile, DL_WARNING, pfile->line, col,
-                                    "trigraph ??%c ignored",
-                                    note->type);
+               {
+                 cpp_error_with_line 
+                   (pfile, CPP_DL_WARNING, pfile->line, col,
+                    "trigraph ??%c ignored, use -trigraphs to enable",
+                    note->type);
+               }
            }
        }
       else
@@ -245,47 +314,53 @@ _cpp_process_line_notes (pfile, in_comment)
 
    Buffer->cur points to the initial asterisk of the comment.  */
 bool
-_cpp_skip_block_comment (pfile)
-     cpp_reader *pfile;
+_cpp_skip_block_comment (cpp_reader *pfile)
 {
   cpp_buffer *buffer = pfile->buffer;
-  cppchar_t c;
+  const uchar *cur = buffer->cur;
+  uchar c;
 
-  buffer->cur++;
-  if (*buffer->cur == '/')
-    buffer->cur++;
+  cur++;
+  if (*cur == '/')
+    cur++;
 
   for (;;)
     {
-      c = *buffer->cur++;
-
       /* People like decorating comments with '*', so check for '/'
         instead for efficiency.  */
+      c = *cur++;
+
       if (c == '/')
        {
-         if (buffer->cur[-2] == '*')
+         if (cur[-2] == '*')
            break;
 
          /* Warn about potential nested comments, but not if the '/'
             comes immediately before the true comment delimiter.
             Don't bother to get it right across escaped newlines.  */
          if (CPP_OPTION (pfile, warn_comments)
-             && buffer->cur[0] == '*' && buffer->cur[1] != '/')
-           cpp_error_with_line (pfile, DL_WARNING,
-                                pfile->line, CPP_BUF_COL (buffer),
-                                "\"/*\" within comment");
+             && cur[0] == '*' && cur[1] != '/')
+           {
+             buffer->cur = cur;
+             cpp_error_with_line (pfile, CPP_DL_WARNING,
+                                  pfile->line, CPP_BUF_COL (buffer),
+                                  "\"/*\" within comment");
+           }
        }
       else if (c == '\n')
        {
-         buffer->cur--;
+         buffer->cur = cur - 1;
          _cpp_process_line_notes (pfile, true);
          if (buffer->next_line >= buffer->rlimit)
            return true;
          _cpp_clean_line (pfile);
          pfile->line++;
+         cur = buffer->cur;
        }
     }
 
+  buffer->cur = cur;
+  _cpp_process_line_notes (pfile, true);
   return false;
 }
 
@@ -293,8 +368,7 @@ _cpp_skip_block_comment (pfile)
    terminating newline.  Handles escaped newlines.  Returns nonzero
    if a multiline comment.  */
 static int
-skip_line_comment (pfile)
-     cpp_reader *pfile;
+skip_line_comment (cpp_reader *pfile)
 {
   cpp_buffer *buffer = pfile->buffer;
   unsigned int orig_line = pfile->line;
@@ -308,9 +382,7 @@ skip_line_comment (pfile)
 
 /* Skips whitespace, saving the next non-whitespace character.  */
 static void
-skip_whitespace (pfile, c)
-     cpp_reader *pfile;
-     cppchar_t c;
+skip_whitespace (cpp_reader *pfile, cppchar_t c)
 {
   cpp_buffer *buffer = pfile->buffer;
   bool saw_NUL = false;
@@ -324,7 +396,7 @@ skip_whitespace (pfile, c)
       else if (c == '\0')
        saw_NUL = true;
       else if (pfile->state.in_directive && CPP_PEDANTIC (pfile))
-       cpp_error_with_line (pfile, DL_PEDWARN, pfile->line,
+       cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line,
                             CPP_BUF_COL (buffer),
                             "%s in preprocessing directive",
                             c == '\f' ? "form feed" : "vertical tab");
@@ -335,7 +407,7 @@ skip_whitespace (pfile, c)
   while (is_nvspace (c));
 
   if (saw_NUL)
-    cpp_error (pfile, DL_WARNING, "null character(s) ignored");
+    cpp_error (pfile, CPP_DL_WARNING, "null character(s) ignored");
 
   buffer->cur--;
 }
@@ -343,9 +415,7 @@ skip_whitespace (pfile, c)
 /* See if the characters of a number token are valid in a name (no
    '.', '+' or '-').  */
 static int
-name_p (pfile, string)
-     cpp_reader *pfile;
-     const cpp_string *string;
+name_p (cpp_reader *pfile, const cpp_string *string)
 {
   unsigned int i;
 
@@ -359,9 +429,7 @@ name_p (pfile, string)
 /* Returns TRUE if the sequence starting at buffer->cur is invalid in
    an identifier.  FIRST is TRUE if this starts an identifier.  */
 static bool
-forms_identifier_p (pfile, first)
-     cpp_reader *pfile;
-     int first;
+forms_identifier_p (cpp_reader *pfile, int first)
 {
   cpp_buffer *buffer = pfile->buffer;
 
@@ -371,12 +439,10 @@ forms_identifier_p (pfile, first)
        return false;
 
       buffer->cur++;
-      if (CPP_PEDANTIC (pfile)
-         && !pfile->state.skipping
-         && !pfile->warned_dollar)
+      if (CPP_OPTION (pfile, warn_dollars) && !pfile->state.skipping)
        {
-         pfile->warned_dollar = true;
-         cpp_error (pfile, DL_PEDWARN, "'$' in identifier or number");
+         CPP_OPTION (pfile, warn_dollars) = 0;
+         cpp_error (pfile, CPP_DL_PEDWARN, "'$' in identifier or number");
        }
 
       return true;
@@ -387,7 +453,7 @@ forms_identifier_p (pfile, first)
       && (buffer->cur[1] == 'u' || buffer->cur[1] == 'U'))
     {
       buffer->cur += 2;
-      if (_cpp_valid_ucn (pfile, &buffer->cur, 1 + !first))
+      if (_cpp_valid_ucn (pfile, &buffer->cur, buffer->rlimit, 1 + !first))
        return true;
       buffer->cur -= 2;
     }
@@ -397,9 +463,7 @@ forms_identifier_p (pfile, first)
 
 /* Lex an identifier starting at BUFFER->CUR - 1.  */
 static cpp_hashnode *
-lex_identifier (pfile, base)
-     cpp_reader *pfile;
-     const uchar *base;
+lex_identifier (cpp_reader *pfile, const uchar *base)
 {
   cpp_hashnode *result;
   const uchar *cur;
@@ -425,15 +489,16 @@ lex_identifier (pfile, base)
     {
       /* It is allowed to poison the same identifier twice.  */
       if ((result->flags & NODE_POISONED) && !pfile->state.poisoned_ok)
-       cpp_error (pfile, DL_ERROR, "attempt to use poisoned \"%s\"",
+       cpp_error (pfile, CPP_DL_ERROR, "attempt to use poisoned \"%s\"",
                   NODE_NAME (result));
 
       /* Constraint 6.10.3.5: __VA_ARGS__ should only appear in the
         replacement list of a variadic macro.  */
       if (result == pfile->spec_nodes.n__VA_ARGS__
          && !pfile->state.va_args_ok)
-       cpp_error (pfile, DL_PEDWARN,
-       "__VA_ARGS__ can only appear in the expansion of a C99 variadic macro");
+       cpp_error (pfile, CPP_DL_PEDWARN,
+                  "__VA_ARGS__ can only appear in the expansion"
+                  " of a C99 variadic macro");
     }
 
   return result;
@@ -441,9 +506,7 @@ lex_identifier (pfile, base)
 
 /* Lex a number to NUMBER starting at BUFFER->CUR - 1.  */
 static void
-lex_number (pfile, number)
-     cpp_reader *pfile;
-     cpp_string *number;
+lex_number (cpp_reader *pfile, cpp_string *number)
 {
   const uchar *cur;
   const uchar *base;
@@ -469,72 +532,77 @@ lex_number (pfile, number)
   number->text = dest;
 }
 
+/* Create a token of type TYPE with a literal spelling.  */
+static void
+create_literal (cpp_reader *pfile, cpp_token *token, const uchar *base,
+               unsigned int len, enum cpp_ttype type)
+{
+  uchar *dest = _cpp_unaligned_alloc (pfile, len + 1);
+
+  memcpy (dest, base, len);
+  dest[len] = '\0';
+  token->type = type;
+  token->val.str.len = len;
+  token->val.str.text = dest;
+}
+
 /* Lexes a string, character constant, or angle-bracketed header file
-   name.  The stored string is guaranteed NUL-terminated, but it is
-   not guaranteed that this is the first NUL since embedded NULs are
-   preserved.  */
+   name.  The stored string contains the spelling, including opening
+   quote and leading any leading 'L'.  It returns the type of the
+   literal, or CPP_OTHER if it was not properly terminated.
+
+   The spelling is NUL-terminated, but it is not guaranteed that this
+   is the first NUL since embedded NULs are preserved.  */
 static void
-lex_string (pfile, token)
-     cpp_reader *pfile;
-     cpp_token *token;
+lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
 {
-  cpp_buffer *buffer = pfile->buffer;
-  bool warned_nulls = false;
-  const uchar *base;
-  uchar *dest;
+  bool saw_NUL = false;
+  const uchar *cur;
   cppchar_t terminator;
-
-  base = buffer->cur;
-  terminator = base[-1];
-  if (terminator == '<')
-    terminator = '>';
+  enum cpp_ttype type;
+
+  cur = base;
+  terminator = *cur++;
+  if (terminator == 'L')
+    terminator = *cur++;
+  if (terminator == '\"')
+    type = *base == 'L' ? CPP_WSTRING: CPP_STRING;
+  else if (terminator == '\'')
+    type = *base == 'L' ? CPP_WCHAR: CPP_CHAR;
+  else
+    terminator = '>', type = CPP_HEADER_NAME;
 
   for (;;)
     {
-      cppchar_t c = *buffer->cur++;
+      cppchar_t c = *cur++;
 
       /* In #include-style directives, terminators are not escapable.  */
-      if (c == '\\' && !pfile->state.angled_headers && *buffer->cur != '\n')
-       buffer->cur++;
-      else if (c == terminator || c == '\n')
+      if (c == '\\' && !pfile->state.angled_headers && *cur != '\n')
+       cur++;
+      else if (c == terminator)
        break;
-      else if (c == '\0')
+      else if (c == '\n')
        {
-         if (!warned_nulls)
-           {
-             warned_nulls = true;
-             cpp_error (pfile, DL_WARNING,
-                        "null character(s) preserved in literal");
-           }
+         cur--;
+         type = CPP_OTHER;
+         break;
        }
+      else if (c == '\0')
+       saw_NUL = true;
     }
 
-  token->val.str.len = buffer->cur - base - 1;
-  dest = _cpp_unaligned_alloc (pfile, token->val.str.len + 1);
-  memcpy (dest, base, token->val.str.len);
-  dest[token->val.str.len] = '\0';
-  token->val.str.text = dest;
+  if (saw_NUL && !pfile->state.skipping)
+    cpp_error (pfile, CPP_DL_WARNING,
+              "null character(s) preserved in literal");
 
-  if (buffer->cur[-1] == '\n')
-    {
-      /* No string literal may extend over multiple lines.  In
-        assembly language, suppress the error except for <>
-        includes.  This is a kludge around not knowing where
-        comments are.  */
-      if (CPP_OPTION (pfile, lang) != CLK_ASM || terminator == '>')
-       cpp_error (pfile, DL_ERROR, "missing terminating %c character",
-                  (int) terminator);
-      buffer->cur--;
-    }
+  pfile->buffer->cur = cur;
+  create_literal (pfile, token, base, cur - base, type);
 }
 
 /* The stored comment includes the comment start and any terminator.  */
 static void
-save_comment (pfile, token, from, type)
-     cpp_reader *pfile;
-     cpp_token *token;
-     const unsigned char *from;
-     cppchar_t type;
+save_comment (cpp_reader *pfile, cpp_token *token, const unsigned char *from,
+             cppchar_t type)
 {
   unsigned char *buffer;
   unsigned int len, clen;
@@ -574,9 +642,7 @@ save_comment (pfile, token, from, type)
 
 /* Allocate COUNT tokens for RUN.  */
 void
-_cpp_init_tokenrun (run, count)
-     tokenrun *run;
-     unsigned int count;
+_cpp_init_tokenrun (tokenrun *run, unsigned int count)
 {
   run->base = xnewvec (cpp_token, count);
   run->limit = run->base + count;
@@ -585,8 +651,7 @@ _cpp_init_tokenrun (run, count)
 
 /* Returns the next tokenrun, or creates one if there is none.  */
 static tokenrun *
-next_tokenrun (run)
-     tokenrun *run;
+next_tokenrun (tokenrun *run)
 {
   if (run->next == NULL)
     {
@@ -603,8 +668,7 @@ next_tokenrun (run)
    same as the last lexed token, so that diagnostics appear in the
    right place.  */
 cpp_token *
-_cpp_temp_token (pfile)
-     cpp_reader *pfile;
+_cpp_temp_token (cpp_reader *pfile)
 {
   cpp_token *old, *result;
 
@@ -625,8 +689,7 @@ _cpp_temp_token (pfile)
    like directive handling, token lookahead, multiple include
    optimization and skipping.  */
 const cpp_token *
-_cpp_lex_token (pfile)
-     cpp_reader *pfile;
+_cpp_lex_token (cpp_reader *pfile)
 {
   cpp_token *result;
 
@@ -658,7 +721,7 @@ _cpp_lex_token (pfile)
              && _cpp_handle_directive (pfile, result->flags & PREV_WHITE))
            continue;
          if (pfile->cb.line_change && !pfile->state.skipping)
-           (*pfile->cb.line_change)(pfile, result, pfile->state.parsing_args);
+           pfile->cb.line_change (pfile, result, pfile->state.parsing_args);
        }
 
       /* We don't skip tokens in directives.  */
@@ -667,7 +730,7 @@ _cpp_lex_token (pfile)
 
       /* Outside a directive, invalidate controlling macros.  At file
         EOF, _cpp_lex_direct takes care of popping the buffer, so we never
-        get here and MI optimisation works.  */
+        get here and MI optimization works.  */
       pfile->mi_valid = false;
 
       if (!pfile->state.skipping || result->type == CPP_EOF)
@@ -679,8 +742,7 @@ _cpp_lex_token (pfile)
 
 /* Returns true if a fresh line has been loaded.  */
 bool
-_cpp_get_fresh_line (pfile)
-     cpp_reader *pfile;
+_cpp_get_fresh_line (cpp_reader *pfile)
 {
   /* We can't get a new line until we leave the current directive.  */
   if (pfile->state.in_directive)
@@ -710,21 +772,14 @@ _cpp_get_fresh_line (pfile)
        {
          /* Only warn once.  */
          buffer->next_line = buffer->rlimit;
-         cpp_error_with_line (pfile, DL_PEDWARN, pfile->line - 1,
+         cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line - 1,
                               CPP_BUF_COLUMN (buffer, buffer->cur),
                               "no newline at end of file");
        }
  
-      if (buffer->return_at_eof)
-       {
-         buffer->return_at_eof = false;
-         return false;
-       }
-
-      if (!buffer->prev)
-       return false;
-
       _cpp_pop_buffer (pfile);
+      if (pfile->buffer == NULL)
+       return false;
     }
 }
 
@@ -741,7 +796,7 @@ _cpp_get_fresh_line (pfile)
    get diagnostics pointing to the correct location.
 
    Does not handle issues such as token lookahead, multiple-include
-   optimisation, directives, skipping etc.  This function is only
+   optimization, directives, skipping etc.  This function is only
    suitable for use by _cpp_lex_token, and in special cases like
    lex_expansion_token which doesn't care for any of these issues.
 
@@ -749,8 +804,7 @@ _cpp_get_fresh_line (pfile)
    otherwise returns to the start of the token buffer if permissible.
    Returns the location of the lexed token.  */
 cpp_token *
-_cpp_lex_direct (pfile)
-     cpp_reader *pfile;
+_cpp_lex_direct (cpp_reader *pfile)
 {
   cppchar_t c;
   cpp_buffer *buffer;
@@ -759,7 +813,8 @@ _cpp_lex_direct (pfile)
 
  fresh_line:
   result->flags = 0;
-  if (pfile->buffer->need_line)
+  buffer = pfile->buffer;
+  if (buffer->need_line)
     {
       if (!_cpp_get_fresh_line (pfile))
        {
@@ -818,9 +873,7 @@ _cpp_lex_direct (pfile)
       /* 'L' may introduce wide characters or strings.  */
       if (*buffer->cur == '\'' || *buffer->cur == '"')
        {
-         result->type = (*buffer->cur == '"' ? CPP_WSTRING: CPP_WCHAR);
-         buffer->cur++;
-         lex_string (pfile, result);
+         lex_string (pfile, result, buffer->cur - 1);
          break;
        }
       /* Fall through.  */
@@ -849,8 +902,7 @@ _cpp_lex_direct (pfile)
 
     case '\'':
     case '"':
-      result->type = c == '"' ? CPP_STRING: CPP_CHAR;
-      lex_string (pfile, result);
+      lex_string (pfile, result, buffer->cur - 1);
       break;
 
     case '/':
@@ -861,7 +913,7 @@ _cpp_lex_direct (pfile)
       if (c == '*')
        {
          if (_cpp_skip_block_comment (pfile))
-           cpp_error (pfile, DL_ERROR, "unterminated comment");
+           cpp_error (pfile, CPP_DL_ERROR, "unterminated comment");
        }
       else if (c == '/' && (CPP_OPTION (pfile, cplusplus_comments)
                            || CPP_IN_SYSTEM_HEADER (pfile)))
@@ -871,15 +923,15 @@ _cpp_lex_direct (pfile)
          if (CPP_OPTION (pfile, lang) == CLK_GNUC89 && CPP_PEDANTIC (pfile)
              && ! buffer->warned_cplusplus_comments)
            {
-             cpp_error (pfile, DL_PEDWARN,
+             cpp_error (pfile, CPP_DL_PEDWARN,
                         "C++ style comments are not allowed in ISO C90");
-             cpp_error (pfile, DL_PEDWARN,
+             cpp_error (pfile, CPP_DL_PEDWARN,
                         "(this will be reported only once per input file)");
              buffer->warned_cplusplus_comments = 1;
            }
 
          if (skip_line_comment (pfile) && CPP_OPTION (pfile, warn_comments))
-           cpp_error (pfile, DL_WARNING, "multi-line comment");
+           cpp_error (pfile, CPP_DL_WARNING, "multi-line comment");
        }
       else if (c == '=')
        {
@@ -906,8 +958,7 @@ _cpp_lex_direct (pfile)
     case '<':
       if (pfile->state.angled_headers)
        {
-         result->type = CPP_HEADER_NAME;
-         lex_string (pfile, result);
+         lex_string (pfile, result, buffer->cur - 1);
          break;
        }
 
@@ -1076,45 +1127,40 @@ _cpp_lex_direct (pfile)
            break;
          }
        buffer->cur++;
-
-      default:
-       result->type = CPP_OTHER;
-       result->val.c = c;
-       break;
       }
+
+    default:
+      create_literal (pfile, result, buffer->cur - 1, 1, CPP_OTHER);
+      break;
     }
 
   return result;
 }
 
-/* An upper bound on the number of bytes needed to spell TOKEN,
-   including preceding whitespace.  */
+/* An upper bound on the number of bytes needed to spell TOKEN.
+   Does not include preceding whitespace.  */
 unsigned int
-cpp_token_len (token)
-     const cpp_token *token;
+cpp_token_len (const cpp_token *token)
 {
   unsigned int len;
 
   switch (TOKEN_SPELL (token))
     {
-    default:           len = 0;                                break;
-    case SPELL_NUMBER:
-    case SPELL_STRING: len = token->val.str.len;               break;
+    default:           len = 4;                                break;
+    case SPELL_LITERAL:        len = token->val.str.len;               break;
     case SPELL_IDENT:  len = NODE_LEN (token->val.node);       break;
     }
-  /* 1 for whitespace, 4 for comment delimiters.  */
-  return len + 5;
+
+  return len;
 }
 
 /* Write the spelling of a token TOKEN to BUFFER.  The buffer must
    already contain the enough space to hold the token's spelling.
-   Returns a pointer to the character after the last character
-   written.  */
+   Returns a pointer to the character after the last character written.
+   FIXME: Would be nice if we didn't need the PFILE argument.  */
 unsigned char *
-cpp_spell_token (pfile, token, buffer)
-     cpp_reader *pfile;                /* Would be nice to be rid of this...  */
-     const cpp_token *token;
-     unsigned char *buffer;
+cpp_spell_token (cpp_reader *pfile, const cpp_token *token,
+                unsigned char *buffer)
 {
   switch (TOKEN_SPELL (token))
     {
@@ -1136,46 +1182,20 @@ cpp_spell_token (pfile, token, buffer)
       }
       break;
 
-    case SPELL_CHAR:
-      *buffer++ = token->val.c;
-      break;
-
     spell_ident:
     case SPELL_IDENT:
       memcpy (buffer, NODE_NAME (token->val.node), NODE_LEN (token->val.node));
       buffer += NODE_LEN (token->val.node);
       break;
 
-    case SPELL_NUMBER:
+    case SPELL_LITERAL:
       memcpy (buffer, token->val.str.text, token->val.str.len);
       buffer += token->val.str.len;
       break;
 
-    case SPELL_STRING:
-      {
-       int left, right, tag;
-       switch (token->type)
-         {
-         case CPP_STRING:      left = '"';  right = '"';  tag = '\0'; break;
-         case CPP_WSTRING:     left = '"';  right = '"';  tag = 'L';  break;
-         case CPP_CHAR:        left = '\''; right = '\''; tag = '\0'; break;
-         case CPP_WCHAR:       left = '\''; right = '\''; tag = 'L';  break;
-         case CPP_HEADER_NAME: left = '<';  right = '>';  tag = '\0'; break;
-         default:
-           cpp_error (pfile, DL_ICE, "unknown string token %s\n",
-                      TOKEN_NAME (token));
-           return buffer;
-         }
-       if (tag) *buffer++ = tag;
-       *buffer++ = left;
-       memcpy (buffer, token->val.str.text, token->val.str.len);
-       buffer += token->val.str.len;
-       *buffer++ = right;
-      }
-      break;
-
     case SPELL_NONE:
-      cpp_error (pfile, DL_ICE, "unspellable token %s", TOKEN_NAME (token));
+      cpp_error (pfile, CPP_DL_ICE,
+                "unspellable token %s", TOKEN_NAME (token));
       break;
     }
 
@@ -1185,11 +1205,9 @@ cpp_spell_token (pfile, token, buffer)
 /* Returns TOKEN spelt as a null-terminated string.  The string is
    freed when the reader is destroyed.  Useful for diagnostics.  */
 unsigned char *
-cpp_token_as_text (pfile, token)
-     cpp_reader *pfile;
-     const cpp_token *token;
-{
-  unsigned int len = cpp_token_len (token);
+cpp_token_as_text (cpp_reader *pfile, const cpp_token *token)
+{ 
+  unsigned int len = cpp_token_len (token) + 1;
   unsigned char *start = _cpp_unaligned_alloc (pfile, len), *end;
 
   end = cpp_spell_token (pfile, token, start);
@@ -1201,8 +1219,7 @@ cpp_token_as_text (pfile, token)
 /* Used by C front ends, which really should move to using
    cpp_token_as_text.  */
 const char *
-cpp_type2name (type)
-     enum cpp_ttype type;
+cpp_type2name (enum cpp_ttype type)
 {
   return (const char *) token_spellings[type].name;
 }
@@ -1211,9 +1228,7 @@ cpp_type2name (type)
    Separated from cpp_spell_token for efficiency - to avoid stdio
    double-buffering.  */
 void
-cpp_output_token (token, fp)
-     const cpp_token *token;
-     FILE *fp;
+cpp_output_token (const cpp_token *token, FILE *fp)
 {
   switch (TOKEN_SPELL (token))
     {
@@ -1237,40 +1252,15 @@ cpp_output_token (token, fp)
       }
       break;
 
-    case SPELL_CHAR:
-      putc (token->val.c, fp);
-      break;
-
     spell_ident:
     case SPELL_IDENT:
       fwrite (NODE_NAME (token->val.node), 1, NODE_LEN (token->val.node), fp);
     break;
 
-    case SPELL_NUMBER:
+    case SPELL_LITERAL:
       fwrite (token->val.str.text, 1, token->val.str.len, fp);
       break;
 
-    case SPELL_STRING:
-      {
-       int left, right, tag;
-       switch (token->type)
-         {
-         case CPP_STRING:      left = '"';  right = '"';  tag = '\0'; break;
-         case CPP_WSTRING:     left = '"';  right = '"';  tag = 'L';  break;
-         case CPP_CHAR:        left = '\''; right = '\''; tag = '\0'; break;
-         case CPP_WCHAR:       left = '\''; right = '\''; tag = 'L';  break;
-         case CPP_HEADER_NAME: left = '<';  right = '>';  tag = '\0'; break;
-         default:
-           fprintf (stderr, "impossible STRING token %s\n", TOKEN_NAME (token));
-           return;
-         }
-       if (tag) putc (tag, fp);
-       putc (left, fp);
-       fwrite (token->val.str.text, 1, token->val.str.len, fp);
-       putc (right, fp);
-      }
-      break;
-
     case SPELL_NONE:
       /* An error, most probably.  */
       break;
@@ -1279,8 +1269,7 @@ cpp_output_token (token, fp)
 
 /* Compare two tokens.  */
 int
-_cpp_equiv_tokens (a, b)
-     const cpp_token *a, *b;
+_cpp_equiv_tokens (const cpp_token *a, const cpp_token *b)
 {
   if (a->type == b->type && a->flags == b->flags)
     switch (TOKEN_SPELL (a))
@@ -1288,14 +1277,11 @@ _cpp_equiv_tokens (a, b)
       default:                 /* Keep compiler happy.  */
       case SPELL_OPERATOR:
        return 1;
-      case SPELL_CHAR:
-       return a->val.c == b->val.c; /* Character.  */
       case SPELL_NONE:
        return (a->type != CPP_MACRO_ARG || a->val.arg_no == b->val.arg_no);
       case SPELL_IDENT:
        return a->val.node == b->val.node;
-      case SPELL_NUMBER:
-      case SPELL_STRING:
+      case SPELL_LITERAL:
        return (a->val.str.len == b->val.str.len
                && !memcmp (a->val.str.text, b->val.str.text,
                            a->val.str.len));
@@ -1309,9 +1295,8 @@ _cpp_equiv_tokens (a, b)
    conservative, and occasionally advises a space where one is not
    needed, e.g. "." and ".2".  */
 int
-cpp_avoid_paste (pfile, token1, token2)
-     cpp_reader *pfile;
-     const cpp_token *token1, *token2;
+cpp_avoid_paste (cpp_reader *pfile, const cpp_token *token1,
+                const cpp_token *token2)
 {
   enum cpp_ttype a = token1->type, b = token2->type;
   cppchar_t c;
@@ -1352,9 +1337,10 @@ cpp_avoid_paste (pfile, token1, token2)
     case CPP_NUMBER:   return (b == CPP_NUMBER || b == CPP_NAME
                                || c == '.' || c == '+' || c == '-');
                                      /* UCNs */
-    case CPP_OTHER:    return ((token1->val.c == '\\' && b == CPP_NAME)
+    case CPP_OTHER:    return ((token1->val.str.text[0] == '\\'
+                                && b == CPP_NAME)
                                || (CPP_OPTION (pfile, objc)
-                                   && token1->val.c == '@'
+                                   && token1->val.str.text[0] == '@'
                                    && (b == CPP_NAME || b == CPP_STRING)));
     default:           break;
     }
@@ -1366,9 +1352,7 @@ cpp_avoid_paste (pfile, token1, token2)
    character, to FP.  Leading whitespace is removed.  If there are
    macros, special token padding is not performed.  */
 void
-cpp_output_line (pfile, fp)
-     cpp_reader *pfile;
-     FILE *fp;
+cpp_output_line (cpp_reader *pfile, FILE *fp)
 {
   const cpp_token *token;
 
@@ -1384,298 +1368,6 @@ cpp_output_line (pfile, fp)
   putc ('\n', fp);
 }
 
-/* Returns the value of a hexadecimal digit.  */
-static unsigned int
-hex_digit_value (c)
-     unsigned int c;
-{
-  if (hex_p (c))
-    return hex_value (c);
-  else
-    abort ();
-}
-
-/* Read a possible universal character name starting at *PSTR.  */
-static cppchar_t
-maybe_read_ucn (pfile, pstr)
-     cpp_reader *pfile;
-     const uchar **pstr;
-{
-  cppchar_t result, c = (*pstr)[-1];
-
-  result = _cpp_valid_ucn (pfile, pstr, false);
-  if (result)
-    {
-      if (CPP_WTRADITIONAL (pfile))
-       cpp_error (pfile, DL_WARNING,
-                  "the meaning of '\\%c' is different in traditional C",
-                  (int) c);
-
-      if (CPP_OPTION (pfile, EBCDIC))
-       {
-         cpp_error (pfile, DL_ERROR,
-                    "universal character with an EBCDIC target");
-         result = 0x3f;  /* EBCDIC invalid character */
-       }
-    }
-
-  return result;
-}
-
-/* Returns the value of an escape sequence, truncated to the correct
-   target precision.  PSTR points to the input pointer, which is just
-   after the backslash.  LIMIT is how much text we have.  WIDE is true
-   if the escape sequence is part of a wide character constant or
-   string literal.  Handles all relevant diagnostics.  */
-cppchar_t
-cpp_parse_escape (pfile, pstr, limit, wide)
-     cpp_reader *pfile;
-     const unsigned char **pstr;
-     const unsigned char *limit;
-     int wide;
-{
-  /* Values of \a \b \e \f \n \r \t \v respectively.  */
-  static const uchar ascii[]  = {  7,  8, 27, 12, 10, 13,  9, 11 };
-  static const uchar ebcdic[] = { 47, 22, 39, 12, 21, 13,  5, 11 };
-
-  int unknown = 0;
-  const unsigned char *str = *pstr, *charconsts;
-  cppchar_t c, ucn, mask;
-  unsigned int width;
-
-  if (CPP_OPTION (pfile, EBCDIC))
-    charconsts = ebcdic;
-  else
-    charconsts = ascii;
-
-  if (wide)
-    width = CPP_OPTION (pfile, wchar_precision);
-  else
-    width = CPP_OPTION (pfile, char_precision);
-  if (width < BITS_PER_CPPCHAR_T)
-    mask = ((cppchar_t) 1 << width) - 1;
-  else
-    mask = ~0;
-
-  c = *str++;
-  switch (c)
-    {
-    case '\\': case '\'': case '"': case '?': break;
-    case 'b': c = charconsts[1];  break;
-    case 'f': c = charconsts[3];  break;
-    case 'n': c = charconsts[4];  break;
-    case 'r': c = charconsts[5];  break;
-    case 't': c = charconsts[6];  break;
-    case 'v': c = charconsts[7];  break;
-
-    case '(': case '{': case '[': case '%':
-      /* '\(', etc, are used at beginning of line to avoid confusing Emacs.
-        '\%' is used to prevent SCCS from getting confused.  */
-      unknown = CPP_PEDANTIC (pfile);
-      break;
-
-    case 'a':
-      if (CPP_WTRADITIONAL (pfile))
-       cpp_error (pfile, DL_WARNING,
-                  "the meaning of '\\a' is different in traditional C");
-      c = charconsts[0];
-      break;
-
-    case 'e': case 'E':
-      if (CPP_PEDANTIC (pfile))
-       cpp_error (pfile, DL_PEDWARN,
-                  "non-ISO-standard escape sequence, '\\%c'", (int) c);
-      c = charconsts[2];
-      break;
-
-    case 'u': case 'U':
-      ucn = maybe_read_ucn (pfile, &str);
-      if (ucn)
-       c = ucn;
-      else
-       unknown = true;
-      break;
-
-    case 'x':
-      if (CPP_WTRADITIONAL (pfile))
-       cpp_error (pfile, DL_WARNING,
-                  "the meaning of '\\x' is different in traditional C");
-
-      {
-       cppchar_t i = 0, overflow = 0;
-       int digits_found = 0;
-
-       while (str < limit)
-         {
-           c = *str;
-           if (! ISXDIGIT (c))
-             break;
-           str++;
-           overflow |= i ^ (i << 4 >> 4);
-           i = (i << 4) + hex_digit_value (c);
-           digits_found = 1;
-         }
-
-       if (!digits_found)
-         cpp_error (pfile, DL_ERROR,
-                      "\\x used with no following hex digits");
-
-       if (overflow | (i != (i & mask)))
-         {
-           cpp_error (pfile, DL_PEDWARN,
-                      "hex escape sequence out of range");
-           i &= mask;
-         }
-       c = i;
-      }
-      break;
-
-    case '0':  case '1':  case '2':  case '3':
-    case '4':  case '5':  case '6':  case '7':
-      {
-       size_t count = 0;
-       cppchar_t i = c - '0';
-
-       while (str < limit && ++count < 3)
-         {
-           c = *str;
-           if (c < '0' || c > '7')
-             break;
-           str++;
-           i = (i << 3) + c - '0';
-         }
-
-       if (i != (i & mask))
-         {
-           cpp_error (pfile, DL_PEDWARN,
-                      "octal escape sequence out of range");
-           i &= mask;
-         }
-       c = i;
-      }
-      break;
-
-    default:
-      unknown = 1;
-      break;
-    }
-
-  if (unknown)
-    {
-      if (ISGRAPH (c))
-       cpp_error (pfile, DL_PEDWARN,
-                  "unknown escape sequence '\\%c'", (int) c);
-      else
-       cpp_error (pfile, DL_PEDWARN,
-                  "unknown escape sequence: '\\%03o'", (int) c);
-    }
-
-  if (c > mask)
-    {
-      cpp_error (pfile, DL_PEDWARN, "escape sequence out of range for its type");
-      c &= mask;
-    }
-
-  *pstr = str;
-  return c;
-}
-
-/* Interpret a (possibly wide) character constant in TOKEN.
-   WARN_MULTI warns about multi-character charconsts.  PCHARS_SEEN
-   points to a variable that is filled in with the number of
-   characters seen, and UNSIGNEDP to a variable that indicates whether
-   the result has signed type.  */
-cppchar_t
-cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp)
-     cpp_reader *pfile;
-     const cpp_token *token;
-     unsigned int *pchars_seen;
-     int *unsignedp;
-{
-  const unsigned char *str = token->val.str.text;
-  const unsigned char *limit = str + token->val.str.len;
-  unsigned int chars_seen = 0;
-  size_t width, max_chars;
-  cppchar_t c, mask, result = 0;
-  bool unsigned_p;
-
-  /* Width in bits.  */
-  if (token->type == CPP_CHAR)
-    {
-      width = CPP_OPTION (pfile, char_precision);
-      max_chars = CPP_OPTION (pfile, int_precision) / width;
-      unsigned_p = CPP_OPTION (pfile, unsigned_char);
-    }
-  else
-    {
-      width = CPP_OPTION (pfile, wchar_precision);
-      max_chars = 1;
-      unsigned_p = CPP_OPTION (pfile, unsigned_wchar);
-    }
-
-  if (width < BITS_PER_CPPCHAR_T)
-    mask = ((cppchar_t) 1 << width) - 1;
-  else
-    mask = ~0;
-
-  while (str < limit)
-    {
-      c = *str++;
-
-      if (c == '\\')
-       c = cpp_parse_escape (pfile, &str, limit, token->type == CPP_WCHAR);
-
-#ifdef MAP_CHARACTER
-      if (ISPRINT (c))
-       c = MAP_CHARACTER (c);
-#endif
-
-      chars_seen++;
-
-      /* Truncate the character, scale the result and merge the two.  */
-      c &= mask;
-      if (width < BITS_PER_CPPCHAR_T)
-       result = (result << width) | c;
-      else
-       result = c;
-    }
-
-  if (chars_seen == 0)
-    cpp_error (pfile, DL_ERROR, "empty character constant");
-  else if (chars_seen > 1)
-    {
-      /* Multichar charconsts are of type int and therefore signed.  */
-      unsigned_p = 0;
-
-      if (chars_seen > max_chars)
-       {
-         chars_seen = max_chars;
-         cpp_error (pfile, DL_WARNING,
-                    "character constant too long for its type");
-       }
-      else if (CPP_OPTION (pfile, warn_multichar))
-       cpp_error (pfile, DL_WARNING, "multi-character character constant");
-    }
-
-  /* Sign-extend or truncate the constant to cppchar_t.  The value is
-     in WIDTH bits, but for multi-char charconsts it's value is the
-     full target type's width.  */
-  if (chars_seen > 1)
-    width *= max_chars;
-  if (width < BITS_PER_CPPCHAR_T)
-    {
-      mask = ((cppchar_t) 1 << width) - 1;
-      if (unsigned_p || !(result & (1 << (width - 1))))
-       result &= mask;
-      else
-       result |= ~mask;
-    }
-
-  *pchars_seen = chars_seen;
-  *unsignedp = unsigned_p;
-  return result;
-}
-
 /* Memory buffers.  Changing these three constants can have a dramatic
    effect on performance.  The values here are reasonable defaults,
    but might be tuned.  If you adjust them, be sure to test across a
@@ -1694,8 +1386,7 @@ cpp_interpret_charconst (pfile, token, pchars_seen, unsignedp)
 /* Create a new allocation buffer.  Place the control block at the end
    of the buffer, so that buffer overflows will cause immediate chaos.  */
 static _cpp_buff *
-new_buff (len)
-     size_t len;
+new_buff (size_t len)
 {
   _cpp_buff *result;
   unsigned char *base;
@@ -1715,9 +1406,7 @@ new_buff (len)
 
 /* Place a chain of unwanted allocation buffers on the free list.  */
 void
-_cpp_release_buff (pfile, buff)
-     cpp_reader *pfile;
-     _cpp_buff *buff;
+_cpp_release_buff (cpp_reader *pfile, _cpp_buff *buff)
 {
   _cpp_buff *end = buff;
 
@@ -1729,9 +1418,7 @@ _cpp_release_buff (pfile, buff)
 
 /* Return a free buffer of size at least MIN_SIZE.  */
 _cpp_buff *
-_cpp_get_buff (pfile, min_size)
-     cpp_reader *pfile;
-     size_t min_size;
+_cpp_get_buff (cpp_reader *pfile, size_t min_size)
 {
   _cpp_buff *result, **p;
 
@@ -1760,10 +1447,7 @@ _cpp_get_buff (pfile, min_size)
    the excess bytes to the new buffer.  Chains the new buffer after
    BUFF, and returns the new buffer.  */
 _cpp_buff *
-_cpp_append_extend_buff (pfile, buff, min_extra)
-     cpp_reader *pfile;
-     _cpp_buff *buff;
-     size_t min_extra;
+_cpp_append_extend_buff (cpp_reader *pfile, _cpp_buff *buff, size_t min_extra)
 {
   size_t size = EXTENDED_BUFF_SIZE (buff, min_extra);
   _cpp_buff *new_buff = _cpp_get_buff (pfile, size);
@@ -1779,10 +1463,7 @@ _cpp_append_extend_buff (pfile, buff, min_extra)
    Chains the new buffer before the buffer pointed to by BUFF, and
    updates the pointer to point to the new buffer.  */
 void
-_cpp_extend_buff (pfile, pbuff, min_extra)
-     cpp_reader *pfile;
-     _cpp_buff **pbuff;
-     size_t min_extra;
+_cpp_extend_buff (cpp_reader *pfile, _cpp_buff **pbuff, size_t min_extra)
 {
   _cpp_buff *new_buff, *old_buff = *pbuff;
   size_t size = EXTENDED_BUFF_SIZE (old_buff, min_extra);
@@ -1795,8 +1476,7 @@ _cpp_extend_buff (pfile, pbuff, min_extra)
 
 /* Free a chain of buffers starting at BUFF.  */
 void
-_cpp_free_buff (buff)
-     _cpp_buff *buff;
+_cpp_free_buff (_cpp_buff *buff)
 {
   _cpp_buff *next;
 
@@ -1809,9 +1489,7 @@ _cpp_free_buff (buff)
 
 /* Allocate permanent, unaligned storage of length LEN.  */
 unsigned char *
-_cpp_unaligned_alloc (pfile, len)
-     cpp_reader *pfile;
-     size_t len;
+_cpp_unaligned_alloc (cpp_reader *pfile, size_t len)
 {
   _cpp_buff *buff = pfile->u_buff;
   unsigned char *result = buff->cur;
@@ -1839,9 +1517,7 @@ _cpp_unaligned_alloc (pfile, len)
    All existing other uses clearly fit this restriction: storing
    registered pragmas during initialization.  */
 unsigned char *
-_cpp_aligned_alloc (pfile, len)
-     cpp_reader *pfile;
-     size_t len;
+_cpp_aligned_alloc (cpp_reader *pfile, size_t len)
 {
   _cpp_buff *buff = pfile->a_buff;
   unsigned char *result = buff->cur;