]> gcc.gnu.org Git - gcc.git/commitdiff
cppexp.c (cpp_lex): Allocate token_buffer dynamically.
authorDave Brolley <brolley@cygnus.com>
Thu, 21 Jan 1999 12:58:38 +0000 (12:58 +0000)
committerDave Brolley <brolley@gcc.gnu.org>
Thu, 21 Jan 1999 12:58:38 +0000 (07:58 -0500)
Thu Jan 21 15:48:03 1999  Dave Brolley  <brolley@cygnus.com>
* cppexp.c (cpp_lex): Allocate token_buffer dynamically.

From-SVN: r24802

gcc/ChangeLog
gcc/cppexp.c

index 69e53eb413434550e957d661a2b6bc0229871e43..b8ffa87e5b7908b2b96f77b3c7cd5ab8dac3c6b4 100644 (file)
@@ -1,3 +1,7 @@
+Thu Jan 21 15:48:03 1999  Dave Brolley  <brolley@cygnus.com>
+
+       * cppexp.c (cpp_lex): Allocate token_buffer dynamically.
+
 Thu Jan 21 14:18:04 EST 1999  Andrew MacLeod  <amacleod@cygnus.com>
 
        * expr.c (MOVE_BY_PIECES_P): Define condition for deciding to use
index f8da2223a6c59989aa93488e7391790c74a8f600..bd8e663b09b39f2010fc5be2e31776a0de06e1ae 100644 (file)
@@ -254,6 +254,10 @@ static struct token tokentab2[] = {
   {NULL, ERROR}
 };
 
+/* This is used to accumulate the value of a character literal.  It is static
+   so that it only gets allocated once per compilation.  */
+static char *token_buffer = NULL;
+
 /* Read one token.  */
 
 struct operation
@@ -323,11 +327,18 @@ cpp_lex (pfile, skip_evaluation)
        int wide_flag = 0;
        int max_chars;
        U_CHAR *ptr = tok_start;
+
+       /* We need to allocate this buffer dynamically since the size is not
+          a constant expression on all platforms.  */
+       if (token_buffer == NULL)
+         {
 #ifdef MULTIBYTE_CHARS
-       char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + MB_CUR_MAX];
+           token_buffer = xmalloc (MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE
+                                   + MB_CUR_MAX);
 #else
-       char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1];
+           token_buffer = xmalloc (MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1);
 #endif
+         }
 
        if (*ptr == 'L')
          {
This page took 0.213392 seconds and 5 git commands to generate.