Author: chromatic
Date: Sun Dec 7 00:21:36 2008
New Revision: 33596
Modified:
trunk/include/parrot/atomic/gcc_x86.h
trunk/include/parrot/misc.h
trunk/include/parrot/pmc.h
trunk/include/parrot/register.h
trunk/include/parrot/string_funcs.h
trunk/src/atomic/gcc_x86.c
trunk/src/gc/register.c
trunk/src/jit/i386/exec_dep.h
trunk/src/pmc.c
trunk/src/string.c
trunk/src/utils.c
Log:
[src] Added remaining missing pointer parameter decorations, as identified by
make headerizer.
Modified: trunk/include/parrot/atomic/gcc_x86.h
==============================================================================
--- trunk/include/parrot/atomic/gcc_x86.h (original)
+++ trunk/include/parrot/atomic/gcc_x86.h Sun Dec 7 00:21:36 2008
@@ -20,10 +20,18 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
-void * parrot_i386_cmpxchg(void *volatile *ptr, void *expect, void *update);
+void * parrot_i386_cmpxchg(
+ ARGMOD(void *volatile *ptr),
+ ARGIN(void *expect),
+ ARGIN(void *update))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*ptr);
PARROT_EXPORT
-long parrot_i386_xadd(volatile long *l, long amount);
+long parrot_i386_xadd(ARGIN(volatile long *l), long amount)
+ __attribute__nonnull__(1);
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
/* HEADERIZER END: src/atomic/gcc_x86.c */
Modified: trunk/include/parrot/misc.h
==============================================================================
--- trunk/include/parrot/misc.h (original)
+++ trunk/include/parrot/misc.h Sun Dec 7 00:21:36 2008
@@ -86,8 +86,14 @@
PARROT_CONST_FUNCTION
INTVAL intval_mod(INTVAL i2, INTVAL i3);
-void Parrot_quicksort(PARROT_INTERP, void **data, UINTVAL n, PMC *cmp)
- __attribute__nonnull__(1);
+void Parrot_quicksort(PARROT_INTERP,
+ ARGMOD(void **data),
+ UINTVAL n,
+ ARGIN(PMC *cmp))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*data);
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
Modified: trunk/include/parrot/pmc.h
==============================================================================
--- trunk/include/parrot/pmc.h (original)
+++ trunk/include/parrot/pmc.h Sun Dec 7 00:21:36 2008
@@ -49,7 +49,7 @@
__attribute__nonnull__(1);
PARROT_EXPORT
-INTVAL PMC_is_null(SHIM_INTERP, NULLOK(const PMC *pmc));
+INTVAL PMC_is_null(SHIM_INTERP, ARGIN_NULLOK(const PMC *pmc));
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
@@ -97,8 +97,10 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-void temporary_pmc_free(PARROT_INTERP, PMC *pmc)
- __attribute__nonnull__(1);
+void temporary_pmc_free(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
PARROT_CANNOT_RETURN_NULL
PMC * temporary_pmc_new(PARROT_INTERP, INTVAL base_type)
Modified: trunk/include/parrot/register.h
==============================================================================
--- trunk/include/parrot/register.h (original)
+++ trunk/include/parrot/register.h Sun Dec 7 00:21:36 2008
@@ -80,6 +80,7 @@
__attribute__nonnull__(1);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
Parrot_Context * Parrot_context_ref_trace(PARROT_INTERP,
ARGMOD(Parrot_Context *ctx),
ARGIN(const char *file),
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Sun Dec 7 00:21:36 2008
@@ -473,6 +473,7 @@
PARROT_EXPORT
PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
char * string_to_cstring_nullable(PARROT_INTERP,
ARGIN_NULLOK(const STRING *s))
__attribute__nonnull__(1);
Modified: trunk/src/atomic/gcc_x86.c
==============================================================================
--- trunk/src/atomic/gcc_x86.c (original)
+++ trunk/src/atomic/gcc_x86.c Sun Dec 7 00:21:36 2008
@@ -48,8 +48,8 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
void *
-parrot_i386_cmpxchg(void *volatile *ptr, void *expect,
- void *update)
+parrot_i386_cmpxchg(ARGMOD(void *volatile *ptr), ARGIN(void *expect),
+ ARGIN(void *update))
{
#if defined(PARROT_HAS_X86_64_GCC_CMPXCHG)
__asm__ __volatile__("lock\n"
@@ -81,7 +81,7 @@
PARROT_EXPORT
long
-parrot_i386_xadd(volatile long *l, long amount)
+parrot_i386_xadd(ARGIN(volatile long *l), long amount)
{
long result = amount;
#if defined(PARROT_HAS_X86_64_GCC_CMPXCHG)
Modified: trunk/src/gc/register.c
==============================================================================
--- trunk/src/gc/register.c (original)
+++ trunk/src/gc/register.c Sun Dec 7 00:21:36 2008
@@ -634,18 +634,21 @@
*/
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
Parrot_Context *
-Parrot_context_ref_trace(PARROT_INTERP,
- ARGMOD(Parrot_Context *ctx),
+Parrot_context_ref_trace(PARROT_INTERP, ARGMOD(Parrot_Context *ctx),
ARGIN(const char *file), int line)
{
if (Interp_debug_TEST(interp, PARROT_CTX_DESTROY_DEBUG_FLAG)) {
const char *name = "unknown";
+
if (ctx->current_sub)
name = (char *)(PMC_sub(ctx->current_sub)->name->strstart);
+
fprintf(stderr, "[reference to context %p ('%s') taken at %s:%d]\n",
(void *)ctx, name, file, line);
}
+
ctx->ref_count++;
return ctx;
}
Modified: trunk/src/jit/i386/exec_dep.h
==============================================================================
--- trunk/src/jit/i386/exec_dep.h (original)
+++ trunk/src/jit/i386/exec_dep.h Sun Dec 7 00:21:36 2008
@@ -19,18 +19,35 @@
/* HEADERIZER BEGIN: src/exec_dep.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
-void offset_fixup(Parrot_exec_objfile_t *obj);
-void Parrot_exec_cpcf_op(Parrot_jit_info_t *jit_info, PARROT_INTERP)
- __attribute__nonnull__(2);
-
-void Parrot_exec_normal_op(Parrot_jit_info_t *jit_info, PARROT_INTERP)
- __attribute__nonnull__(2);
-
-void Parrot_exec_normal_op(Parrot_jit_info_t *jit_info, PARROT_INTERP)
- __attribute__nonnull__(2);
-
-void Parrot_exec_restart_op(Parrot_jit_info_t *jit_info, PARROT_INTERP)
- __attribute__nonnull__(2);
+void offset_fixup(ARGMOD(Parrot_exec_objfile_t *obj))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*obj);
+
+void Parrot_exec_cpcf_op(ARGMOD(Parrot_jit_info_t *jit_info), PARROT_INTERP)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*jit_info);
+
+void Parrot_exec_normal_op(
+ ARGMOD(Parrot_jit_info_t *jit_info),
+ PARROT_INTERP)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*jit_info);
+
+void Parrot_exec_normal_op(
+ ARGMOD(Parrot_jit_info_t *jit_info),
+ PARROT_INTERP)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*jit_info);
+
+void Parrot_exec_restart_op(
+ ARGMOD(Parrot_jit_info_t *jit_info),
+ PARROT_INTERP)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*jit_info);
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
/* HEADERIZER END: src/exec_dep.c */
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c (original)
+++ trunk/src/pmc.c Sun Dec 7 00:21:36 2008
@@ -36,13 +36,19 @@
UINTVAL flags)
__attribute__nonnull__(1);
-static void pmc_free(PARROT_INTERP, PMC *pmc)
- __attribute__nonnull__(1);
+static void pmc_free(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
static void pmc_free_to_pool(PARROT_INTERP,
- PMC *pmc,
- Small_Object_Pool *pool)
- __attribute__nonnull__(1);
+ ARGMOD(PMC *pmc),
+ ARGMOD(Small_Object_Pool *pool))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*pmc)
+ FUNC_MODIFIES(*pool);
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
/* HEADERIZER END: static */
@@ -64,7 +70,7 @@
PARROT_EXPORT
INTVAL
-PMC_is_null(SHIM_INTERP, NULLOK(const PMC *pmc))
+PMC_is_null(SHIM_INTERP, ARGIN_NULLOK(const PMC *pmc))
{
#if PARROT_CATCH_NULL
return pmc == PMCNULL || pmc == NULL;
@@ -458,7 +464,8 @@
*/
static void
-pmc_free_to_pool(PARROT_INTERP, PMC *pmc, Small_Object_Pool *pool)
+pmc_free_to_pool(PARROT_INTERP, ARGMOD(PMC *pmc),
+ ARGMOD(Small_Object_Pool *pool))
{
if (PObj_active_destroy_TEST(pmc))
VTABLE_destroy(interp, pmc);
@@ -471,15 +478,16 @@
pool->num_free_objects++;
}
+
void
-temporary_pmc_free(PARROT_INTERP, PMC *pmc)
+temporary_pmc_free(PARROT_INTERP, ARGMOD(PMC *pmc))
{
Small_Object_Pool *pool = interp->arena_base->constant_pmc_pool;
pmc_free_to_pool(interp, pmc, pool);
}
static void
-pmc_free(PARROT_INTERP, PMC *pmc)
+pmc_free(PARROT_INTERP, ARGMOD(PMC *pmc))
{
Small_Object_Pool *pool = interp->arena_base->pmc_pool;
pmc_free_to_pool(interp, pmc, pool);
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Sun Dec 7 00:21:36 2008
@@ -2110,6 +2110,7 @@
return string_to_cstring_nullable(interp, s);
}
+
/*
=item C<char * string_to_cstring_nullable>
@@ -2124,12 +2125,12 @@
PARROT_EXPORT
PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
char *
string_to_cstring_nullable(PARROT_INTERP, ARGIN_NULLOK(const STRING *s))
{
- if (! s) {
+ if (!s)
return NULL;
- }
else {
char *p = (char *)mem_sys_allocate(s->bufused + 1);
memcpy(p, s->strstart, s->bufused);
Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c (original)
+++ trunk/src/utils.c Sun Dec 7 00:21:36 2008
@@ -49,8 +49,14 @@
static long _mrand48(void);
static long _nrand48(_rand_buf buf);
static void _srand48(long seed);
-static INTVAL COMPARE(PARROT_INTERP, void *a, void *b, PMC *cmp)
- __attribute__nonnull__(1);
+static INTVAL COMPARE(PARROT_INTERP,
+ ARGIN(void *a),
+ ARGIN(void *b),
+ ARGIN(PMC *cmp))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
static void next_rand(_rand_buf X);
static void process_cycle_without_exit(
@@ -63,7 +69,12 @@
ARGIN(parrot_prm_context* c))
__attribute__nonnull__(2);
-static void swap(void **x, void **y);
+static void swap(ARGMOD(void **x), ARGMOD(void **y))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*x)
+ FUNC_MODIFIES(*y);
+
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will
be lost. */
/* HEADERIZER END: static */
@@ -840,21 +851,20 @@
/* TODO: Macroize swap and COMPARE */
static void
-swap(void **x, void **y)
+swap(ARGMOD(void **x), ARGMOD(void **y))
{
void *t = *x;
*x = *y;
*y = t;
}
-typedef INTVAL (*sort_func_t)(PARROT_INTERP, void*, void*);
+typedef INTVAL (*sort_func_t)(PARROT_INTERP, void *, void *);
static INTVAL
-COMPARE(PARROT_INTERP, void *a, void *b, PMC *cmp)
+COMPARE(PARROT_INTERP, ARGIN(void *a), ARGIN(void *b), ARGIN(PMC *cmp))
{
- if (PMC_IS_NULL(cmp)) {
- return VTABLE_cmp(interp, (PMC*)a, (PMC*)b);
- }
+ if (PMC_IS_NULL(cmp))
+ return VTABLE_cmp(interp, (PMC *)a, (PMC *)b);
if (cmp->vtable->base_type == enum_class_NCI) {
const sort_func_t f = (sort_func_t)D2FPTR(PMC_struct_val(cmp));
@@ -866,12 +876,12 @@
void
-Parrot_quicksort(PARROT_INTERP, void **data, UINTVAL n, PMC *cmp)
+Parrot_quicksort(PARROT_INTERP, ARGMOD(void **data), UINTVAL n, ARGIN(PMC
*cmp))
{
while (n > 1) {
UINTVAL i, j, ln, rn;
- swap(&data[0], &data[n/2]);
+ swap(&data[0], &data[n / 2]);
for (i = 0, j = n; ;) {
do