Author: petdance
Date: Mon Jun 11 14:58:12 2007
New Revision: 18934

Modified:
   trunk/include/parrot/mmd.h
   trunk/include/parrot/pmc.h
   trunk/src/mmd.c
   trunk/src/pmc.c

Log:
Adding more pointer constraints

Modified: trunk/include/parrot/mmd.h
==============================================================================
--- trunk/include/parrot/mmd.h  (original)
+++ trunk/include/parrot/mmd.h  Mon Jun 11 14:58:12 2007
@@ -1,5 +1,5 @@
 /* mmd.h
- *  Copyright (C) 2003, The Perl Foundation.
+ *  Copyright (C) 2003-2007, The Perl Foundation.
  *  SVN Info
  *     $Id$
  *  Overview:
@@ -46,114 +46,146 @@
 
 /* HEADERIZER BEGIN: src/mmd.c */
 
-PARROT_API funcptr_t get_mmd_dispatch_type( Interp *interp,
+PARROT_API funcptr_t get_mmd_dispatch_type( Interp *interp /*NN*/,
     INTVAL func_nr,
     INTVAL left_type,
     INTVAL right_type,
     int *is_pmc /*NN*/  )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(5)
         __attribute__warn_unused_result__;
 
-PARROT_API void mmd_add_by_class( Interp *interp,
+PARROT_API void mmd_add_by_class( Interp *interp /*NN*/,
     INTVAL functype,
-    STRING *left_class,
-    STRING *right_class,
-    funcptr_t funcptr );
+    STRING *left_class /*NN*/,
+    STRING *right_class /*NN*/,
+    funcptr_t funcptr /*NULLOK*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(3)
+        __attribute__nonnull__(4);
 
-PARROT_API void mmd_add_function( Interp *interp,
+PARROT_API void mmd_add_function( Interp *interp /*NN*/,
     INTVAL func_nr,
-    funcptr_t function );
+    funcptr_t function )
+        __attribute__nonnull__(1);
 
-PARROT_API void mmd_destroy( Parrot_Interp interp );
-PARROT_API INTVAL mmd_dispatch_i_pp( Interp *interp,
+PARROT_API void mmd_destroy( Interp *interp /*NN*/ )
+        __attribute__nonnull__(1);
+
+PARROT_API INTVAL mmd_dispatch_i_pp( Interp *interp /*NN*/,
     PMC *left /*NN*/,
     PMC *right /*NN*/,
     INTVAL func_nr )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
-PARROT_API PMC* mmd_dispatch_p_pip( Interp *interp,
-    PMC *left,
+PARROT_API PMC* mmd_dispatch_p_pip( Interp *interp /*NN*/,
+    PMC *left /*NN*/,
     INTVAL right,
     PMC *dest,
-    INTVAL func_nr );
+    INTVAL func_nr )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__;
 
-PARROT_API PMC* mmd_dispatch_p_pnp( Interp *interp,
-    PMC *left,
+PARROT_API PMC* mmd_dispatch_p_pnp( Interp *interp /*NN*/,
+    PMC *left /*NN*/,
     FLOATVAL right,
     PMC *dest,
-    INTVAL func_nr );
+    INTVAL func_nr )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__;
 
 PARROT_API PMC* mmd_dispatch_p_ppp( Interp *interp,
-    PMC *left,
-    PMC *right,
+    PMC *left /*NN*/,
+    PMC *right /*NN*/,
     PMC *dest,
-    INTVAL func_nr );
+    INTVAL func_nr )
+        __attribute__nonnull__(2)
+        __attribute__nonnull__(3)
+        __attribute__warn_unused_result__;
 
-PARROT_API PMC* mmd_dispatch_p_psp( Interp *interp,
-    PMC *left,
+PARROT_API PMC* mmd_dispatch_p_psp( Interp *interp /*NN*/,
+    PMC *left /*NN*/,
     STRING *right,
     PMC *dest,
-    INTVAL func_nr );
-
-PARROT_API void mmd_dispatch_v_pi( Interp *interp,
-    PMC *left,
-    INTVAL right,
-    INTVAL func_nr );
+    INTVAL func_nr )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
+        __attribute__warn_unused_result__;
 
-PARROT_API void mmd_dispatch_v_pn( Interp *interp,
+PARROT_API void mmd_dispatch_v_pn( Interp *interp /*NN*/,
     PMC *left /*NN*/,
     FLOATVAL right,
     INTVAL func_nr )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_API void mmd_dispatch_v_pp( Interp *interp,
+PARROT_API void mmd_dispatch_v_pp( Interp *interp /*NN*/,
     PMC *left /*NN*/,
     PMC *right /*NN*/,
     INTVAL func_nr )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2)
         __attribute__nonnull__(3);
 
-PARROT_API void mmd_dispatch_v_ps( Interp *interp,
+PARROT_API void mmd_dispatch_v_ps( Interp *interp /*NN*/,
     PMC *left /*NN*/,
     STRING *right,
     INTVAL func_nr )
+        __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_API void mmd_register( Interp *interp,
+PARROT_API void mmd_register( Interp *interp /*NN*/,
     INTVAL func_nr,
     INTVAL left_type,
     INTVAL right_type,
-    funcptr_t funcptr );
+    funcptr_t funcptr /*NULLOK*/ )
+        __attribute__nonnull__(1);
 
-PARROT_API void mmd_register_sub( Interp *interp,
+PARROT_API void mmd_register_sub( Interp *interp /*NN*/,
     INTVAL func_nr,
     INTVAL left_type,
     INTVAL right_type,
-    PMC *sub );
+    PMC *sub /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(5);
 
-PARROT_API PMC * mmd_vtfind(
-    Parrot_Interp interp,
+PARROT_API PMC * mmd_vtfind( Interp *interp /*NN*/,
     INTVAL func_nr,
     INTVAL left,
-    INTVAL right );
+    INTVAL right )
+        __attribute__nonnull__(1)
+        __attribute__warn_unused_result__;
 
-PARROT_API void Parrot_mmd_rebuild_table( Interp* interp,
+PARROT_API void Parrot_mmd_rebuild_table( Interp* interp /*NN*/,
     INTVAL type,
-    INTVAL func_nr );
+    INTVAL func_nr )
+        __attribute__nonnull__(1);
 
 PARROT_API void Parrot_mmd_register_table( Interp* interp,
     INTVAL type,
     const MMD_init *mmd_table,
     INTVAL n );
 
-PARROT_API PMC * Parrot_MMD_search_default_infix( Interp *interp,
+PARROT_API PMC * Parrot_MMD_search_default_infix( Interp *interp /*NN*/,
     STRING *meth,
     INTVAL left_type,
-    INTVAL right_type );
+    INTVAL right_type )
+        __attribute__nonnull__(1);
+
+PARROT_API PMC * Parrot_mmd_sort_candidate_list( Interp *interp /*NN*/,
+    PMC *candidates )
+        __attribute__nonnull__(1);
 
-PARROT_API PMC * Parrot_mmd_sort_candidate_list( Interp *interp,
-    PMC *candidates );
+void mmd_dispatch_v_pi( Interp *interp /*NN*/,
+    PMC *left /*NN*/,
+    INTVAL right,
+    INTVAL func_nr )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 /* HEADERIZER END: src/mmd.c */
 

Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h  (original)
+++ trunk/include/parrot/pmc.h  Mon Jun 11 14:58:12 2007
@@ -54,13 +54,15 @@
         __attribute__nonnull__(1)
         __attribute__nonnull__(2);
 
-PARROT_API INTVAL pmc_type( Interp* interp /*NN*/, STRING *name )
+PARROT_API INTVAL pmc_type( Interp* interp /*NN*/, STRING *name /*NN*/ )
         __attribute__nonnull__(1)
+        __attribute__nonnull__(2)
         __attribute__pure__
         __attribute__warn_unused_result__;
 
-PARROT_API INTVAL pmc_type_p( Interp* interp /*NN*/, PMC *name )
-        __attribute__nonnull__(1);
+PARROT_API INTVAL pmc_type_p( Interp* interp /*NN*/, PMC *name /*NN*/ )
+        __attribute__nonnull__(1)
+        __attribute__nonnull__(2);
 
 void dod_unregister_pmc( Interp* interp /*NN*/, PMC* pmc )
         __attribute__nonnull__(1);

Modified: trunk/src/mmd.c
==============================================================================
--- trunk/src/mmd.c     (original)
+++ trunk/src/mmd.c     Mon Jun 11 14:58:12 2007
@@ -34,10 +34,6 @@
 
 =head2 Functions
 
-=over 4
-
-=cut
-
 */
 
 #include "parrot/compiler.h"
@@ -56,7 +52,7 @@
 
 #ifndef NDEBUG
 static void
-dump_mmd(Interp *interp, INTVAL function)
+dump_mmd(Interp *interp /*NN*/, INTVAL function)
 {
     UINTVAL x, y;
     UINTVAL offset, x_funcs, y_funcs;
@@ -98,7 +94,7 @@
 
 PARROT_API
 funcptr_t
-get_mmd_dispatch_type(Interp *interp, INTVAL func_nr, INTVAL left_type,
+get_mmd_dispatch_type(Interp *interp /*NN*/, INTVAL func_nr, INTVAL left_type,
         INTVAL right_type, int *is_pmc /*NN*/ )
     /* WARN_UNUSED */
 {
@@ -127,9 +123,9 @@
             func = table->mmd_funcs[offset];
     }
     if (!func) {
-        const char *meth_c = Parrot_MMD_method_name(interp, func_nr);
+        const char * const meth_c = Parrot_MMD_method_name(interp, func_nr);
         STRING * const meth_s = const_string(interp, meth_c);
-        PMC *method = Parrot_MMD_search_default_infix(interp,
+        PMC * const method = Parrot_MMD_search_default_infix(interp,
                 meth_s, left_type, r);
         if (!method)
             real_exception(interp, 0, 1, "MMD function %s not found "
@@ -164,11 +160,7 @@
 
 
 static funcptr_t
-get_mmd_dispatcher(Interp *interp, PMC *left, PMC *right,
-        INTVAL function, int *is_pmc /*NN*/)
-        __attribute__nonnull__(5);
-static funcptr_t
-get_mmd_dispatcher(Interp *interp, PMC *left, PMC *right,
+get_mmd_dispatcher(Interp *interp /*NN*/, PMC *left, PMC *right,
         INTVAL function, int *is_pmc /*NN*/)
 {
     const UINTVAL left_type = VTABLE_type(interp, left);
@@ -187,9 +179,6 @@
 
 static PMC *
 mmd_deref(Interp *interp, INTVAL function, PMC *value /*NN*/)
-        __attribute__nonnull__(3);
-static PMC *
-mmd_deref(Interp *interp, INTVAL function, PMC *value /*NN*/)
 {
     if (VTABLE_type(interp, value) != value->vtable->base_type)
         return VTABLE_get_pmc(interp, value);
@@ -205,7 +194,8 @@
 */
 
 static void
-mmd_ensure_writable(Interp *interp, INTVAL function, PMC *pmc /*NULLOK*/) {
+mmd_ensure_writable(Interp *interp, INTVAL function, PMC *pmc /*NULLOK*/)
+{
     if (!PMC_IS_NULL(pmc) && (pmc->vtable->flags & VTABLE_IS_READONLY_FLAG))
         real_exception(interp, 0, 1, "%s applied to read-only argument",
             Parrot_MMD_method_name(interp, function));
@@ -214,9 +204,7 @@
 
 /*
 
-=item C<PMC*
-mmd_dispatch_p_ppp(Interp *,
-        PMC *left, PMC *right, PMC *dest, INTVAL function)>
+FUNCDOC: mmd_dispatch_p_ppp
 
 Dispatch to a multimethod that returns a PMC. C<left>, C<right>, and
 C<dest> are all PMC pointers, while C<func_num> is the MMD table that
@@ -228,37 +216,25 @@
 the types of C<left> and C<right> and call it, passing in C<left>,
 C<right>, and possibly C<dest> like any other binary vtable function.
 
-=item C<PMC*
-mmd_dispatch_p_pip(Interp *,
-        PMC *left, INTVAL right, PMC *dest, INTVAL function)>
+FUNCDOC: mmd_dispatch_p_pip
 
 Like above, right argument is a native INTVAL.
 
-=item C<PMC*
-mmd_dispatch_p_pnp(Interp *,
-        PMC *left, FLOATVAL right, PMC *dest, INTVAL function)>
+FUNCDOC: mmd_dispatch_p_pnp
 
 Like above, right argument is a native FLOATVAL.
 
-=item C<PMC*
-mmd_dispatch_p_psp(Interp *,
-        PMC *left, STRING *right, PMC *dest, INTVAL function)>
+FUNCDOC: mmd_dispatch_p_psp
 
 Like above, right argument is a native STRING *.
 
-=cut
-
-=item C<void
-mmd_dispatch_v_pp(Interp *, PMC *left, PMC *right, INTVAL function)>
+FUNCDOC: mmd_dispatch_v_pp
 
-=item C<void
-mmd_dispatch_v_pi(Interp *, PMC *left, INTVAL right, INTVAL function)>
+FUNCDOC: mmd_dispatch_v_pi
 
-=item C<void
-mmd_dispatch_v_pn(Interp *, PMC *left, FLOATVAL right, INTVAL function)>
+FUNCDOC: mmd_dispatch_v_pn
 
-=item C<void
-mmd_dispatch_v_ps(Interp *, PMC *left, STRING *right, INTVAL function)>
+FUNCDOC: mmd_dispatch_v_ps
 
 Inplace dispatch functions for C<< left <op=> right >>.
 
@@ -267,7 +243,8 @@
 PARROT_API
 PMC*
 mmd_dispatch_p_ppp(Interp *interp,
-        PMC *left, PMC *right, PMC *dest, INTVAL func_nr)
+        PMC *left /*NN*/, PMC *right /*NN*/, PMC *dest, INTVAL func_nr)
+    /* WARN_UNUSED */
 {
     mmd_f_p_ppp real_function;
     int is_pmc;
@@ -294,8 +271,9 @@
 
 PARROT_API
 PMC*
-mmd_dispatch_p_pip(Interp *interp,
-        PMC *left, INTVAL right, PMC *dest, INTVAL func_nr)
+mmd_dispatch_p_pip(Interp *interp /*NN*/,
+        PMC *left /*NN*/, INTVAL right, PMC *dest, INTVAL func_nr)
+    /* WARN_UNUSED */
 {
     int is_pmc;
 
@@ -327,8 +305,9 @@
 
 PARROT_API
 PMC*
-mmd_dispatch_p_pnp(Interp *interp,
-        PMC *left, FLOATVAL right, PMC *dest, INTVAL func_nr)
+mmd_dispatch_p_pnp(Interp *interp /*NN*/,
+        PMC *left /*NN*/, FLOATVAL right, PMC *dest, INTVAL func_nr)
+    /* WARN_UNUSED */
 {
     mmd_f_p_pnp real_function;
     int is_pmc;
@@ -355,8 +334,9 @@
 
 PARROT_API
 PMC*
-mmd_dispatch_p_psp(Interp *interp,
-        PMC *left, STRING *right, PMC *dest, INTVAL func_nr)
+mmd_dispatch_p_psp(Interp *interp /*NN*/,
+        PMC *left /*NN*/, STRING *right, PMC *dest, INTVAL func_nr)
+    /* WARN_UNUSED */
 {
     mmd_f_p_psp real_function;
     int is_pmc;
@@ -383,7 +363,7 @@
  */
 PARROT_API
 void
-mmd_dispatch_v_pp(Interp *interp,
+mmd_dispatch_v_pp(Interp *interp /*NN*/,
         PMC *left /*NN*/, PMC *right /*NN*/, INTVAL func_nr)
 {
     mmd_f_v_pp real_function;
@@ -406,10 +386,9 @@
     }
 }
 
-PARROT_API
 void
-mmd_dispatch_v_pi(Interp *interp,
-        PMC *left, INTVAL right, INTVAL func_nr)
+mmd_dispatch_v_pi(Interp *interp /*NN*/,
+        PMC *left /*NN*/, INTVAL right, INTVAL func_nr)
 {
     mmd_f_v_pi real_function;
     int is_pmc;
@@ -432,7 +411,7 @@
 
 PARROT_API
 void
-mmd_dispatch_v_pn(Interp *interp,
+mmd_dispatch_v_pn(Interp *interp /*NN*/,
         PMC *left /*NN*/, FLOATVAL right, INTVAL func_nr)
 {
     mmd_f_v_pn real_function;
@@ -456,7 +435,7 @@
 
 PARROT_API
 void
-mmd_dispatch_v_ps(Interp *interp,
+mmd_dispatch_v_ps(Interp *interp /*NN*/,
         PMC *left /*NN*/, STRING *right, INTVAL func_nr)
 {
     mmd_f_v_ps real_function;
@@ -488,7 +467,7 @@
 
 PARROT_API
 INTVAL
-mmd_dispatch_i_pp(Interp *interp,
+mmd_dispatch_i_pp(Interp *interp /*NN*/,
         PMC *left /*NN*/, PMC *right /*NN*/, INTVAL func_nr)
 {
     mmd_f_i_pp real_function;
@@ -524,11 +503,12 @@
 
 PARROT_API
 void
-mmd_add_function(Interp *interp,
+mmd_add_function(Interp *interp /*NN*/,
         INTVAL func_nr, funcptr_t function)
 {
     if (func_nr >= (INTVAL)interp->n_binop_mmd_funcs) {
         INTVAL i;
+
         if (interp->binop_mmd_funcs) {
             interp->binop_mmd_funcs =
                 (MMD_table *)mem_sys_realloc(interp->binop_mmd_funcs,
@@ -558,13 +538,13 @@
 */
 
 static void
-mmd_expand_x(Interp *interp, INTVAL func_nr, INTVAL new_x)
+mmd_expand_x(Interp *interp /*NN*/, INTVAL func_nr, INTVAL new_x)
 {
     funcptr_t *new_table;
     UINTVAL x;
     UINTVAL y;
     UINTVAL i;
-    MMD_table *table = interp->binop_mmd_funcs + func_nr;
+    MMD_table * const table = interp->binop_mmd_funcs + func_nr;
     char *src_ptr, *dest_ptr;
     size_t old_dp, new_dp;
 
@@ -613,7 +593,7 @@
 */
 
 static void
-mmd_expand_y(Interp *interp, INTVAL func_nr, INTVAL new_y)
+mmd_expand_y(Interp *interp /*NN*/, INTVAL func_nr, INTVAL new_y)
 {
     UINTVAL           new_size, old_size;
     MMD_table * const table = interp->binop_mmd_funcs + func_nr;
@@ -659,10 +639,10 @@
 
 PARROT_API
 void
-mmd_add_by_class(Interp *interp,
+mmd_add_by_class(Interp *interp /*NN*/,
              INTVAL functype,
-             STRING *left_class, STRING *right_class,
-             funcptr_t funcptr)
+             STRING *left_class /*NN*/, STRING *right_class /*NN*/,
+             funcptr_t funcptr /*NULLOK*/)
 {
     INTVAL left_type = pmc_type(interp, left_class);
     INTVAL right_type = pmc_type(interp, right_class);
@@ -705,10 +685,10 @@
 
 PARROT_API
 void
-mmd_register(Interp *interp,
+mmd_register(Interp *interp /*NN*/,
              INTVAL func_nr,
              INTVAL left_type, INTVAL right_type,
-             funcptr_t funcptr)
+             funcptr_t funcptr /*NULLOK*/)
 {
 
     INTVAL offset;
@@ -737,10 +717,10 @@
 
 PARROT_API
 void
-mmd_register_sub(Interp *interp,
+mmd_register_sub(Interp *interp /*NN*/,
              INTVAL func_nr,
              INTVAL left_type, INTVAL right_type,
-             PMC *sub)
+             PMC *sub /*NN*/)
 {
     if (sub->vtable->base_type == enum_class_NCI) {
         /* returned from mmdvt_find */
@@ -762,7 +742,7 @@
 
 PARROT_API
 void
-mmd_destroy(Parrot_Interp interp)
+mmd_destroy(Interp *interp /*NN*/)
 {
     if (interp->n_binop_mmd_funcs) {
         UINTVAL i;
@@ -788,8 +768,8 @@
 
 PARROT_API
 PMC *
-mmd_vtfind(Parrot_Interp interp, INTVAL func_nr,
-           INTVAL left, INTVAL right)
+mmd_vtfind(Interp *interp /*NN*/, INTVAL func_nr, INTVAL left, INTVAL right)
+    /* WARN_UNUSED */
 {
     int is_pmc;
     PMC *f;
@@ -807,7 +787,6 @@
 }
 
 
-static PMC* mmd_arg_tuple_inline(Interp *, STRING *signature, va_list args);
 static PMC* mmd_arg_tuple_func(Interp *);
 static PMC* mmd_search_default(Interp *, STRING *meth, PMC *arg_tuple);
 static PMC* mmd_search_scopes(Interp *, STRING *meth, PMC *arg_tuple);
@@ -820,7 +799,7 @@
 
 PARROT_API
 PMC *
-Parrot_MMD_search_default_infix(Interp *interp, STRING *meth,
+Parrot_MMD_search_default_infix(Interp *interp /*NN*/, STRING *meth,
         INTVAL left_type, INTVAL right_type)
 {
     PMC* const arg_tuple = pmc_new(interp, enum_class_FixedIntegerArray);
@@ -833,18 +812,16 @@
 
 /*
 
-=item C<PMC *Parrot_mmd_sort_candidate_list(Interp *interp, PMC *candidates)>
+FUNCDOC: Parrot_mmd_sort_candidate_list
 
 Given an array PMC (usually a MultiSub) sort the mmd candidates by their
 manhatten distance to the current args.
 
-=cut
-
 */
 
 PARROT_API
 PMC *
-Parrot_mmd_sort_candidate_list(Interp *interp, PMC *candidates)
+Parrot_mmd_sort_candidate_list(Interp *interp /*NN*/, PMC *candidates)
 {
     PMC *arg_tuple;
     INTVAL n;
@@ -868,24 +845,20 @@
 
 /*
 
-=item C<
-static PMC* mmd_arg_tuple_inline(Interp *, STRING *signature, va_list args)>
+FUNCDOC: mmd_arg_tuple_inline
 
 Return a list of argument types. PMC arguments are specified as function
 arguments.
 
-=item C<
-static PMC* mmd_arg_tuple_func(Interp *)>
+FUNCDOC: mmd_arg_tuple_func
 
 Return a list of argument types. PMC arguments are take from registers
 according to calling conventions.
 
-=cut
-
 */
 
 static PMC*
-mmd_arg_tuple_inline(Interp *interp, STRING *signature, va_list args)
+mmd_arg_tuple_inline(Interp *interp /*NN*/, STRING *signature /*NN*/, va_list 
args)
 {
     INTVAL i;
     PMC *arg;
@@ -929,7 +902,7 @@
 }
 
 static PMC*
-mmd_arg_tuple_func(Interp *interp)
+mmd_arg_tuple_func(Interp *interp /*NN*/)
 {
     INTVAL sig_len, i, type, idx;
     PMC* arg;
@@ -973,7 +946,7 @@
             arg = REG_PMC(idx);
             n = VTABLE_elements(interp, arg);
             for (j = 0; j < n; ++j)  {
-                PMC *elem = VTABLE_get_pmc_keyed_int(interp, arg, j);
+                PMC * const elem = VTABLE_get_pmc_keyed_int(interp, arg, j);
                 type = VTABLE_type(interp, elem);
                 VTABLE_push_integer(interp, arg_tuple, type);
             }
@@ -1010,14 +983,12 @@
 
 /*
 
-=item C<static PMC* mmd_search_default(Interp *, STRING *meth, PMC *arg_tuple)>
+FUNCDOC: mmd_search_default
 
 Default implementation of MMD search. Search scopes for candidates, walk the
 class hierarchy, sort all candidates by their Manhattan distance, and return
 result
 
-=cut
-
 */
 
 static PMC*
@@ -1067,20 +1038,16 @@
 
 /*
 
-=item C<static void mmd_search_classes(Interp *, STRING *meth,
-                                       PMC *arg_tuple, PMC *cl,
-                                       INTVAL start_at_parent)>
+FUNCDOC: mmd_search_classes
 
 Search all the classes in all MultiSubs of the candidates C<cl> and return
 a list of all candidates. C<start_at_parent> is 0 to start at the class itself
 or 1 to search from the first parent class.
 
-=cut
-
 */
 
 static void
-mmd_search_classes(Interp *interp, STRING *meth, PMC *arg_tuple,
+mmd_search_classes(Interp *interp /*NN*/, STRING *meth, PMC *arg_tuple,
         PMC *cl, INTVAL start_at_parent)
 {
     INTVAL type1;
@@ -1118,7 +1085,7 @@
 }
 
 static INTVAL
-distance_cmp(Interp *interp, INTVAL a, INTVAL b)
+distance_cmp(Interp *interp /*NULLOK*/, INTVAL a, INTVAL b)
 {
     short da = (short)a & 0xffff;
     short db = (short)b & 0xffff;
@@ -1137,26 +1104,24 @@
 
 /*
 
-=item C<static UINTVAL mmd_distance(Interp *, PMC *pmc, PMC *arg_tuple)>
+mmd_distance
 
 Create Manhattan Distance of sub C<pmc> against given argument types.
 0xffff is the maximum distance
 
-=cut
-
 */
 
 static PMC*
 mmd_cvt_to_types(Interp* interp, PMC *multi_sig)
 {
-    INTVAL i, type;
-
     const INTVAL n = VTABLE_elements(interp, multi_sig);
+    INTVAL i;
 
     PMC * const ar = pmc_new(interp, enum_class_FixedIntegerArray);
     VTABLE_set_integer_native(interp, ar, n);
     for (i = 0; i < n; ++i) {
         PMC * const sig_elem = VTABLE_get_pmc_keyed_int(interp, multi_sig, i);
+        INTVAL type;
 
         if (sig_elem->vtable->base_type == enum_class_String) {
             STRING * const sig = VTABLE_get_string(interp, sig_elem);
@@ -1177,7 +1142,7 @@
 #define MMD_BIG_DISTANCE 0x7fff
 
 static UINTVAL
-mmd_distance(Interp *interp, PMC *pmc, PMC *arg_tuple)
+mmd_distance(Interp *interp, PMC *pmc /*NN*/, PMC *arg_tuple)
 {
     PMC *multi_sig, *mro;
     INTVAL i, n, args, dist, j, m;
@@ -1275,12 +1240,10 @@
 
 /*
 
-=item C<static void mmd_sort_candidates(Interp *, PMC *arg_tuple, PMC *cl)>
+FUNCDOC: mmd_sort_candidates
 
 Sort the candidate list C<cl> by Manhattan Distance
 
-=cut
-
 */
 
 static void
@@ -1341,13 +1304,11 @@
 
 /*
 
-=item C<static PMC* mmd_search_scopes(Interp *, STRING *meth, PMC *arg_tuple)>
+FUNCDOC: mmd_search_scopes
 
 Search all scopes for MMD candidates matching the arguments given in
 C<arg_tuple>.
 
-=cut
-
 */
 
 static PMC*
@@ -1364,13 +1325,11 @@
 
 /*
 
-=item C<static int mmd_is_hidden(Interp *, PMC *multi, PMC *cl)>
+FUNCDOC: mmd_is_hidden
 
 Check if the given multi sub is hidden by any inner multi sub (already in
 the candidate list C<cl>.
 
-=cut
-
 */
 
 static int
@@ -1387,8 +1346,7 @@
 
 /*
 
-=item C<static int mmd_maybe_candidate(Interp *, PMC *pmc,
-                                       PMC *arg_tuple, PMC *cl)>
+FUNCDOC: mmd_maybe_candidate
 
 If the candidate C<pmc> is a Sub PMC, push it on the candidate list and
 return TRUE to stop further search.
@@ -1396,8 +1354,6 @@
 If the candidate is a MultiSub remember all matching Subs and return FALSE
 to continue searching outer scopes.
 
-=cut
-
 */
 
 static int
@@ -1434,14 +1390,11 @@
 
 /*
 
-=item C<static int mmd_search_cur_namespace(Interp *, STRING *meth,
-                                      PMC *arg_tuple, PMC *cl)>
+FUNCDOC: mmd_search_cur_namespace
 
 Search the current package namespace for matching candidates. Return
 TRUE if the MMD search should stop.
 
-=cut
-
 */
 
 static int
@@ -1452,20 +1405,8 @@
     return pmc && mmd_maybe_candidate(interp, pmc, arg_tuple, cl);
 }
 
-/*
-
-=item C<static void mmd_search_builtin(Interp *, STRING *meth,
-                                       PMC *arg_tuple, PMC *cl)>
-
-Search the builtin namespace for matching candidates. This is the last
-search in all the namespaces.
-
-=cut
-
-*/
-
 static PMC*
-mmd_get_ns(Interp *interp)
+mmd_get_ns(Interp *interp /*NN*/)
 {
     STRING * const ns_name = CONST_STRING(interp, "__parrot_core");
     PMC * const ns = Parrot_get_namespace_keyed_str(interp,
@@ -1474,7 +1415,7 @@
 }
 
 static PMC*
-mmd_make_ns(Interp *interp)
+mmd_make_ns(Interp *interp /*NN*/)
 {
     STRING * const ns_name = CONST_STRING(interp, "__parrot_core");
     PMC * const ns = Parrot_make_namespace_keyed_str(interp,
@@ -1482,6 +1423,15 @@
     return ns;
 }
 
+/*
+
+FUNCDOC: mmd_search_builtin
+
+Search the builtin namespace for matching candidates. This is the last
+search in all the namespaces.
+
+*/
+
 static void
 mmd_search_builtin(Interp *interp, STRING *meth, PMC *arg_tuple, PMC *cl)
 {
@@ -1595,7 +1545,7 @@
 
 static void
 mmd_create_builtin_multi_meth(Interp *interp, PMC *ns, INTVAL type,
-        const MMD_init *entry)
+        const MMD_init *entry /*NN*/)
 {
     mmd_create_builtin_multi_meth_2(interp, ns,
             entry->func_nr, type, entry->right, entry->func_ptr);
@@ -1650,19 +1600,17 @@
 
 /*
 
-=item C<void Parrot_mmd_rebuild_table(Interp*, INTVAL type, INTVAL func_nr)>
+FUNCDOC: Parrot_mmd_rebuild_table
 
 Rebuild the static MMD_table for the given class type and MMD function
 number. If C<type> is negative all classes are rebuilt. If C<func_nr> is
 negative all MMD functions are rebuilt.
 
-=cut
-
 */
 
 PARROT_API
 void
-Parrot_mmd_rebuild_table(Interp* interp, INTVAL type, INTVAL func_nr)
+Parrot_mmd_rebuild_table(Interp* interp /*NN*/, INTVAL type, INTVAL func_nr)
 {
     MMD_table *table;
     UINTVAL i;
@@ -1683,16 +1631,12 @@
 
 /*
 
-=back
-
 =head1 SEE ALSO
 
 F<include/parrot/mmd.h>,
 F<http://svn.perl.org/perl6/doc/trunk/design/apo/A12.pod>,
 F<http://svn.perl.org/perl6/doc/trunk/design/syn/S12.pod>
 
-=cut
-
 */
 
 

Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c     (original)
+++ trunk/src/pmc.c     Mon Jun 11 14:58:12 2007
@@ -365,7 +365,7 @@
 
 PARROT_API
 INTVAL
-pmc_type(Interp* interp /*NN*/, STRING *name)
+pmc_type(Interp* interp /*NN*/, STRING *name /*NN*/)
     /* PURE, WARN_UNUSED */
 {
     PMC * const classname_hash = interp->class_hash;
@@ -388,7 +388,7 @@
 
 PARROT_API
 INTVAL
-pmc_type_p(Interp* interp /*NN*/, PMC *name)
+pmc_type_p(Interp* interp /*NN*/, PMC *name /*NN*/)
 {
     PMC * const classname_hash = interp->class_hash;
     PMC * const item = (PMC *)VTABLE_get_pointer_keyed(interp, classname_hash, 
name);

Reply via email to