Index: ChangeLog
===================================================================
--- ChangeLog   (revision 170291)
+++ ChangeLog   (working copy)
@@ -1,3 +1,12 @@
+2011-01-18  Nicola Pero  <nicola.pero@meta-innovation.com>
+
+       * objc-act.c: Updated comments.
+       * objc-next-runtime-abi-02.c: Same.
+       * objc-runtime-shared-support.c: Same.
+       * objc-runtime-hooks.h: Same.
+       * objc-act.h: Same.
+       * objc-gnu-runtime-abi-01.c: Same.
+
 2011-02-17  Iain Sandoe  <iains@gcc.gnu.org>
 
        * config-lang.in (gtfiles): Updated.
Index: objc-runtime-shared-support.c
===================================================================
--- objc-runtime-shared-support.c       (revision 170291)
+++ objc-runtime-shared-support.c       (working copy)
@@ -507,7 +507,10 @@ build_module_descriptor (long vers, tree attr)
 
   /* Create an instance of "_objc_module".  */
   UOBJC_MODULES_decl = start_var_decl (objc_module_template,
-                       flag_next_runtime ? "_OBJC_Module" :  "_OBJC_Module");
+                                      /* FIXME - why the conditional
+                                         if the symbol is the
+                                         same.  */
+                                      flag_next_runtime ? "_OBJC_Module" :  "_OBJC_Module");
 
   /* This is the root of the metadata for defined classes and categories, it
      is referenced by the runtime and, therefore, needed.  */
Index: objc-act.c
===================================================================
--- objc-act.c  (revision 170291)
+++ objc-act.c  (working copy)
@@ -6553,6 +6553,7 @@ start_class (enum tree_code code, tree class_name,
            {
              tree name = TREE_PURPOSE (attribute);
              
+             /* TODO: Document what the objc_exception attribute is/does.  */
              /* We handle the 'deprecated' and (undocumented) 'objc_exception'
                 attributes.  */
              if (is_attribute_p  ("deprecated", name))
@@ -7505,10 +7506,6 @@ objc_gen_property_data (tree klass, tree class_met
       /* @dynamic property - nothing to check or synthesize.  */
       if (PROPERTY_DYNAMIC (x))
        continue;
-  /* Add any property that is declared in the interface, but undeclared in the
-     implementation to thie implementation. These are the 'dynamic' properties.
-  
-  objc_v2_merge_dynamic_property ();*/
       
       /* @synthesize property - need to synthesize the accessors.  */
       if (PROPERTY_IVAR_NAME (x))
@@ -7771,7 +7768,6 @@ objc_declare_protocols (tree names, tree attribute
          add_protocol (protocol);
          PROTOCOL_DEFINED (protocol) = 0;
          PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
-/*       PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/
          
          if (attributes)
            {
@@ -7824,7 +7820,6 @@ start_protocol (enum tree_code code, tree name, tr
       add_protocol (protocol);
       PROTOCOL_DEFINED (protocol) = 1;
       PROTOCOL_FORWARD_DECL (protocol) = NULL_TREE;
-/*      PROTOCOL_V2_FORWARD_DECL (protocol) = NULL_TREE;*/
 
       check_protocol_recursively (protocol, list);
     }
@@ -8466,10 +8461,11 @@ void
 objc_clear_super_receiver (void)
 {
   if (objc_method_context
-      && UOBJC_SUPER_scope == objc_get_current_scope ()) {
-    UOBJC_SUPER_decl = 0;
-    UOBJC_SUPER_scope = 0;
-  }
+      && UOBJC_SUPER_scope == objc_get_current_scope ())
+    {
+      UOBJC_SUPER_decl = 0;
+      UOBJC_SUPER_scope = 0;
+    }
 }
 
 void
@@ -10357,26 +10353,32 @@ encode_field_decl (tree field_decl, int curtype, i
     encode_type (TREE_TYPE (field_decl), curtype, format);
 }
 
-/* This routine encodes the attribute of the input PROPERTY according to following
-   formula:
+/* This routine encodes the attribute of the input PROPERTY according
+   to following formula:
 
-Property attributes are stored as a comma-delimited C string. The simple attributes 
-readonly and copies are encoded as single characters. The parametrized attributes, 
-getter=name, setter=name, and ivar=name, are encoded as single characters, followed 
-by an identifier. Property types are also encoded as a parametrized attribute. The 
-characters used to encode these attributes are defined by the following enumeration:
+   Property attributes are stored as a comma-delimited C string.
+   Simple attributes such as readonly are encoded as single
+   character. The parametrized attributes, getter=name and
+   setter=name, are encoded as a single character followed by an
+   identifier.  Property types are also encoded as a parametrized
+   attribute.  The characters used to encode these attributes are
+   defined by the following enumeration:
 
-enum PropertyAttributes {
-    kPropertyReadOnly = 'r',                    // property is read-only.
-    kPropertyCopies = 'c',                      // property is a copy of the value last assigned
-    kPropertyGetter = 'g',                      // followed by getter selector name
-    kPropertySetter = 's',                      // followed by setter selector name
-    kPropertyInstanceVariable = 'i'            // followed by instance variable  name
-    kPropertyType = 't'                         // followed by old-style type encoding.
-};
+   enum PropertyAttributes {
+     kPropertyReadOnly = 'R',
+     kPropertyBycopy = 'C',
+     kPropertyByref = '&',
+     kPropertyDynamic = 'D',
+     kPropertyGetter = 'G',
+     kPropertySetter = 'S',
+     kPropertyInstanceVariable = 'V',
+     kPropertyType = 't',
+     kPropertyWeak = 'W',
+     kPropertyStrong = 'S',
+     kPropertyNonAtomic = 'N'
+   };
 
-*/
-
+   FIXME: Update the implementation to match.  */
 tree
 objc_v2_encode_prop_attr (tree property)
 {
Index: objc-next-runtime-abi-02.c
===================================================================
--- objc-next-runtime-abi-02.c  (revision 170291)
+++ objc-next-runtime-abi-02.c  (working copy)
@@ -22,14 +22,8 @@ along with GCC; see the file COPYING3.  If not see
 
 /* The NeXT ABI2 is used for m64 implementations on Darwin/OSX machines.
    
-   This version is intended to match (logically) output of Apple's 4.2.1
-   compiler.
-   
-   References:
-   FSF GCC branches/apple/trunk.
-   objc4-371.2 Open Source release (Apple Computer). (objc-runtime-new.h)
-   gcc_42-5664 Apple Local modifications to GCC (Apple Computer).
-*/
+   This version is intended to match (logically) the output of Apple's
+   4.2.1 compiler.  */
 
 #include "config.h"
 #include "system.h"
Index: objc-runtime-hooks.h
===================================================================
--- objc-runtime-hooks.h        (revision 170291)
+++ objc-runtime-hooks.h        (working copy)
@@ -25,7 +25,7 @@ along with GCC; see the file COPYING3.  If not see
 
 /* Objective-C supports several runtime library variants: 
 
-   "GNU" runtime selected by -fgnu-runtime (currently at API version 1).
+   "GNU" runtime selected by -fgnu-runtime (currently at ABI version 8).
    "NeXT" runtime (selected by -fnext-runtime) and installed on OSX/Darwin
    systems at API version 1 (for m32 code) and version 2 (for m64 code).
    
@@ -33,8 +33,11 @@ along with GCC; see the file COPYING3.  If not see
    and so on, and the purpose of this interface is to abstract such
    differences from the parser's perspective.  */
 
+/* TODO: Do we want the initial underscore ? */
 typedef struct _objc_runtime_hooks_r 
 {
+  /* TODO: Expand comments in this file.  */
+
   /* Initialize for this runtime.  */
   void (*initialize) (void);
   const char *default_constant_string_class_name;
Index: objc-act.h
===================================================================
--- objc-act.h  (revision 170291)
+++ objc-act.h  (working copy)
@@ -165,6 +165,7 @@ typedef enum objc_property_assign_semantics {
 #define CLASS_PROTOCOL_LIST(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 4)
 #define TOTAL_CLASS_RAW_IVARS(CLASS) TREE_VEC_ELT (TYPE_LANG_SLOT_1 (CLASS), 5)
 
+/* FIXME */
 #define CLASS_HAS_EXCEPTION_ATTR(CLASS) ((CLASS)->type.lang_flag_0)
 
 #define PROTOCOL_NAME(CLASS) ((CLASS)->type.name)
@@ -396,6 +397,7 @@ enum objc_tree_index
     OCTI_GET_PROPERTY_STRUCT_DECL,
     OCTI_SET_PROPERTY_STRUCT_DECL,
 
+    /* TODO: Add comment.  */
     /* "V1" stuff.  */
     OCTI_V1_PROP_LIST_TEMPL,
     OCTI_V1_PROP_NAME_ATTR_CHAIN,
@@ -586,6 +588,7 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX];
 #define objc_setPropertyStruct_decl \
                                objc_global_trees[OCTI_SET_PROPERTY_STRUCT_DECL]
 
+/* TODO: Add comment.  */
 /* V1 stuff.  */
 #define objc_prop_list_ptr     objc_global_trees[OCTI_V1_PROP_LIST_TEMPL]
 #define prop_names_attr_chain  objc_global_trees[OCTI_V1_PROP_NAME_ATTR_CHAIN]
Index: objc-gnu-runtime-abi-01.c
===================================================================
--- objc-gnu-runtime-abi-01.c   (revision 170291)
+++ objc-gnu-runtime-abi-01.c   (working copy)
@@ -1,4 +1,4 @@
-/* GNU Runtime (ABI-0/1) private.
+/* GNU Runtime ABI version 8
    Copyright (C) 2011 Free Software Foundation, Inc.
    Contributed by Iain Sandoe (split from objc-act.c)
 
@@ -83,6 +83,7 @@ along with GCC; see the file COPYING3.  If not see
   if (VERS)                                                            \
     DECL_ATTRIBUTES (DECL) = build_tree_list ((VERS), (KIND));
 
+/* FIXME: Remove this macro, not needed.  */
 #ifndef TARGET_64BIT
 #define TARGET_64BIT 0
 #endif
@@ -143,6 +144,10 @@ objc_gnu_runtime_abi_01_init (objc_runtime_hooks *
       flag_objc_sjlj_exceptions = 0;
     }
 
+  /* TODO: Complain if -fobjc-abi-version=N was used.  */
+
+  /* TODO: Complain if -fobj-nilcheck was used.  */
+
   rthooks->initialize = gnu_runtime_01_initialize;
   rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME;
   rthooks->tag_getclass = TAG_GETCLASS;
@@ -573,7 +578,8 @@ gnu_runtime_abi_01_get_class_reference (tree ident
                                                (IDENTIFIER_LENGTH (ident) + 1,
                                                 IDENTIFIER_POINTER (ident)));
 
-/*      assemble_external (objc_get_class_decl);*/
+  /* FIXME: Do we need this assemble_external() ? */
+  /* assemble_external (objc_get_class_decl);*/
   return build_function_call (input_location, objc_get_class_decl, params);
 }

@@ -794,7 +800,7 @@ gnu_runtime_abi_01_get_protocol_reference (locatio
   return expr;
 }
 
-/* For ABI 0/1 and IVAR is just a fixed offset in the class struct.  */
+/* For ABI 8 an IVAR is just a fixed offset in the class struct.  */
 
 static tree
 gnu_runtime_abi_01_build_ivar_ref (location_t loc ATTRIBUTE_UNUSED, 
@@ -837,7 +843,8 @@ gnu_runtime_abi_01_get_category_super_ref (locatio
 
   add_class_reference (super_name);
   super_class = (inst_meth ? objc_get_class_decl : objc_get_meta_class_decl);
-/* assemble_external (super_class);*/
+  /* FIXME: Do we need this assemble_external() ? */
+  /* assemble_external (super_class);*/
   super_name = my_build_string_pointer (IDENTIFIER_LENGTH (super_name) + 1,
                                        IDENTIFIER_POINTER (super_name));
   /* super_class = get_{meta_}class("CLASS_SUPER_NAME");  */
@@ -1475,16 +1482,10 @@ generate_category (struct imp_entry *impent)
      long instance_size;
      struct objc_ivar_list *ivars;
      struct objc_method_list *methods;
-     if (flag_next_runtime)
-       struct objc_cache *cache;
-     else {
-       struct sarray *dtable;
-       struct objc_class *subclass_list;
-       struct objc_class *sibling_class;
-     }
+     struct sarray *dtable;
+     struct objc_class *subclass_list;
+     struct objc_class *sibling_class;
      struct objc_protocol_list *protocols;
-     if (flag_next_runtime)
-       void *sel_id;
      void *gc_object_type;
    };  */
 
@@ -1542,6 +1543,7 @@ build_shared_structure_initializer (tree type, tre
       CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
     }
 
+  /* FIXME: Remove NeXT runtime code.  */
   if (flag_next_runtime)
     {
       ltyp = build_pointer_type (xref_tag (RECORD_TYPE,
@@ -1573,6 +1575,7 @@ build_shared_structure_initializer (tree type, tre
       CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, expr);
     }
 
+  /* FIXME: Remove NeXT runtime code.  */
   if (flag_next_runtime)
     /* sel_id = NULL */
     CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, build_int_cst (NULL_TREE, 0));
@@ -1864,6 +1867,7 @@ generate_static_references (void)
   char buf[BUFSIZE];
   VEC(constructor_elt,gc) *decls = NULL;
 
+  /* FIXME: Remove NeXT runtime code.  */
   if (flag_next_runtime)
     gcc_unreachable ();
 
@@ -1991,6 +1995,7 @@ build_objc_symtab_template (void)
   /* short cat_def_cnt; */
   add_field_decl (short_integer_type_node, "cat_def_cnt", &chain);
 
+  /* FIXME: Remove.  */
   if (TARGET_64BIT)
     add_field_decl (integer_type_node, "_explicit_padder", &chain);
 
@@ -2037,6 +2042,8 @@ init_objc_symtab (tree type)
 
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, 
                          build_int_cst (short_integer_type_node, cat_count));
+
+  /* FIXME: Remove.  */
   if (TARGET_64BIT)
     CONSTRUCTOR_APPEND_ELT (v, NULL_TREE,
                          build_int_cst (integer_type_node, 0));
@@ -2044,8 +2051,11 @@ init_objc_symtab (tree type)
   /* cls_def = { ..., { &Foo, &Bar, ...}, ... } */
 
   field = TYPE_FIELDS (type);
+
+  /* FIXME: Remove.  */
   if (TARGET_64BIT)
     field = DECL_CHAIN (field);
+
   field = DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (DECL_CHAIN (field))));
 
   CONSTRUCTOR_APPEND_ELT (v, NULL_TREE, init_def_list (TREE_TYPE (field)));
@@ -2104,6 +2114,9 @@ objc_generate_v1_gnu_metadata (void)
   if (protocol_chain)
     generate_protocols ();
 
+  /* FIXME: Only generate metadata if there is anything to put in
+     there.  */
+
   /* Arrange for ObjC data structures to be initialized at run time.  */
   generate_objc_symtab_decl ();
   /* Make sure that the meta-data are identified as being GNU-runtime.  */
