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]
Other format: [Raw text]

Fix ObjC constant strings with -fgnu-runtime on Darwin


This patch fixes the objc.dg/constr-str-1.m test on Darwin systems,
by turning a macro into a global.  Tested on powerpc-apple-darwin5.2,
aka Mac OS X 10.1.2.

Stan

2001-12-29  Stan Shebs  <shebs@apple.com>

        * objc/objc-act.c (STRING_OBJECT_CLASS_NAME): Remove.
        (default_constant_string_class_name): New global.
        (objc_init): Set it.
        (synth_module_prologue): Use it.

Index: objc/objc-act.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/objc/objc-act.c,v
retrieving revision 1.119
diff -c -3 -p -r1.119 objc-act.c
*** objc-act.c  2001/12/29 14:56:36     1.119
--- objc-act.c  2001/12/29 16:10:37
*************** static void ggc_mark_hash_table                 PARAMS
*** 363,373 ****
  #define UTAG_METHOD_PROTOTYPE "_objc_method_prototype"
  #define UTAG_METHOD_PROTOTYPE_LIST "_objc__method_prototype_list"
  
- #ifdef NEXT_OBJC_RUNTIME
- #define STRING_OBJECT_CLASS_NAME "NSConstantString"
- #else
- #define STRING_OBJECT_CLASS_NAME "NXConstantString"
- #endif
  /* Note that the string object global name is only needed for the
     NeXT runtime.  */
  #define STRING_OBJECT_GLOBAL_NAME "_NSConstantStringClassReference"
--- 363,368 ----
*************** static const char *TAG_GETMETACLASS;
*** 381,386 ****
--- 376,382 ----
  static const char *TAG_MSGSEND;
  static const char *TAG_MSGSENDSUPER;
  static const char *TAG_EXECCLASS;
+ static const char *default_constant_string_class_name;
  
  /* The OCTI_... enumeration itself is in objc/objc-act.h.  */
  tree objc_global_trees[OCTI_MAX];
*************** objc_init (filename)
*** 541,546 ****
--- 537,543 ----
        TAG_MSGSEND = "objc_msgSend";
        TAG_MSGSENDSUPER = "objc_msgSendSuper";
        TAG_EXECCLASS = "__objc_execClass";
+       default_constant_string_class_name = "NSConstantString";
      }
    else
      {
*************** objc_init (filename)
*** 549,554 ****
--- 546,552 ----
        TAG_MSGSEND = "objc_msg_lookup";
        TAG_MSGSENDSUPER = "objc_msg_lookup_super";
        TAG_EXECCLASS = "__objc_exec_class";
+       default_constant_string_class_name = "NXConstantString";
        flag_typed_selectors = 1;
      }
  
*************** synth_module_prologue ()
*** 1204,1210 ****
  
    /* Forward declare constant_string_id and constant_string_type.  */
    if (!constant_string_class_name)
!     constant_string_class_name = STRING_OBJECT_CLASS_NAME;
  
    constant_string_id = get_identifier (constant_string_class_name);
    constant_string_type = xref_tag (RECORD_TYPE, constant_string_id);
--- 1202,1208 ----
  
    /* Forward declare constant_string_id and constant_string_type.  */
    if (!constant_string_class_name)
!     constant_string_class_name = default_constant_string_class_name;
  
    constant_string_id = get_identifier (constant_string_class_name);
    constant_string_type = xref_tag (RECORD_TYPE, constant_string_id);


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