Author: petdance
Date: Fri Jun  8 09:03:34 2007
New Revision: 18880

Modified:
   trunk/include/parrot/intlist.h
   trunk/include/parrot/list.h
   trunk/include/parrot/misc.h
   trunk/include/parrot/pmc.h
   trunk/src/inter_misc.c
   trunk/src/intlist.c
   trunk/src/list.c
   trunk/src/pmc.c
   trunk/src/pmc/class.pmc
   trunk/src/utils.c

Log:
Adding more /*NN*/ flags to parms to set up complier attributes.  And fixed 
some whitespace

Modified: trunk/include/parrot/intlist.h
==============================================================================
--- trunk/include/parrot/intlist.h      (original)
+++ trunk/include/parrot/intlist.h      Fri Jun  8 09:03:34 2007
@@ -43,7 +43,9 @@
 void intlist_assign( Interp *i, IntList *l /*NN*/, INTVAL idx, INTVAL val )
         __attribute__nonnull__(2);
 
-IntList * intlist_clone( Interp *i, IntList *list )
+IntList * intlist_clone( Interp *i /*NN*/, IntList *list/*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         __attribute__warn_unused_result__;
 
 void intlist_dump( FILE *fp, IntList *list /*NN*/, int verbose )
@@ -59,7 +61,9 @@
         __attribute__pure__
         __attribute__warn_unused_result__;
 
-void intlist_mark( Interp *i, IntList *l );
+void intlist_mark( Interp *i, IntList *l /*NN*/ )
+        __attribute__nonnull__(2);
+
 IntList * intlist_new( Interp *i )
         __attribute__warn_unused_result__;
 

Modified: trunk/include/parrot/list.h
==============================================================================
--- trunk/include/parrot/list.h (original)
+++ trunk/include/parrot/list.h Fri Jun  8 09:03:34 2007
@@ -89,7 +89,9 @@
     int type )
         __attribute__nonnull__(2);
 
-PARROT_API List * list_clone( Interp *interp, List *other /*NN*/ )
+PARROT_API List * list_clone( Interp *interp /*NN*/,
+    const List *other /*NN*/ )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__warn_unused_result__;
 
@@ -153,7 +155,9 @@
     INTVAL len )
         __attribute__nonnull__(2);
 
-PARROT_API void * list_shift( Interp *interp, List *list, int type );
+PARROT_API void * list_shift( Interp *interp, List *list /*NN*/, int type )
+        __attribute__nonnull__(2);
+
 PARROT_API void list_splice( Interp *interp,
     List *list /*NN*/,
     List *value_list /*NULLOK*/,

Modified: trunk/include/parrot/misc.h
==============================================================================
--- trunk/include/parrot/misc.h (original)
+++ trunk/include/parrot/misc.h Fri Jun  8 09:03:34 2007
@@ -43,9 +43,13 @@
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
+PARROT_API void Parrot_destroy_cpa( char **array /*NN*/ )
+        __attribute__nonnull__(1);
+
 PARROT_API void Parrot_destroy_la( long *array );
 PARROT_API FLOATVAL Parrot_float_rand( INTVAL how_random );
 PARROT_API INTVAL Parrot_int_rand( INTVAL how_random );
+PARROT_API void * Parrot_make_cpa( Interp *interp, PMC *array );
 PARROT_API void * Parrot_make_la( Interp *interp, PMC *array /*NN*/ )
         __attribute__nonnull__(2)
         __attribute__warn_unused_result__;

Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h  (original)
+++ trunk/include/parrot/pmc.h  Fri Jun  8 09:03:34 2007
@@ -21,32 +21,45 @@
 
 /* HEADERIZER BEGIN: src/pmc.c */
 
-PARROT_API void Parrot_create_mro( Interp *interp, INTVAL type );
+PARROT_API void Parrot_create_mro( Interp *interp /*NN*/, INTVAL type )
+        __attribute__nonnull__(1);
+
+PARROT_API void Parrot_create_pmc_proxy( Interp* interp /*NN*/, int type_num )
+        __attribute__nonnull__(1);
+
 PARROT_API PMC * constant_pmc_new( Interp *interp, INTVAL base_type );
 PARROT_API PMC * constant_pmc_new_init( Interp *interp,
     INTVAL base_type,
     PMC *init );
 
 PARROT_API PMC * constant_pmc_new_noinit( Interp *interp, INTVAL base_type );
-PARROT_API void dod_register_pmc( Interp* interp, PMC* pmc );
-void dod_unregister_pmc( Interp* interp, PMC* pmc );
+PARROT_API void dod_register_pmc( Interp* interp /*NN*/, PMC* pmc )
+        __attribute__nonnull__(1);
+
+void dod_unregister_pmc( Interp* interp /*NN*/, PMC* pmc )
+        __attribute__nonnull__(1);
+
 PARROT_API PMC * pmc_new( Interp *interp, INTVAL base_type );
 PARROT_API PMC * pmc_new_init( Interp *interp, INTVAL base_type, PMC *init );
 PARROT_API PMC * pmc_new_noinit( Interp *interp, INTVAL base_type );
-PARROT_API INTVAL pmc_register( Interp* interp, STRING *name );
-PARROT_API PMC* pmc_reuse( Interp *interp,
+PARROT_API INTVAL pmc_register( Interp* interp /*NN*/, STRING *name )
+        __attribute__nonnull__(1);
+
+PARROT_API PMC* pmc_reuse( Interp *interp /*NN*/,
     PMC *pmc /*NN*/,
     INTVAL new_type,
     UINTVAL flags )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_API INTVAL pmc_type( Interp* interp, STRING *name )
+PARROT_API INTVAL pmc_type( Interp* interp /*NN*/, STRING *name )
+        __attribute__nonnull__(1)
         __attribute__pure__
         __attribute__warn_unused_result__;
 
-PARROT_API INTVAL pmc_type_p( Interp* interp, PMC *name );
+PARROT_API INTVAL pmc_type_p( Interp* interp /*NN*/, PMC *name )
+        __attribute__nonnull__(1);
 
-PARROT_API void Parrot_create_pmc_proxy( Interp* interp, int type_num );
 /* HEADERIZER END: src/pmc.c */
 
 /* Internal use */

Modified: trunk/src/inter_misc.c
==============================================================================
--- trunk/src/inter_misc.c      (original)
+++ trunk/src/inter_misc.c      Fri Jun  8 09:03:34 2007
@@ -42,16 +42,16 @@
                     const char *name, const char *proto)
 {
     PMC * const method = pmc_new(interp, enum_class_NCI);
-    STRING * const method_name = string_make(interp, name, strlen(name), 
+    STRING * const method_name = string_make(interp, name, strlen(name),
         NULL, PObj_constant_FLAG|PObj_external_FLAG);
     PMC *proxy;
-    
+
     /* create call func */
     VTABLE_set_pointer_keyed_str(interp, method,
             string_make(interp, proto, strlen(proto), NULL,
                 PObj_constant_FLAG|PObj_external_FLAG),
             func);
-    
+
     /* insert it into namespace */
     VTABLE_set_pmc_keyed_str(interp, interp->vtables[type]->_namespace,
             method_name, method);
@@ -68,7 +68,7 @@
         const char *name)
 {
     PMC * const method = pmc_new(interp, enum_class_NCI);
-    STRING * const method_name = string_make(interp, name, strlen(name), 
+    STRING * const method_name = string_make(interp, name, strlen(name),
         NULL, PObj_constant_FLAG|PObj_external_FLAG);
     PMC *proxy;
 

Modified: trunk/src/intlist.c
==============================================================================
--- trunk/src/intlist.c (original)
+++ trunk/src/intlist.c Fri Jun  8 09:03:34 2007
@@ -150,7 +150,7 @@
 */
 
 void
-intlist_mark(Interp *i, IntList *l)
+intlist_mark(Interp *i, IntList *l /*NN*/)
 {
     list_mark(i, (List *)l);
 }
@@ -167,7 +167,7 @@
 */
 
 IntList *
-intlist_clone(Interp *i, IntList *list)
+intlist_clone(Interp *i /*NN*/, IntList *list/*NN*/)
     /* WARN_UNUSED */
 {
     return (IntList *)list_clone(i, (List *)list);

Modified: trunk/src/list.c
==============================================================================
--- trunk/src/list.c    (original)
+++ trunk/src/list.c    Fri Jun  8 09:03:34 2007
@@ -465,7 +465,7 @@
 */
 
 static UINTVAL
-rebuild_chunk_list(Interp *interp, List *list /*NN*/)
+rebuild_chunk_list(Interp *interp /*NN*/, List *list /*NN*/)
 {
     List_chunk *chunk, *prev, *first;
     UINTVAL len;
@@ -543,7 +543,7 @@
             }
             /* growing chunk block could optimize small growing blocks, they
              * are probably not worth the effort. */
-            else if (prev->items == chunk->items >> 1) {
+            else if (prev && (prev->items == chunk->items >> 1)) {
                 first->n_chunks++;
                 first->n_items += chunk->items;
                 first->flags = grow_items;
@@ -1271,13 +1271,11 @@
 
 TODO - Barely tested. Optimize new array structure, fixed if big.
 
-TODO - The *other arg should be able to be a const pointer
-
 */
 
 PARROT_API
 List *
-list_clone(Interp *interp, List *other /*NN*/)
+list_clone(Interp *interp /*NN*/, const List *other /*NN*/)
     /* WARN_UNUSED */
 {
     List *l;
@@ -1701,7 +1699,7 @@
 
 PARROT_API
 void *
-list_shift(Interp *interp, List *list, int type)
+list_shift(Interp *interp, List *list /*NN*/, int type)
 {
     void *ret;
     UINTVAL idx = list->start++;

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c     (original)
+++ trunk/src/pmc.c     Fri Jun  8 09:03:34 2007
@@ -57,7 +57,7 @@
 
 PARROT_API
 PMC*
-pmc_reuse(Interp *interp, PMC *pmc /*NN*/, INTVAL new_type,
+pmc_reuse(Interp *interp /*NN*/, PMC *pmc /*NN*/, INTVAL new_type,
           UINTVAL flags)
 {
     INTVAL has_ext, new_flags;
@@ -154,7 +154,7 @@
 */
 
 static PMC*
-get_new_pmc_header(Interp *interp, INTVAL base_type, UINTVAL flags)
+get_new_pmc_header(Interp *interp /*NN*/, INTVAL base_type, UINTVAL flags)
 {
     PMC *pmc;
     VTABLE *vtable = interp->vtables[base_type];
@@ -330,7 +330,7 @@
 
 PARROT_API
 INTVAL
-pmc_register(Interp* interp, STRING *name)
+pmc_register(Interp* interp /*NN*/, STRING *name)
 {
     INTVAL type;
     PMC *classname_hash;
@@ -365,7 +365,7 @@
 
 PARROT_API
 INTVAL
-pmc_type(Interp* interp, STRING *name)
+pmc_type(Interp* interp /*NN*/, STRING *name)
     /* PURE, WARN_UNUSED */
 {
     PMC * const classname_hash = interp->class_hash;
@@ -388,7 +388,7 @@
 
 PARROT_API
 INTVAL
-pmc_type_p(Interp* interp, PMC *name)
+pmc_type_p(Interp* interp /*NN*/, PMC *name)
 {
     PMC * const classname_hash = interp->class_hash;
     PMC * const item = (PMC *)VTABLE_get_pointer_keyed(interp, classname_hash, 
name);
@@ -450,7 +450,7 @@
 
 PARROT_API
 void
-Parrot_create_mro(Interp *interp, INTVAL type)
+Parrot_create_mro(Interp *interp /*NN*/, INTVAL type)
 {
     STRING *class_name, *isa;
     INTVAL pos, parent_type, total;
@@ -513,7 +513,7 @@
 
 PARROT_API
 void
-dod_register_pmc(Interp* interp, PMC* pmc)
+dod_register_pmc(Interp* interp /*NN*/, PMC* pmc)
 {
     PMC *registry;
     /* Better not trigger a DOD run with a potentially unanchored PMC */
@@ -538,7 +538,7 @@
 */
 
 void
-dod_unregister_pmc(Interp* interp, PMC* pmc)
+dod_unregister_pmc(Interp* interp /*NN*/, PMC* pmc)
 {
     if (!interp->DOD_registry)
         return; /* XXX or signal exception? */
@@ -558,14 +558,14 @@
 
 PARROT_API
 void
-Parrot_create_pmc_proxy(Interp* interp, int type_num)
+Parrot_create_pmc_proxy(Interp* interp /*NN*/, int type_num)
 {
     PMC *proxy;
     Parrot_PMCProxy *proxy_info;
 
     /* Ensure that it's a valid type number. */
     if (type_num > interp->n_vtable_max || type_num < 0)
-        internal_exception(1, 
+        internal_exception(1,
             "Attempt to create PMC Proxy for invalid type number!");
 
     /* Create PMC proxy object and set up number, name and namespcae. */
@@ -576,9 +576,9 @@
     proxy_info->_namespace = interp->vtables[type_num]->_namespace;
 
     /* XXX Parents and MRO still todo. */
-        
+
     /* Enter it in the list of proxy objects. */
-    VTABLE_set_pmc_keyed_int(interp, interp->pmc_proxies, type_num, proxy);    
+    VTABLE_set_pmc_keyed_int(interp, interp->pmc_proxies, type_num, proxy);
 }
 
 

Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc     (original)
+++ trunk/src/pmc/class.pmc     Fri Jun  8 09:03:34 2007
@@ -985,8 +985,8 @@
         iter = VTABLE_get_iter(interp, args);
         while (VTABLE_get_bool(interp, iter)) {
             /* Get name and value. */
-            STRING *attr_name = VTABLE_shift_string(interp, iter);
-            PMC *attr_value = VTABLE_get_pmc_keyed_str(interp, args, 
attr_name);
+            STRING * const attr_name = VTABLE_shift_string(interp, iter);
+            PMC * const attr_value = VTABLE_get_pmc_keyed_str(interp, args, 
attr_name);
 
             /* Set the attribute. */
             VTABLE_set_attr_str(interp, obj, attr_name, attr_value);
@@ -997,14 +997,14 @@
          * optimize this away, using a flag or something. */
         mro_length = VTABLE_elements(interp, _class->all_parents);
         for (i = 0; i < mro_length; i++) {
-            PMC *class_check = VTABLE_get_pmc_keyed_int(interp, 
+            PMC * const class_check = VTABLE_get_pmc_keyed_int(interp,
                 _class->all_parents, i);
             if (!VTABLE_isa(interp, class_check, CONST_STRING(interp, 
"Class"))) {
                 /* From another universe. Create instance... */
                 PMC *parent_ins;
                 int position;
                 (PMC *parent_ins) = PCCINVOKE(interp, class_check, "new");
-                
+
                 /* ...and tack on end of the attribute store (after all the
                  * slots for attributes). */
                 position = VTABLE_elements(interp, obj_guts->attrib_store);

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c   (original)
+++ trunk/src/utils.c   Fri Jun  8 09:03:34 2007
@@ -466,7 +466,8 @@
 
 PARROT_API
 void *
-Parrot_make_cpa(Interp *interp, PMC *array) {
+Parrot_make_cpa(Interp *interp, PMC *array)
+{
     const INTVAL arraylen = VTABLE_elements(interp, array);
     INTVAL cur;
 
@@ -501,7 +502,8 @@
 
 PARROT_API
 void
-Parrot_destroy_cpa(char **array /*NN*/) {
+Parrot_destroy_cpa(char **array /*NN*/)
+{
     UINTVAL offset = 0;
     /* Free each piece */
     while (array[offset] != NULL) {
@@ -620,8 +622,10 @@
   c           ... the graph and all the needed params : the context
 
 */
+
 static void
-rec_climb_back_and_mark(int node_index, parrot_prm_context* c) {
+rec_climb_back_and_mark(int node_index, parrot_prm_context* c /*NN*/)
+{
     const int node = c->dest_regs[node_index];
     const int pred = c->src_regs[node_index];
     const int pred_index = c->reg_to_index[pred];
@@ -658,8 +662,9 @@
 
 */
 
-void
-process_cycle_without_exit(int node_index, parrot_prm_context* c) {
+static void
+process_cycle_without_exit(int node_index, parrot_prm_context* c /*NN*/)
+{
     const int pred = c->src_regs[node_index];
 
     /* let's try the alternate move function*/
@@ -681,8 +686,9 @@
  should be self-speaking
  */
 
-void
-move_reg(int from, int dest, parrot_prm_context* c) {
+static void
+move_reg(int from, int dest, parrot_prm_context* c /*NN*/)
+{
    /* fprintf(stderr,"move %i ==> %i\n",from,dest);*/
     c->mov(c->interp, dest, from, c->info);
 }

Reply via email to