Skip to content
Browse files

[pmc]: reduce warnings

git-svn-id: https://svn.parrot.org/parrot/trunk@20774 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 7e08161 commit 8a0aaf9e722776fb3e95e2e40859d783d9d40ddf @particle particle committed Aug 21, 2007
View
3 src/pmc/array.pmc
@@ -120,6 +120,9 @@ Class initialization. Creates the required memory pools.
make_bufferlike_pool(INTERP, sizeof (List_chunk));
Small_Object_Pool *Lists =
make_bufferlike_pool(INTERP, sizeof (List));
+ /* XXX until there's a function to allocate a pool in an arena */
+ UNUSED(List_chunks);
+ UNUSED(Lists);
}
/*
View
48 src/pmc/class.pmc
@@ -364,8 +364,10 @@ find_vtable_override(PARROT_INTERP, PMC *parrot_class, STRING *name)
/* Walk and search for the vtable method. */
const int num_classes = VTABLE_elements(interp, _class->all_parents);
const int all_in_universe = !PObj_HasAlienParents_TEST(parrot_class);
+ /* xxx this isn't used yet
const int alien_parents_pos = VTABLE_elements(interp,
_class->attrib_metadata);
+ */
int i;
@@ -641,7 +643,7 @@ Returns an error if an attribute of C<name> already exists.
"Modifications to already instantiated classes not allowed yet.");
}
- /* If we've already got an attribute of this name, it's an error. */
+ /* If we already have an attribute of this name, it's an error. */
if (VTABLE_exists_keyed_str(interp, _class->attrib_metadata, name))
real_exception(interp, NULL, INVALID_OPERATION,
"Attribute '%s' already exists.",
@@ -1177,18 +1179,18 @@ Returns whether the class is or inherits from C<*classname>.
/*
-=item C<void name(STRING *name :optional, int got_name :opt_flag)>
+=item C<void name(STRING *name :optional, int has_name :opt_flag)>
Sets the name of the class, and updates the namespace accoringly.
=cut
*/
- PCCMETHOD name(STRING *name :optional, int got_name :opt_flag) {
+ PCCMETHOD name(STRING *name :optional, int has_name :opt_flag) {
Parrot_Class *_class = PARROT_CLASS(SELF);
STRING *ret_name = NULL;
- if (got_name) {
+ if (has_name) {
/* We'll build a hash just containing the name, then give this to
* init_class_from_hash - saves some code duplication. */
PMC *naming_hash = pmc_new(interp, enum_class_Hash);
@@ -1210,9 +1212,11 @@ Gets the namespace that this class is attached to.
=cut
*/
- PCCMETHOD pmc_namespace(PMC *_namespace :optional, int got_name :opt_flag) {
+ PCCMETHOD pmc_namespace(PMC *_namespace :optional, int has_name :opt_flag) {
Parrot_Class *_class = PARROT_CLASS(SELF);
PMC *ret_namespace = _class->_namespace;
+ UNUSED(_namespace);
+ UNUSED(has_name);
PCCRETURN(PMC *ret_namespace);
}
@@ -1227,12 +1231,12 @@ methods from roles. When called with no parameter, returns the list.
*/
PCCMETHOD resolve_method(PMC *resolve_list :optional,
- int got_list :opt_flag) {
+ int has_list :opt_flag) {
Parrot_Class *_class = PARROT_CLASS(SELF);
PMC *ret_list = NULL;
/* Store list. */
- if (got_list)
+ if (has_list)
_class->resolve_method = resolve_list;
ret_list = _class->resolve_method;
@@ -1281,8 +1285,8 @@ Add an attribute to the class. Requires a name and, optionally, a type.
*/
PCCMETHOD add_attribute(STRING *attribute_name,
- PMC *attribute_type :optional, int got_type :opt_flag) {
- PMC *type = got_type ? attribute_type : PMCNULL;
+ PMC *attribute_type :optional, int has_type :opt_flag) {
+ PMC *type = has_type ? attribute_type : PMCNULL;
DYNSELF.add_attribute(attribute_name, type);
}
@@ -1313,19 +1317,17 @@ C<add_method> vtable method.
*/
PCCMETHOD add_method(STRING *name, PMC *sub,
int vtable :optional :named["vtable"],
- int got_vtable :opt_flag,
+ int has_vtable :opt_flag,
int anon :optional :named["anon"],
- int got_anon :opt_flag)
+ int has_anon :opt_flag)
{
- Parrot_Class *_class = PARROT_CLASS(SELF);
-
/* If it's a vtable method... */
- if (got_vtable) {
+ if (has_vtable && vtable) {
VTABLE_add_vtable_override(interp, SELF, name, sub);
}
/* Provided it's not anonymous, add it to the methods list. */
- if (!got_anon)
+ if (!has_anon || !anon)
DYNSELF.add_method(name, sub);
}
@@ -1423,19 +1425,19 @@ Compose a role into a class with the given exclusions and aliases.
*/
PCCMETHOD add_role(PMC *role,
PMC *exclude_method :optional :named["exclude_method"],
- int got_exclude_method :opt_flag,
+ int has_exclude_method :opt_flag,
PMC *alias_method :optional :named["alias_method"],
- int got_alias_method :opt_flag) {
+ int has_alias_method :opt_flag) {
Parrot_Class *_class = PARROT_CLASS(SELF);
/* Add everything on the resolve list to the exclude list; if we have
* no exclude list, pass along the resolve list in its place if it has
* any methods listed in it. */
- if (!got_exclude_method) {
+ if (!has_exclude_method) {
if (VTABLE_elements(interp, _class->resolve_method) != 0) {
exclude_method = _class->resolve_method;
- got_exclude_method = 1;
+ has_exclude_method = 1;
}
}
else {
@@ -1450,8 +1452,8 @@ Compose a role into a class with the given exclusions and aliases.
}
/* Do the composition. */
- Parrot_ComposeRole(interp, role, exclude_method, got_exclude_method,
- alias_method, got_alias_method,
+ Parrot_ComposeRole(interp, role, exclude_method, has_exclude_method,
+ alias_method, has_alias_method,
_class->methods, _class->roles);
}
@@ -1465,11 +1467,11 @@ parameter is supplied, a particular item of introspection data.
=cut
*/
- PCCMETHOD inspect(STRING *what :optional, int got_what :opt_flag) {
+ PCCMETHOD inspect(STRING *what :optional, int has_what :opt_flag) {
PMC *found;
/* Just delegate to the appropriate vtable method. */
- if (got_what)
+ if (has_what)
found = DYNSELF.inspect_str(what);
else
found = DYNSELF.inspect();
View
2 src/pmc/codestring.pmc
@@ -143,6 +143,7 @@ counting at 10 (so that the values 0..9 can be considered "safe").
PCCMETHOD unique(STRING *format :optional, int has_fmt :opt_flag) {
static INTVAL counter = 10;
STRING *counter_as_string = string_from_int(INTERP, counter);
+ UNUSED(SELF);
counter++;
@@ -175,6 +176,7 @@ prefixed with 'unicode:'.
STRING *x = string_from_literal (INTERP, "\\x");
INTVAL x_pos;
INTVAL is_unicode = 0;
+ UNUSED(SELF);
escaped_str = string_concat(INTERP, quote, escaped_str, 1);
escaped_str = string_concat(INTERP, escaped_str, quote, 1);
View
2 src/pmc/nci.pmc
@@ -154,7 +154,7 @@ shifted down.
typedef INTVAL(*nci_sub_t)(PARROT_INTERP, PMC *);
nci_sub_t func = PObj_flag_TEST(private2, SELF)
? (nci_sub_t) PMC_struct_val(SELF)
- : (nci_sub_t) D2FPTR(PMC_data(SELF));
+ : PMC_data_typed(SELF, nci_sub_t);
PMC *cont;
if (!func)
View
8 src/pmc/pair.pmc
@@ -48,14 +48,14 @@ Class method to construct an Integer according to passed arguments.
}
PMC *instantiate(PMC *sig) {
- PMC * const _class = REG_PMC(interp, 2);
- const int argcP = REG_INT(interp, 3);
- const int argcS = REG_INT(interp, 2);
-
return PMCNULL;
/* TODO -- really create this thing */
#if 0
+ PMC * const _class = REG_PMC(interp, 2);
+ const int argcP = REG_INT(interp, 3);
+ const int argcS = REG_INT(interp, 2);
+
SELF = pmc_new(INTERP, _class->vtable->base_type);
if (argcS == 1 && argcP == 1) {
PMC_struct_val(SELF) = REG_STR(interp, 5);
View
3 src/pmc/parrotinterpreter.pmc
@@ -104,6 +104,7 @@ clone_interpreter(Parrot_Interp d, Parrot_Interp s, INTVAL flags)
STRING * const key = VTABLE_shift_string(s, lib_iter);
PMC * const lib_pmc = VTABLE_get_pmc_keyed_str(s, libs, key);
PMC * const ignored = Parrot_clone_lib_into(d, s, lib_pmc);
+ UNUSED(ignored);
}
}
@@ -115,6 +116,7 @@ clone_interpreter(Parrot_Interp d, Parrot_Interp s, INTVAL flags)
/* Cloning the class into the new interpreter ought
* to be sufficient to instantiate the class. */
PMC *ignored = Parrot_clone(d, s->vtables[i]->pmc_class);
+ UNUSED(ignored);
}
}
}
@@ -647,6 +649,7 @@ Finish thawing.
if (!STRING_IS_EMPTY(lib_name)) {
PMC *ignored = Parrot_load_lib(INTERP, lib_name, NULL);
+ UNUSED(ignored);
}
}
View
49 src/pmc/pccmethod_test.pmc
@@ -6,61 +6,36 @@ $Id$
src/pmc/pmethod_test.pmc - PCCMETHOD_Test PMC
-=head1 DESCRIPTION
-
-
-=head2 Functions
-
-=over 4
-
=cut
*/
#include "parrot/parrot.h"
-/* Albeit the Hash PMC doesn't use PMC_data, it needs the next_for_GC pointer
- * We would get recursive marking of a deeply nested HoHoH...
- */
pmclass PCCMETHOD_Test need_ext does hash {
-/*
-
-=item C<void init()>
-
-Initializes the instance.
-
-=item C<void destroy()>
-
-Free hash structure.
-
-=cut
-
-=item C<void mark()>
-
-Marks the hash as live.
-
-=cut
-
-*/
METHOD void test_method ()
{
+ UNUSED(SELF);
PIO_printf(interp, "test_method\n");
}
PCCMETHOD test_method0(int a1)
{
+ UNUSED(SELF);
PIO_printf(interp, "test_method0\n");
PIO_printf(interp, "%d\n", a1);
}
PCCMETHOD test_method1(int a1, int a2, int a3, int a4, int a5, int a6)
{
+ UNUSED(SELF);
PIO_printf(interp, "test_method1\n");
PIO_printf(interp, "%d,%d,%d,%d,%d,%d\n", a1, a2, a3, a4, a5, a6);
}
PCCMETHOD test_method2(int a1 :optional, int a1o :opt_flag, PMC *slurpy_pos :slurpy)
{
STRING *kevin = string_from_literal(interp, "KEVIN");
+ UNUSED(SELF);
PIO_printf(interp, "test_method2\n");
PIO_printf(interp, "%d, %d, %Ss %Ss\n", a1, a1o, VTABLE_name(interp, slurpy_pos),
VTABLE_get_repr(interp,slurpy_pos));
@@ -69,27 +44,23 @@ Marks the hash as live.
}
PCCMETHOD test_method3(PMC *a1 :named["a1name"], PMC *a2 :named["a2name"])
{
+ UNUSED(SELF);
PIO_printf(interp, "test_method3\n");
PIO_printf(interp, "%Ps, %Ps\n", a1, a2);
}
PCCMETHOD test_method4(int george :optional, int g_f :opt_flag, PMC *slurpy_pos :slurpy,
PMC *slurpy_named :slurpy :named)
{
+ UNUSED(SELF);
+ UNUSED(george);
+ UNUSED(g_f);
+ UNUSED(slurpy_pos);
+ UNUSED(slurpy_named);
PIO_printf(interp, "test_method4\n");
}
}
/*
-
-=back
-
-=head1 SEE ALSO
-
-=cut
-
-*/
-
-/*
* Local variables:
* c-file-style: "parrot"
* End:
View
1 src/pmc/pmcproxy.pmc
@@ -282,6 +282,7 @@ Creates an instance of the PMC.
*/
PCCMETHOD new(PMC *args :optional, int got_args :opt_flag) {
PMC *obj = VTABLE_instantiate(interp, SELF, args);
+ UNUSED(got_args);
PCCRETURN(PMC *obj);
}
View
4 src/pmc/scalar.pmc
@@ -35,8 +35,8 @@ bitwise_left_shift_internal(PARROT_INTERP, PMC *self,
destination is promoted to a BigInt before shifting. If dest == self,
then the shift is done in place. */
const INTVAL base = VTABLE_get_integer(interp, self);
- INTVAL result;
- int overflow_p = 0;
+ INTVAL result = 0;
+ int overflow_p = 0;
/* Compute the shift. */
if (shift_amount >= 8*INTVAL_SIZE) {

0 comments on commit 8a0aaf9

Please sign in to comment.
Something went wrong with that request. Please try again.