[svn:parrot] r45226 - trunk/src/pmc
petdance at svn.parrot.org
petdance at svn.parrot.org
Sun Mar 28 05:23:14 UTC 2010
Author: petdance
Date: Sun Mar 28 05:23:14 2010
New Revision: 45226
URL: https://trac.parrot.org/parrot/changeset/45226
Log:
adding ARG* macros
Modified:
trunk/src/pmc/eval.pmc
trunk/src/pmc/integer.pmc
trunk/src/pmc/unmanagedstruct.pmc
Modified: trunk/src/pmc/eval.pmc
==============================================================================
--- trunk/src/pmc/eval.pmc Sun Mar 28 04:35:44 2010 (r45225)
+++ trunk/src/pmc/eval.pmc Sun Mar 28 05:23:14 2010 (r45226)
@@ -25,29 +25,38 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void clear_fixups(PARROT_INTERP, Parrot_Sub_attributes *sub_data)
- __attribute__nonnull__(1);
-
-static PMC* get_sub(PARROT_INTERP, PMC *self, int idx)
- __attribute__nonnull__(1);
-
-static void mark_subs(PARROT_INTERP, PMC *self)
- __attribute__nonnull__(1);
+static void clear_fixups(PARROT_INTERP,
+ ARGIN(const Parrot_Sub_attributes *sub_data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static PMC* get_sub(PARROT_INTERP, ARGIN(PMC *self), int idx)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void mark_subs(PARROT_INTERP, ARGIN(PMC *self))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
#define ASSERT_ARGS_clear_fixups __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(sub_data))
#define ASSERT_ARGS_get_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(self))
#define ASSERT_ARGS_mark_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(self))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
static void
-clear_fixups(PARROT_INTERP, Parrot_Sub_attributes *sub_data)
+clear_fixups(PARROT_INTERP, ARGIN(const Parrot_Sub_attributes *sub_data))
{
INTVAL i;
- PackFile_ByteCode *seg = sub_data->seg;
+ PackFile_ByteCode * const seg = sub_data->seg;
PackFile_FixupTable *ft;
PackFile_ConstTable *ct;
@@ -63,7 +72,7 @@
return;
for (i = 0; i < ft->fixup_count; i++) {
- PackFile_FixupEntry *e = ft->fixups[i];
+ const PackFile_FixupEntry * const e = ft->fixups[i];
if (e->type == enum_fixup_sub) {
opcode_t ci = e->offset;
@@ -74,8 +83,10 @@
}
}
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static PMC*
-get_sub(PARROT_INTERP, PMC *self, int idx)
+get_sub(PARROT_INTERP, ARGIN(PMC *self), int idx)
{
INTVAL i, n;
Parrot_Sub_attributes *sub;
@@ -112,7 +123,7 @@
}
static void
-mark_subs(PARROT_INTERP, PMC *self)
+mark_subs(PARROT_INTERP, ARGIN(PMC *self))
{
Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Sun Mar 28 04:35:44 2010 (r45225)
+++ trunk/src/pmc/integer.pmc Sun Mar 28 05:23:14 2010 (r45226)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2003-2008, Parrot Foundation.
+Copyright (C) 2003-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -28,13 +28,18 @@
static void maybe_throw_overflow_error(PARROT_INTERP)
__attribute__nonnull__(1);
-static PMC* upgrade_self_to_bignum(PARROT_INTERP, PMC *self)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+static PMC* upgrade_self_to_bignum(PARROT_INTERP, ARGMOD(PMC *self))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*self);
#define ASSERT_ARGS_maybe_throw_overflow_error __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_upgrade_self_to_bignum __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(self))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -49,8 +54,10 @@
"Integer overflow");
}
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
static PMC*
-upgrade_self_to_bignum(PARROT_INTERP, PMC *self)
+upgrade_self_to_bignum(PARROT_INTERP, ARGMOD(PMC *self))
{
/* Do an in-place upgrade to a Bignum of SELF and return a pointer
to it (which is probably redundant, but whatever). */
Modified: trunk/src/pmc/unmanagedstruct.pmc
==============================================================================
--- trunk/src/pmc/unmanagedstruct.pmc Sun Mar 28 04:35:44 2010 (r45225)
+++ trunk/src/pmc/unmanagedstruct.pmc Sun Mar 28 05:23:14 2010 (r45226)
@@ -45,35 +45,80 @@
__attribute__nonnull__(2)
__attribute__nonnull__(3);
-static char * char_offset_int(PARROT_INTERP, PMC *pmc, INTVAL ix, int *type)
- __attribute__nonnull__(1);
-
-static char * char_offset_key(PARROT_INTERP, PMC *pmc, PMC *key, int *type)
- __attribute__nonnull__(1);
-
-static INTVAL key_2_idx(PARROT_INTERP, PMC *pmc, PMC *key)
- __attribute__nonnull__(1);
-
-static FLOATVAL ret_float(PARROT_INTERP, const char *p, int type)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static char * char_offset_int(PARROT_INTERP,
+ ARGIN(PMC *pmc),
+ INTVAL ix,
+ ARGMOD(int *type))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*type);
-static INTVAL ret_int(PARROT_INTERP, const char *p, int type)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static char * char_offset_key(PARROT_INTERP,
+ ARGIN(PMC *pmc),
+ ARGIN(PMC *key),
+ ARGMOD(int *type))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*type);
-static PMC* ret_pmc(PARROT_INTERP, PMC *pmc, char *p, int type, INTVAL idx)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+static INTVAL key_2_idx(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
-static STRING* ret_string(PARROT_INTERP, char *p, int type)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+static FLOATVAL ret_float(PARROT_INTERP, ARGIN(const char *p), int type)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
-static void set_float(PARROT_INTERP, char *p, int type, FLOATVAL value)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+static INTVAL ret_int(PARROT_INTERP, ARGIN(const char *p), int type)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
-static void set_int(PARROT_INTERP, char *p, int type, INTVAL value)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+static PMC* ret_pmc(PARROT_INTERP,
+ ARGIN(PMC *pmc),
+ ARGIN(char *p),
+ int type,
+ INTVAL idx)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
-static void set_string(PARROT_INTERP, char *p, int type, STRING *value)
- __attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
+static STRING* ret_string(PARROT_INTERP, ARGIN(char *p), int type)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void set_float(PARROT_INTERP,
+ ARGIN(char *p),
+ int type,
+ FLOATVAL value)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void set_int(PARROT_INTERP, ARGIN(char *p), int type, INTVAL value)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void set_string(PARROT_INTERP,
+ ARGIN(char *p),
+ int type,
+ ARGIN(STRING *value))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4);
#define ASSERT_ARGS_calc_align __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -83,25 +128,41 @@
, PARROT_ASSERT_ARG(pmc) \
, PARROT_ASSERT_ARG(value))
#define ASSERT_ARGS_char_offset_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc) \
+ , PARROT_ASSERT_ARG(type))
#define ASSERT_ARGS_char_offset_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc) \
+ , PARROT_ASSERT_ARG(key) \
+ , PARROT_ASSERT_ARG(type))
#define ASSERT_ARGS_key_2_idx __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc) \
+ , PARROT_ASSERT_ARG(key))
#define ASSERT_ARGS_ret_float __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_ret_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_ret_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_ret_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_set_float __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_set_int __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p))
#define ASSERT_ARGS_set_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(p) \
+ , PARROT_ASSERT_ARG(value))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -117,8 +178,10 @@
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static char *
-char_offset_int(PARROT_INTERP, PMC *pmc, INTVAL ix, int *type)
+char_offset_int(PARROT_INTERP, ARGIN(PMC *pmc), INTVAL ix, ARGMOD(int *type))
{
size_t offs, n;
ix *= 3;
@@ -154,8 +217,9 @@
*/
+PARROT_WARN_UNUSED_RESULT
static INTVAL
-key_2_idx(PARROT_INTERP, PMC *pmc, PMC *key)
+key_2_idx(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key))
{
int ix = 0;
@@ -202,8 +266,10 @@
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static char *
-char_offset_key(PARROT_INTERP, PMC *pmc, PMC *key, int *type)
+char_offset_key(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(PMC *key), ARGMOD(int *type))
{
size_t offs, count, size, max;
int ix;
@@ -305,12 +371,9 @@
*/
+PARROT_WARN_UNUSED_RESULT
static INTVAL
-ret_int(PARROT_INTERP, const char *p, int type)
- __attribute__nonnull__(1);
-
-static INTVAL
-ret_int(PARROT_INTERP, const char *p, int type)
+ret_int(PARROT_INTERP, ARGIN(const char *p), int type)
{
switch (type) {
case enum_type_INTVAL:
@@ -376,12 +439,9 @@
*/
+PARROT_WARN_UNUSED_RESULT
static FLOATVAL
-ret_float(PARROT_INTERP, const char *p, int type)
- __attribute__nonnull__(1);
-
-static FLOATVAL
-ret_float(PARROT_INTERP, const char *p, int type)
+ret_float(PARROT_INTERP, ARGIN(const char *p), int type)
{
switch (type) {
case enum_type_FLOATVAL:
@@ -406,13 +466,15 @@
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static STRING*
-ret_string(PARROT_INTERP, char *p, int type)
+ret_string(PARROT_INTERP, ARGIN(char *p), int type)
{
if (type == enum_type_cstr) {
char *cstr = *(char **) p;
if (cstr) {
- size_t len = strlen(cstr);
+ const size_t len = strlen(cstr);
/* TODO
Can't assume that the C string is constant during the
life of the returned parrot string, so can't be
@@ -442,12 +504,14 @@
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
static PMC*
-ret_pmc(PARROT_INTERP, PMC *pmc, char *p, int type, INTVAL idx)
+ret_pmc(PARROT_INTERP, ARGIN(PMC *pmc), ARGIN(char *p), int type, INTVAL idx)
{
+ PMC * const init = PARROT_UNMANAGEDSTRUCT(pmc)->init;
+ PMC * const ptr = VTABLE_get_pmc_keyed_int(interp, init, idx * 3);
PMC *ret = NULL;
- PMC *init = PARROT_UNMANAGEDSTRUCT(pmc)->init;
- PMC *ptr = VTABLE_get_pmc_keyed_int(interp, init, idx * 3);
switch (type) {
case enum_type_func_ptr:
@@ -457,9 +521,9 @@
/* now check if initializer has a signature attached */
if (PMC_metadata(ptr)) {
STRING *signature_str = CONST_STRING(interp, "_signature");
- PMC *sig = VTABLE_getprop(interp, ptr, signature_str);
+ PMC * const sig = VTABLE_getprop(interp, ptr, signature_str);
if (VTABLE_defined(interp, sig)) {
- STRING *sig_str = VTABLE_get_string(interp, sig);
+ STRING * const sig_str = VTABLE_get_string(interp, sig);
ret = Parrot_pmc_new(interp, enum_class_NCI);
VTABLE_set_pointer_keyed_str(interp, ret, sig_str,
*(PMC **)p);
@@ -497,7 +561,7 @@
*/
static void
-set_int(PARROT_INTERP, char *p, int type, INTVAL value)
+set_int(PARROT_INTERP, ARGIN(char *p), int type, INTVAL value)
{
switch (type) {
case enum_type_uint8:
@@ -536,7 +600,7 @@
*/
static void
-set_float(PARROT_INTERP, char *p, int type, FLOATVAL value)
+set_float(PARROT_INTERP, ARGIN(char *p), int type, FLOATVAL value)
{
switch (type) {
case enum_type_FLOATVAL:
@@ -567,7 +631,7 @@
*/
static void
-set_string(PARROT_INTERP, char *p, int type, STRING *value)
+set_string(PARROT_INTERP, ARGIN(char *p), int type, ARGIN(STRING *value))
{
if (type == enum_type_cstr) {
/* assuming 0-terminated C-string here;
@@ -884,7 +948,7 @@
VTABLE INTVAL get_integer_keyed_int(INTVAL ix) {
int type;
- char *p = char_offset_int(INTERP, pmc, ix, &type);
+ const char * const p = char_offset_int(INTERP, pmc, ix, &type);
return ret_int(INTERP, p, type);
}
@@ -948,7 +1012,7 @@
VTABLE STRING *get_string_keyed_int(INTVAL key) {
int type;
- char *p = char_offset_int(INTERP, pmc, key, &type);
+ char * const p = char_offset_int(INTERP, pmc, key, &type);
return ret_string(INTERP, p, type);
}
@@ -964,7 +1028,7 @@
VTABLE STRING *get_string_keyed(PMC *key) {
int type;
- char *p = char_offset_key(INTERP, pmc, key, &type);
+ char * const p = char_offset_key(INTERP, pmc, key, &type);
return ret_string(INTERP, p, type);
}
More information about the parrot-commits
mailing list