develooper Front page | perl.cvs.parrot | Postings from December 2008

[svn:parrot] r33595 - in trunk: compilers/imcc include/parrot src

From:
chromatic
Date:
December 7, 2008 00:05
Subject:
[svn:parrot] r33595 - in trunk: compilers/imcc include/parrot src
Message ID:
20081207080510.1998CCB9AF@x12.develooper.com
Author: chromatic
Date: Sun Dec  7 00:05:09 2008
New Revision: 33595

Modified:
   trunk/compilers/imcc/pbc.c
   trunk/include/parrot/hash.h
   trunk/include/parrot/multidispatch.h
   trunk/include/parrot/sub.h
   trunk/src/multidispatch.c
   trunk/src/string_primitives.c
   trunk/src/sub.c

Log:
[src] Added more parameter decorations identified by make headerizer.

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	(original)
+++ trunk/compilers/imcc/pbc.c	Sun Dec  7 00:05:09 2008
@@ -85,8 +85,9 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-static int add_const_table_pmc(PARROT_INTERP, PMC *pmc)
-        __attribute__nonnull__(1);
+static int add_const_table_pmc(PARROT_INTERP, ARGIN(PMC *pmc))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 static opcode_t build_key(PARROT_INTERP, ARGIN(SymReg *key_reg))
         __attribute__nonnull__(1)
@@ -285,7 +286,7 @@
 */
 
 static int
-add_const_table_pmc(PARROT_INTERP, PMC *pmc)
+add_const_table_pmc(PARROT_INTERP, ARGIN(PMC *pmc))
 {
     int newitem = add_const_table(interp);
 

Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h	(original)
+++ trunk/include/parrot/hash.h	Sun Dec  7 00:05:09 2008
@@ -216,7 +216,8 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(*hash);
 
-void parrot_chash_destroy_values(PARROT_INTERP, ARGMOD(Hash *hash),
+void parrot_chash_destroy_values(PARROT_INTERP,
+    ARGMOD(Hash *hash),
     ARGIN(value_free func))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2)

Modified: trunk/include/parrot/multidispatch.h
==============================================================================
--- trunk/include/parrot/multidispatch.h	(original)
+++ trunk/include/parrot/multidispatch.h	Sun Dec  7 00:05:09 2008
@@ -121,46 +121,71 @@
         __attribute__nonnull__(2);
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 MMD_Cache * Parrot_mmd_cache_create(PARROT_INTERP)
         __attribute__nonnull__(1);
 
 PARROT_EXPORT
-void Parrot_mmd_cache_destroy(PARROT_INTERP, MMD_Cache *cache)
-        __attribute__nonnull__(1);
+void Parrot_mmd_cache_destroy(PARROT_INTERP, ARGMOD(MMD_Cache *cache))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 PMC * Parrot_mmd_cache_lookup_by_types(PARROT_INTERP,
-    MMD_Cache *cache,
-    const char *name,
-    PMC *types)
-        __attribute__nonnull__(1);
+    ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name),
+    ARGIN(PMC *types))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 PMC * Parrot_mmd_cache_lookup_by_values(PARROT_INTERP,
-    MMD_Cache *cache,
-    const char *name,
-    PMC *values)
-        __attribute__nonnull__(1);
+    ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name),
+    ARGIN(PMC *values))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
-void Parrot_mmd_cache_mark(PARROT_INTERP, MMD_Cache *cache)
-        __attribute__nonnull__(1);
+void Parrot_mmd_cache_mark(PARROT_INTERP, ARGMOD(MMD_Cache *cache))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
 void Parrot_mmd_cache_store_by_types(PARROT_INTERP,
-    MMD_Cache *cache,
-    const char *name,
-    PMC *types,
-    PMC *chosen)
-        __attribute__nonnull__(1);
+    ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name),
+    ARGIN(PMC *types),
+    ARGIN(PMC *chosen))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        __attribute__nonnull__(5)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
 void Parrot_mmd_cache_store_by_values(PARROT_INTERP,
-    MMD_Cache *cache,
-    const char *name,
-    PMC *values,
-    PMC *chosen)
-        __attribute__nonnull__(1);
+    ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name),
+    ARGIN(PMC *values),
+    ARGIN(PMC *chosen))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4)
+        __attribute__nonnull__(5)
+        FUNC_MODIFIES(*cache);
 
 PARROT_EXPORT
 void Parrot_mmd_destroy(PARROT_INTERP)

Modified: trunk/include/parrot/sub.h
==============================================================================
--- trunk/include/parrot/sub.h	(original)
+++ trunk/include/parrot/sub.h	Sun Dec  7 00:05:09 2008
@@ -287,7 +287,7 @@
         __attribute__nonnull__(2)
         FUNC_MODIFIES(* ctx);
 
-void  mark_context_start(void);
+void mark_context_start(void);
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 Parrot_sub * new_closure(PARROT_INTERP)

Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c	(original)
+++ trunk/src/multidispatch.c	Sun Dec  7 00:05:09 2008
@@ -85,15 +85,21 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
+PARROT_CANNOT_RETURN_NULL
 static STRING * mmd_cache_key_from_types(PARROT_INTERP,
-    const char *name,
-    PMC *types)
-        __attribute__nonnull__(1);
+    ARGIN(const char *name),
+    ARGIN(PMC *types))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
+PARROT_CANNOT_RETURN_NULL
 static STRING * mmd_cache_key_from_values(PARROT_INTERP,
-    const char *name,
-    PMC *values)
-        __attribute__nonnull__(1);
+    ARGIN(const char *name),
+    ARGIN(PMC *values))
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3);
 
 PARROT_CANNOT_RETURN_NULL
 PARROT_WARN_UNUSED_RESULT
@@ -147,6 +153,7 @@
     ARGIN_NULLOK(const PMC *pmc))
         __attribute__nonnull__(1);
 
+PARROT_CANNOT_RETURN_NULL
 static PMC * Parrot_mmd_get_cached_multi_sig(PARROT_INTERP, ARGIN(PMC *sub))
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
@@ -183,6 +190,7 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
+PARROT_CANNOT_RETURN_NULL
 static PMC * Parrot_mmd_sort_candidates(PARROT_INTERP,
     ARGIN(PMC *arg_tuple),
     ARGIN(PMC *cl))
@@ -1397,6 +1405,7 @@
     return ar;
 }
 
+PARROT_CANNOT_RETURN_NULL
 static PMC *
 Parrot_mmd_get_cached_multi_sig(PARROT_INTERP, ARGIN(PMC *sub))
 {
@@ -1566,6 +1575,7 @@
 
 */
 
+PARROT_CANNOT_RETURN_NULL
 static PMC *
 Parrot_mmd_sort_candidates(PARROT_INTERP, ARGIN(PMC *arg_tuple), ARGIN(PMC *cl))
 {
@@ -1919,6 +1929,7 @@
 */
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 MMD_Cache *
 Parrot_mmd_cache_create(PARROT_INTERP) {
     /* String hash. */
@@ -1938,8 +1949,10 @@
 
 */
 
+PARROT_CANNOT_RETURN_NULL
 static STRING *
-mmd_cache_key_from_values(PARROT_INTERP, const char *name, PMC *values)
+mmd_cache_key_from_values(PARROT_INTERP, ARGIN(const char *name),
+    ARGIN(PMC *values))
 {
     /* Build array of type IDs, which we'll then use as a string to key into
      * the hash. */
@@ -1981,8 +1994,10 @@
 */
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 PMC *
-Parrot_mmd_cache_lookup_by_values(PARROT_INTERP, MMD_Cache *cache, const char *name, PMC *values)
+Parrot_mmd_cache_lookup_by_values(PARROT_INTERP, ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name), ARGIN(PMC *values))
 {
     STRING *key = mmd_cache_key_from_values(interp, name, values);
 
@@ -2006,8 +2021,8 @@
 
 PARROT_EXPORT
 void
-Parrot_mmd_cache_store_by_values(PARROT_INTERP,
-    MMD_Cache *cache, const char *name, PMC *values, PMC *chosen)
+Parrot_mmd_cache_store_by_values(PARROT_INTERP, ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name), ARGIN(PMC *values), ARGIN(PMC *chosen))
 {
     STRING *key = mmd_cache_key_from_values(interp, name, values);
 
@@ -2018,16 +2033,18 @@
 
 /*
 
-=item C<static STRING * mmd_cache_key_from_values>
+=item C<static STRING * mmd_cache_key_from_types>
 
-Generates an MMD cache key from an array of values.
+Generates an MMD cache key from an array of types.
 
 =cut
 
 */
 
+PARROT_CANNOT_RETURN_NULL
 static STRING *
-mmd_cache_key_from_types(PARROT_INTERP, const char *name, PMC *types)
+mmd_cache_key_from_types(PARROT_INTERP, ARGIN(const char *name),
+    ARGIN(PMC *types))
 {
     /* Build array of type IDs, which we'll then use as a string to key into
      * the hash. */
@@ -2070,9 +2087,10 @@
 */
 
 PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
 PMC *
-Parrot_mmd_cache_lookup_by_types(PARROT_INTERP, MMD_Cache *cache,
-    const char *name, PMC *types)
+Parrot_mmd_cache_lookup_by_types(PARROT_INTERP, ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name), ARGIN(PMC *types))
 {
     STRING *key = mmd_cache_key_from_types(interp, name, types);
 
@@ -2097,11 +2115,12 @@
 
 PARROT_EXPORT
 void
-Parrot_mmd_cache_store_by_types(PARROT_INTERP,
-    MMD_Cache *cache, const char *name, PMC *types, PMC *chosen)
+Parrot_mmd_cache_store_by_types(PARROT_INTERP, ARGMOD(MMD_Cache *cache),
+    ARGIN(const char *name), ARGIN(PMC *types), ARGIN(PMC *chosen))
 {
     STRING *key = mmd_cache_key_from_types(interp, name, types);
-    if (key != NULL)
+
+    if (key)
         parrot_hash_put(interp, cache, key, chosen);
 }
 
@@ -2118,11 +2137,12 @@
 
 PARROT_EXPORT
 void
-Parrot_mmd_cache_mark(PARROT_INTERP, MMD_Cache *cache)
+Parrot_mmd_cache_mark(PARROT_INTERP, ARGMOD(MMD_Cache *cache))
 {
-    /* As a small future optimization, note that we only *really* need to mark keys -
-     * the candidates will be referenced outside the cache, provided it's invalidated
-     * properly. */
+
+    /* As a small future optimization, note that we only *really* need to mark
+    * keys - the candidates will be referenced outside the cache, provided it's
+    * invalidated properly. */
     parrot_mark_hash(interp, cache);
 }
 
@@ -2139,7 +2159,7 @@
 
 PARROT_EXPORT
 void
-Parrot_mmd_cache_destroy(PARROT_INTERP, MMD_Cache *cache)
+Parrot_mmd_cache_destroy(PARROT_INTERP, ARGMOD(MMD_Cache *cache))
 {
     parrot_hash_destroy(interp, cache);
 }

Modified: trunk/src/string_primitives.c
==============================================================================
--- trunk/src/string_primitives.c	(original)
+++ trunk/src/string_primitives.c	Sun Dec  7 00:05:09 2008
@@ -359,8 +359,8 @@
 
 =item C<char * str_dup>
 
-Duplicate a C string.  Just like strdup(), except it dies if it runs
-out of memory.
+Duplicates a C string.  Just like strdup(), except it dies if it runs out of
+memory.
 
 =cut
 
@@ -370,13 +370,17 @@
 PARROT_MALLOC
 PARROT_CANNOT_RETURN_NULL
 char *
-str_dup_remove_quotes(ARGIN(const char * old))
+str_dup_remove_quotes(ARGIN(const char *old))
 {
     const size_t oldlen = strlen(old) + 1;
-    const size_t newlen = oldlen - 2; /* 2 for the beginning and ending quote chars */
-    char * const copy = (char *)mem_sys_allocate(newlen);
-    memcpy(copy, old+1, newlen);
+
+    /* 2 for the beginning and ending quote chars */
+    const size_t newlen = oldlen - 2;
+    char * const copy   = (char *)mem_sys_allocate(newlen);
+
+    memcpy(copy, old + 1, newlen);
     copy[newlen - 1] = 0;
+
     return copy;
 }
 

Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c	(original)
+++ trunk/src/sub.c	Sun Dec  7 00:05:09 2008
@@ -27,7 +27,7 @@
 
 /*
 
-=item C<void  mark_context_start>
+=item C<void mark_context_start>
 
 Indicate that a new round of context marking is about to take place.
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About