(dollars_in_ident): Remove; replaced by is_idchar['$'].
authorRichard Kenner <kenner@gcc.gnu.org>
Wed, 9 Oct 1996 20:20:59 +0000 (16:20 -0400)
committerRichard Kenner <kenner@gcc.gnu.org>
Wed, 9 Oct 1996 20:20:59 +0000 (16:20 -0400)
(main): Initialize is_idchar and is_idstart directly when given -$.
Ignore DOLLARS_IN_IDENTIFIERS.
(rescan): Diagnose $ in identifier if pedantic.
(initialize_char_syntax): Assume $ is allowed in identifier; `main' will
change this if -$ is given.

From-SVN: r12934

gcc/cccp.c

index 7d6f3f503df10f429186567b2c2a2b8f657b9d81..4d1961191ee5dea42e941a6ae3e01daaeb8794e4 100644 (file)
@@ -1032,18 +1032,6 @@ static int errors = 0;                   /* Error counter for exit code */
 /* Name of output file, for error messages.  */
 static char *out_fname;
 
-/* Zero means dollar signs are punctuation.
-   -$ stores 0; -traditional may store 1.  Default is 1 for VMS, 0 otherwise.
-   This must be 0 for correct processing of this ANSI C program:
-       #define foo(a) #a
-       #define lose(b) foo (b)
-       #define test$
-       lose (test)     */
-static int dollars_in_ident;
-#ifndef DOLLARS_IN_IDENTIFIERS
-#define DOLLARS_IN_IDENTIFIERS 1
-#endif
-
 
 /* Stack of conditionals currently in progress
    (including both successful and failing conditionals).  */
@@ -1354,10 +1342,8 @@ main (argc, argv)
   in_fname = NULL;
   out_fname = NULL;
 
-  /* Initialize is_idchar to allow $.  */
-  dollars_in_ident = 1;
+  /* Initialize is_idchar.  */
   initialize_char_syntax ();
-  dollars_in_ident = DOLLARS_IN_IDENTIFIERS > 0;
 
   no_line_directives = 0;
   no_trigraphs = 1;
@@ -1512,8 +1498,6 @@ main (argc, argv)
        if (!strcmp (argv[i], "-traditional")) {
          traditional = 1;
          cplusplus_comments = 0;
-         if (dollars_in_ident > 0)
-           dollars_in_ident = 1;
        } else if (!strcmp (argv[i], "-trigraphs")) {
          no_trigraphs = 0;
        }
@@ -1715,7 +1699,7 @@ main (argc, argv)
        break;
 
       case '$':                        /* Don't include $ in identifiers.  */
-       dollars_in_ident = 0;
+       is_idchar['$'] = is_idstart['$'] = 0;
        break;
 
       case 'I':                        /* Add directory to path for includes.  */
@@ -1778,9 +1762,6 @@ main (argc, argv)
   if (cp && ! no_standard_includes)
     path_include (cp);
 
-  /* Now that dollars_in_ident is known, initialize is_idchar.  */
-  initialize_char_syntax ();
-
   /* Initialize output buffer */
 
   outbuf.buf = (U_CHAR *) xmalloc (OUTBUF_SIZE);
@@ -3053,8 +3034,10 @@ do { ip = &instack[indepth];             \
       break;
 
     case '$':
-      if (!dollars_in_ident)
+      if (! is_idchar['$'])
        goto randomchar;
+      if (pedantic)
+       pedwarn ("`$' in identifier");
       goto letter;
 
     case '0': case '1': case '2': case '3': case '4':
@@ -9445,8 +9428,8 @@ initialize_char_syntax ()
     is_idchar[i] = 1;
   is_idchar['_'] = 1;
   is_idstart['_'] = 1;
-  is_idchar['$'] = dollars_in_ident;
-  is_idstart['$'] = dollars_in_ident;
+  is_idchar['$'] = 1;
+  is_idstart['$'] = 1;
 
   /* horizontal space table */
   is_hor_space[' '] = 1;