Author: petdance
Date: Sat Jun 16 17:48:28 2007
New Revision: 19052
Modified:
trunk/include/parrot/inter_call.h
trunk/src/inter_call.c
Log:
yanked unused arguments from static functions
Modified: trunk/include/parrot/inter_call.h
==============================================================================
--- trunk/include/parrot/inter_call.h (original)
+++ trunk/include/parrot/inter_call.h Sat Jun 16 17:48:28 2007
@@ -73,10 +73,14 @@
PARROT_API void Parrot_convert_arg( Interp *interp, call_state *st /*NN*/ )
__attribute__nonnull__(2);
-PARROT_API int Parrot_fetch_arg( Interp *interp, call_state *st /*NN*/ )
+PARROT_API int Parrot_fetch_arg( Interp *interp /*NN*/,
+ call_state *st /*NN*/ )
+ __attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_API int Parrot_fetch_arg_nci( Interp *interp, call_state *st /*NN*/ )
+PARROT_API int Parrot_fetch_arg_nci( Interp *interp /*NN*/,
+ call_state *st /*NN*/ )
+ __attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_API int Parrot_init_arg_indexes_and_sig_pmc( Interp *interp,
@@ -91,9 +95,10 @@
PARROT_API int Parrot_init_arg_nci( Interp *interp /*NN*/,
call_state *st /*NN*/,
- const char *sig )
+ const char *sig /*NN*/ )
__attribute__nonnull__(1)
- __attribute__nonnull__(2);
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
PARROT_API int Parrot_init_arg_op( Interp *interp,
parrot_context_t *ctx /*NN*/,
@@ -111,9 +116,11 @@
__attribute__nonnull__(5);
PARROT_API int Parrot_init_ret_nci( Interp *interp /*NN*/,
- call_state *st,
- const char *sig )
- __attribute__nonnull__(1);
+ call_state *st /*NN*/,
+ const char *sig /*NN*/ )
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
PARROT_API void parrot_pass_args( Interp *interp,
parrot_context_t *src_ctx,
@@ -138,7 +145,9 @@
parrot_context_t *old_ctxp,
va_list ap );
-int Parrot_store_arg( Interp *interp, call_state *st );
+int Parrot_store_arg( Interp *interp, call_state *st /*NN*/ )
+ __attribute__nonnull__(2);
+
void* set_retval( Parrot_Interp interp, int sig_ret, parrot_context_t *ctx );
FLOATVAL set_retval_f( Interp *interp /*NN*/,
int sig_ret,
Modified: trunk/src/inter_call.c
==============================================================================
--- trunk/src/inter_call.c (original)
+++ trunk/src/inter_call.c Sat Jun 16 17:48:28 2007
@@ -39,26 +39,26 @@
orig.bp_ps = save.bp_ps;
-static void next_arg_sig(Interp *interp, call_state_item *st);
-static void check_for_opt_flag(Interp *interp, call_state *st, int has_arg);
+static void next_arg_sig(call_state_item *st /*NN*/)
+ __attribute__nonnull__(1);
+static void check_for_opt_flag(call_state *st /*NN*/, int has_arg)
+ __attribute__nonnull__(1);
/*
-=item C<int Parrot_init_arg_nci(Interp *, call_state *st, const char *sig)>
+FUNCDOC: Parrot_init_arg_nci
Initialize the argument passing state C<call_state> for the given NCI
signature.
-=item C<int Parrot_init_ret_nci(Interp *, call_state *st, const char *sig)>
+FUNCDOC: Parrot_init_ret_nci
Initialize the return value passing state C<call_state> for the given NCI
signature.
-=cut
-
*/
PARROT_API
int
-Parrot_init_arg_nci(Interp *interp /*NN*/, call_state *st /*NN*/, const char
*sig)
+Parrot_init_arg_nci(Interp *interp /*NN*/, call_state *st /*NN*/, const char
*sig /*NN*/)
{
if (PMC_IS_NULL(interp->args_signature))
Parrot_init_arg_op(interp, CONTEXT(interp->ctx), interp->current_args,
&st->src);
@@ -71,10 +71,10 @@
PARROT_API
int
-Parrot_init_ret_nci(Interp *interp /*NN*/, call_state *st, const char *sig)
+Parrot_init_ret_nci(Interp *interp /*NN*/, call_state *st /*NN*/, const char
*sig /*NN*/)
{
- Parrot_Context *ctx = CONTEXT(interp->ctx);
- PMC *current_cont = ctx->current_cont;
+ Parrot_Context *ctx = CONTEXT(interp->ctx);
+ PMC * const current_cont = ctx->current_cont;
/*
* if this NCI call was a taicall, return results to caller's get_results
* this also means that we pass the caller's register base pointer
@@ -89,21 +89,18 @@
}
/*
-int
-=item C<Parrot_init_arg_indexes_and_sig_pmc(Interp *interp,
- parrot_context_t *ctx, opcode_t *indexes, PMC* sig_pmc, call_state_item
*st)>
+
+FUNCDOC: Parrot_init_arg_indexes_and_sig_pmc
Initialize argument transfer with given context registers, register indexes,
and
a signature pmc.
-=item C<int Parrot_init_arg_sig(Interp *, parrot_context_t *ctx,
- const char *sig, void *ap, call_state_item *st)>
+FUNCDOC: Parrot_init_arg_sig
Initialize argument transfer with given code segment (holding the
const_table), registers, function signature, and arguments.
-=item C<int Parrot_init_arg_op(Interp *, parrot_context_t *ctx, opcode_t *pc,
- call_state_item *st)>
+FUNCDOC: Parrot_init_arg_op
Initialize argument transfer with given context registers, and opcode
location of a get_ or set_ argument opcode.
@@ -113,8 +110,6 @@
These functions return 0, if no arguments are present, or 1 on success.
-=cut
-
*/
PARROT_API
@@ -122,6 +117,8 @@
Parrot_init_arg_indexes_and_sig_pmc(Interp *interp, parrot_context_t *ctx
/*NN*/,
opcode_t *indexes /*NN*/, PMC* sig_pmc /*NN*/, call_state_item *st
/*NN*/)
{
+ UNUSED(interp);
+
if (!sig_pmc && indexes) {
++indexes;
sig_pmc = ctx->constants[*indexes]->u.key;
@@ -143,7 +140,7 @@
st->n = SIG_ELEMS(sig_pmc);
/* initialize st->sig */
if (st->n)
- next_arg_sig(interp, st);
+ next_arg_sig(st);
}
return st->n > 0;
@@ -155,6 +152,7 @@
call_state_item *st /*NN*/)
{
PMC *sig_pmc = PMCNULL;
+
if (pc) {
++pc;
sig_pmc = ctx->constants[*pc]->u.key;
@@ -169,6 +167,8 @@
Parrot_init_arg_sig(Interp *interp, parrot_context_t *ctx, const char *sig
/*NN*/,
void *ap, call_state_item *st /*NN*/)
{
+ UNUSED(interp);
+
st->used = 1;
st->i = 0;
st->n = 0;
@@ -182,7 +182,7 @@
st->n = strlen(sig);
/* initialize st->sig */
if (st->n)
- next_arg_sig(interp, st);
+ next_arg_sig(st);
}
return st->n > 0;
}
@@ -191,7 +191,7 @@
* PMC being flattened, and fetch the first arg from the flattened set.
*/
static void
-start_flatten(Interp *interp, call_state *st, PMC *p_arg)
+start_flatten(Interp *interp /*NN*/, call_state *st /*NN*/, PMC *p_arg)
{
if (PARROT_ARG_NAME_ISSET(st->src.sig)) {
/* src ought to be an hash */
@@ -222,7 +222,7 @@
static void
-next_arg_sig(Interp *interp, call_state_item *st)
+next_arg_sig(call_state_item *st /*NN*/)
{
switch (st->mode & CALL_S_D_MASK) {
case CALL_STATE_OP:
@@ -249,7 +249,7 @@
}
static int
-fetch_arg_sig(Interp *interp, call_state *st)
+fetch_arg_sig(Interp *interp /*NN*/, call_state *st /*NN*/)
{
va_list *ap = (va_list*)(st->src.u.sig.ap);
switch (st->src.sig & PARROT_ARG_TYPE_MASK) {
@@ -294,10 +294,10 @@
static int
-fetch_arg_op(Interp *interp, call_state *st)
+fetch_arg_op(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- int constant = PARROT_ARG_CONSTANT_ISSET(st->src.sig);
- INTVAL idx = st->src.u.op.pc[st->src.i];
+ const int constant = PARROT_ARG_CONSTANT_ISSET(st->src.sig);
+ const INTVAL idx = st->src.u.op.pc[st->src.i];
switch (PARROT_ARG_TYPE_MASK_MASK(st->src.sig)) {
case PARROT_ARG_INTVAL:
@@ -341,7 +341,7 @@
PARROT_API
int
-Parrot_fetch_arg(Interp *interp, call_state *st /*NN*/)
+Parrot_fetch_arg(Interp *interp /*NN*/, call_state *st /*NN*/)
{
if (!st->src.used)
return 1;
@@ -349,7 +349,7 @@
return 0;
st->src.used = 0;
- next_arg_sig(interp, &st->src);
+ next_arg_sig(&st->src);
/* check if we're at a :flat argument */
if (st->src.mode & CALL_STATE_FLATTEN) {
@@ -385,7 +385,7 @@
if ((st->src.sig & PARROT_ARG_NAME) && !(st->src.sig &
PARROT_ARG_FLATTEN)) {
fetch_arg_op(interp, st);
st->name = UVal_str(st->val);
- next_arg_sig(interp, &st->src);
+ next_arg_sig(&st->src);
}
switch (st->src.mode & CALL_S_D_MASK) {
case CALL_STATE_OP:
@@ -401,9 +401,9 @@
PARROT_API
int
-Parrot_fetch_arg_nci(Interp *interp, call_state *st /*NN*/)
+Parrot_fetch_arg_nci(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- next_arg_sig(interp, &st->dest);
+ next_arg_sig(&st->dest);
if (st->dest.sig & PARROT_ARG_SLURPY_ARRAY) {
PMC *slurped;
assert((st->dest.sig & PARROT_ARG_TYPE_MASK) == PARROT_ARG_PMC);
@@ -425,10 +425,8 @@
}
static void
-convert_arg_from_int(Interp *interp, call_state *st)
+convert_arg_from_int(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- PMC *d;
-
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_FLOATVAL:
UVal_num(st->val) = (FLOATVAL)UVal_int(st->val);
@@ -437,18 +435,18 @@
UVal_str(st->val) = string_from_int(interp, UVal_int(st->val));
break;
case PARROT_ARG_PMC:
- d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_Integer));
+ {
+ PMC * const d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_Integer));
VTABLE_set_integer_native(interp, d, UVal_int(st->val));
UVal_pmc(st->val) = d;
+ }
break;
}
}
static void
-convert_arg_from_num(Interp *interp, call_state *st)
+convert_arg_from_num(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- PMC *d;
-
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_INTVAL:
UVal_int(st->val) = (INTVAL)UVal_num(st->val);
@@ -457,18 +455,18 @@
UVal_str(st->val) = string_from_num(interp, UVal_num(st->val));
break;
case PARROT_ARG_PMC:
- d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_Float));
+ {
+ PMC * const d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_Float));
VTABLE_set_number_native(interp, d, UVal_num(st->val));
UVal_pmc(st->val) = d;
+ }
break;
}
}
static void
-convert_arg_from_str(Interp *interp, call_state *st)
+convert_arg_from_str(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- PMC *d;
-
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_INTVAL:
UVal_int(st->val) = string_to_int(interp, UVal_str(st->val));
@@ -477,15 +475,17 @@
UVal_num(st->val) = string_to_num(interp, UVal_str(st->val));
break;
case PARROT_ARG_PMC:
- d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_String));
+ {
+ PMC * const d = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_String));
VTABLE_set_string_native(interp, d, UVal_str(st->val));
UVal_pmc(st->val) = d;
+ }
break;
}
}
static void
-convert_arg_from_pmc(Interp *interp, call_state *st)
+convert_arg_from_pmc(Interp *interp /*NN*/, call_state *st /*NN*/)
{
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_INTVAL:
@@ -501,10 +501,10 @@
}
static void
-check_for_opt_flag(Interp *interp, call_state *st, int has_arg)
+check_for_opt_flag(call_state *st /*NN*/, int has_arg)
{
INTVAL idx;
- call_state_item *dest = &st->dest;
+ call_state_item * const dest = &st->dest;
++st->optionals;
@@ -513,7 +513,7 @@
if (dest->i >= dest->n)
return;
- next_arg_sig(interp, dest);
+ next_arg_sig(dest);
/* if this isn't an :opt_flag argument, we need to reset things
* and go to the next argument */
if (!(st->dest.sig & PARROT_ARG_OPT_FLAG)) {
@@ -534,7 +534,7 @@
* to pass a key to a tailcalled function or method
*/
static void
-clone_key_arg(Interp *interp, call_state *st)
+clone_key_arg(Interp *interp /*NN*/, call_state *st /*NN*/)
{
PMC *key = UVal_pmc(st->val);
@@ -558,10 +558,9 @@
* initializes dest calling state for recption of first named arg.
*/
static void
-init_first_dest_named(Interp *interp, call_state *st)
+init_first_dest_named(Interp *interp /*NN*/, call_state *st /*NN*/)
{
- int i, n_named, idx;
- INTVAL sig;
+ int i, n_named;
if (st->dest.mode & CALL_STATE_SIG)
real_exception(interp, NULL, E_ValueError, "Can't call C function with
named arguments");
@@ -576,13 +575,15 @@
/* 1) count named args, make sure there is less than 32/64
* 2) create slurpy hash if needed */
for (i = st->dest.i; i < st->dest.n; ++i) {
- sig = SIG_ITEM(st->dest.u.op.signature, i);
+ const INTVAL sig = SIG_ITEM(st->dest.u.op.signature, i);
/* skip the arg name, only count the actual args of the named args */
if (!(sig & PARROT_ARG_NAME))
continue;
/* slurpy named args, create slurpy hash */
else if (sig & PARROT_ARG_SLURPY_ARRAY) {
+ int idx;
+
/* Create PMC for slurpy mode and register it; we must do this
* otherwise it may get collected. */
st->dest.slurp = pmc_new(interp, Parrot_get_ctx_HLL_type(interp,
enum_class_Hash));
@@ -607,7 +608,7 @@
* locate destination name, return 0 if not found
*/
static int
-locate_named_named(Interp *interp, call_state *st)
+locate_named_named(Interp *interp /*NN*/, call_state *st /*NN*/)
{
int i, n_named, idx;
STRING *param;
@@ -640,7 +641,7 @@
static void
-store_arg(call_state *st, INTVAL idx)
+store_arg(call_state *st /*NN*/, INTVAL idx)
{
switch (st->dest.sig & PARROT_ARG_TYPE_MASK) {
case PARROT_ARG_INTVAL:
@@ -660,7 +661,7 @@
static int
-store_current_arg(Interp *interp, call_state *st /*NN*/)
+store_current_arg(call_state *st /*NN*/)
{
INTVAL idx;
if (st->dest.i >= st->dest.n)
@@ -675,9 +676,11 @@
}
int
-Parrot_store_arg(Interp *interp, call_state *st)
+Parrot_store_arg(Interp *interp, call_state *st /*NN*/)
{
- return store_current_arg(interp, st);
+ UNUSED(interp);
+
+ return store_current_arg(st);
}
static void
@@ -839,7 +842,7 @@
INTVAL idx;
/* check if the next dest arg is :slurpy */
- next_arg_sig(interp, dest);
+ next_arg_sig(dest);
if (dest->sig & PARROT_ARG_SLURPY_ARRAY)
break;
@@ -858,7 +861,7 @@
if (!has_arg)
break;
dest->i++;
- next_arg_sig(interp, dest);
+ next_arg_sig(dest);
}
/* if there *is* an arg, convert it */
@@ -882,7 +885,7 @@
/* if we're at an :optional argument, we need to check for an
:opt_flag */
if (dest->sig & PARROT_ARG_OPTIONAL)
- check_for_opt_flag(interp, st, has_arg);
+ check_for_opt_flag(st, has_arg);
}
@@ -953,11 +956,11 @@
}
else {
Parrot_convert_arg(interp, st);
- store_current_arg(interp, st);
+ store_current_arg(st);
/* if we're at an :optional argument, we need to check for an
:opt_flag */
if (dest->sig & PARROT_ARG_OPTIONAL)
- check_for_opt_flag(interp, st, 1);
+ check_for_opt_flag(st, 1);
}
/* otherwise this doesn't get reset and we can't catch positional args