Delete doing_objc_thang

Neil Booth neil@daikokuya.demon.co.uk
Sat May 12 02:42:00 GMT 2001


This used to be a variable I think, but during 3.0 development mutated
into a macro.  It's only used in c-parse.in.

It is a test for the objc front end, but has confusingly tended to be
redundantly nested inside other tests for the objc front end,
misleading one into thinking that "doing_objc_thang" is some kind of
sub-state of the front end :-) Because it is confusing, I'd like to
just zap it altogether.  Deleting it is also a minor simplification.

OK to commit?  It's bootstrapped and made check for all 3 C-family
front ends.

Neil.

	* c-parse.in (bison parser, init_reswords): Remove uses of
	doing_objc_thang.
	* c-tree.h (doing_objc_thang): Remove.

Index: c-parse.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-parse.in,v
retrieving revision 1.87
diff -u -p -r1.87 c-parse.in
--- c-parse.in	2001/05/11 06:38:48	1.87
+++ c-parse.in	2001/05/12 00:06:59
@@ -701,32 +701,22 @@ primary:
 	| primary '.' identifier
 		{
 ifobjc
-                  if (doing_objc_thang)
-                    {
-		      if (is_public ($1, $3))
-			$$ = build_component_ref ($1, $3);
-		      else
-			$$ = error_mark_node;
-		    }
-                  else
+		    if (!is_public ($1, $3))
+		      $$ = error_mark_node;
+		    else
 end ifobjc
-		    $$ = build_component_ref ($1, $3);
+		      $$ = build_component_ref ($1, $3);
 		}
 	| primary POINTSAT identifier
 		{
                   tree expr = build_indirect_ref ($1, "->");
 
 ifobjc
-                  if (doing_objc_thang)
-                    {
-		      if (is_public (expr, $3))
-			$$ = build_component_ref (expr, $3);
-		      else
+		      if (!is_public (expr, $3))
 			$$ = error_mark_node;
-		    }
-                  else
+		      else
 end ifobjc
-                    $$ = build_component_ref (expr, $3);
+			$$ = build_component_ref (expr, $3);
 		}
 	| primary PLUSPLUS
 		{ $$ = build_unary_op (POSTINCREMENT_EXPR, $1, 0); }
@@ -3592,11 +3582,13 @@ init_reswords ()
 {
   unsigned int i;
   tree id;
-  int mask = ((doing_objc_thang ? 0 : D_OBJC)
-	      | (flag_isoc99 ? 0 : D_C89)
+  int mask = (flag_isoc99 ? 0 : D_C89)
 	      | (flag_traditional ? D_TRAD : 0)
 	      | (flag_no_asm ? (flag_isoc99 ? D_EXT : D_EXT|D_EXT89) : 0));
 
+  if (c_language != clk_objective_c)
+     mask |= D_OBJC;
+
   /* It is not necessary to register ridpointers as a GC root, because
      all the trees it points to are permanently interned in the
      get_identifier hash anyway.  */
@@ -3715,7 +3707,8 @@ yylexname ()
       if (TREE_CODE (decl) == TYPE_DECL)
 	return TYPENAME;
     }
-  else if (doing_objc_thang)
+ifobjc
+  else
     {
       tree objc_interface_decl = is_class_name (yylval.ttype);
 
@@ -3725,6 +3718,7 @@ yylexname ()
 	  return CLASSNAME;
 	}
     }
+end ifobjc
 
   return IDENTIFIER;
 }
Index: c-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-tree.h,v
retrieving revision 1.57
diff -u -p -r1.57 c-tree.h
--- c-tree.h	2001/05/11 06:38:47	1.57
+++ c-tree.h	2001/05/12 00:07:00
@@ -359,11 +359,6 @@ extern int system_header_p;
 /* Warn about implicit declarations.  1 = warning, 2 = error.  */
 extern int mesg_implicit_function_declaration;
 
-/* Nonzero enables objc features.  */
-
-#define doing_objc_thang \
-  (c_language == clk_objective_c)
-
 /* In c-decl.c */
 extern void finish_incomplete_decl PARAMS ((tree));
 



More information about the Gcc-patches mailing list