This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: cc1obj: Make Objective C the default language.


Ovidiu Predescu wrote:-

> > 2) Would you accept a follow-up patch to remove the (redundant)
> > Objective C "thang" tests for code in /objc?
> 
> Yes, I think so. If people start complaining that we broke something we can
> always revert back to previous code.

OK, how about this patch?  It bootstrapped x86 Linux without
regressions.  I don't thing we can touch other uses of it.

Neil.

	* objc/objc-act.c (lang_init, finish_file, maybe_objc_comptypes,
	maybe_objc_check_decl, build_objc_string_object,
	objc_declare_alias, objc_declare_class, build_message_expr,
	build_protocol_expr, build_selector_expr, build_encode_expr,
	get_class_ivars, start_class, start_protocol): Remove
	redundant code, assuming doing_objc_thang is true.

Index: objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.56
diff -u -p -r1.56 objc-act.c
--- objc-act.c	2000/11/29 22:19:28	1.56
+++ objc-act.c	2000/11/30 07:46:29
@@ -736,8 +736,7 @@ lang_init ()
 
   objc_ellipsis_node = make_node (ERROR_MARK);
 
-  if (doing_objc_thang)
-    init_objc ();
+  init_objc ();
 
   if (print_struct_values)
     generate_struct_by_value_array ();
@@ -755,8 +754,7 @@ objc_fatal ()
 void
 finish_file ()
 {
-  if (doing_objc_thang)
-    finish_objc ();		/* Objective-C finalization */
+  finish_objc ();		/* Objective-C finalization */
 
   if (gen_declaration_file)
     fclose (gen_declaration_file);
@@ -851,9 +849,7 @@ maybe_objc_comptypes (lhs, rhs, reflexiv
      tree lhs, rhs;
      int reflexive;
 {
-  if (doing_objc_thang)
-    return objc_comptypes (lhs, rhs, reflexive);
-  return -1;
+  return objc_comptypes (lhs, rhs, reflexive);
 }
 
 static tree
@@ -1095,8 +1091,7 @@ void
 maybe_objc_check_decl (decl)
      tree decl;
 {
-  if (doing_objc_thang)
-    objc_check_decl (decl);
+  objc_check_decl (decl);
 }
 
 /* Implement static typing.  At this point, we know we have an interface.  */
@@ -1415,9 +1410,6 @@ build_objc_string_object (strings)
   tree string, initlist, constructor;
   int length;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   if (lookup_interface (constant_string_id) == NULL_TREE)
     {
       error ("Cannot find interface declaration for `%s'",
@@ -2452,9 +2444,6 @@ objc_declare_alias (alias_ident, class_i
      tree alias_ident;
      tree class_ident;
 {
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   if (is_class_name (class_ident) != class_ident)
     warning ("Cannot find class `%s'", IDENTIFIER_POINTER (class_ident));
   else if (is_class_name (alias_ident))
@@ -2469,9 +2458,6 @@ objc_declare_class (ident_list)
 {
   tree list;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   for (list = ident_list; list; list = TREE_CHAIN (list))
     {
       tree ident = TREE_VALUE (list);
@@ -4942,9 +4928,6 @@ build_message_expr (mess)
   /* 1 if this is sending to the superclass.  */
   int super;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   if (TREE_CODE (receiver) == ERROR_MARK)
     return error_mark_node;
 
@@ -5355,12 +5338,7 @@ build_protocol_expr (protoname)
      tree protoname;
 {
   tree expr;
-  tree p;
-
-  if (!doing_objc_thang)
-    objc_fatal ();
-
-  p = lookup_protocol (protoname);
+  tree p = lookup_protocol (protoname);
 
   if (!p)
     {
@@ -5385,9 +5363,6 @@ build_selector_expr (selnamelist)
 {
   tree selname;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   /* Obtain the full selector name.  */
   if (TREE_CODE (selnamelist) == IDENTIFIER_NODE)
     /* A unary selector.  */
@@ -5410,9 +5385,6 @@ build_encode_expr (type)
   tree result;
   const char *string;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   encode_type (type, obstack_object_size (&util_obstack),
 	       OBJC_ENCODE_INLINE_DEFS);
   obstack_1grow (&util_obstack, 0);    /* null terminate string */
@@ -5935,9 +5907,6 @@ tree
 get_class_ivars (interface)
      tree interface;
 {
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   return build_ivar_chain (interface, 1);
 }
 
@@ -6138,9 +6107,6 @@ start_class (code, class_name, super_nam
 {
   tree class, decl;
 
-  if (!doing_objc_thang)
-    objc_fatal ();
-
   class = make_node (code);
   TYPE_BINFO (class) = make_tree_vec (5);
 
@@ -6449,9 +6415,6 @@ start_protocol (code, name, list)
      tree list;
 {
   tree protocol;
-
-  if (!doing_objc_thang)
-    objc_fatal ();
 
   /* This is as good a place as any.  Need to invoke push_tag_toplevel.  */
   if (!objc_protocol_template)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]