Author: petdance
Date: Fri Jun 1 13:23:28 2007
New Revision: 18727
Modified:
trunk/include/parrot/io.h
trunk/include/parrot/pic.h
trunk/src/debug.c
trunk/src/exceptions.c
trunk/src/io/io.c
trunk/src/pmc/os.pmc
trunk/src/pmc_freeze.c
Log:
Adding GCC attributes to increase warnings
Modified: trunk/include/parrot/io.h
==============================================================================
--- trunk/include/parrot/io.h (original)
+++ trunk/include/parrot/io.h Fri Jun 1 13:23:28 2007
@@ -189,12 +189,22 @@
PARROT_API extern PMC *PIO_accept(Interp *, PMC *pmc);
-PARROT_API extern INTVAL PIO_putps(Interp *, PMC *io, STRING *s);
-PARROT_API extern INTVAL PIO_fprintf(Interp *, PMC *io, const char *s, ...);
-PARROT_API extern INTVAL PIO_printf(Interp *, const char *s, ...);
-PARROT_API extern INTVAL PIO_eprintf(Interp *, const char *s, ...);
-PARROT_API extern PIOHANDLE PIO_getfd(Interp *, PMC *io);
-PARROT_API extern PIOOFF_T PIO_tell(Interp *, PMC *io);
+PARROT_API extern INTVAL PIO_putps(Interp *, PMC *io, STRING *s)
+ __attribute__nonnull__(2);
+PARROT_API extern INTVAL PIO_fprintf(Interp *, PMC *io, const char *s, ...)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__format__(__printf__, 3, 4);
+PARROT_API extern INTVAL PIO_printf(Interp *, const char *s, ...)
+ __attribute__nonnull__(2)
+ __attribute__format__(__printf__, 2, 3);
+PARROT_API extern INTVAL PIO_eprintf(Interp *, const char *s, ...)
+ __attribute__nonnull__(2)
+ __attribute__format__(__printf__, 2, 3);
+PARROT_API extern PIOHANDLE PIO_getfd(Interp *, PMC *io)
+ __attribute__nonnull__(2);
+PARROT_API extern PIOOFF_T PIO_tell(Interp *, PMC *io)
+ __attribute__nonnull__(2);
PARROT_API extern void Parrot_IOData_mark(Interp *, ParrotIOData *piodata);
Modified: trunk/include/parrot/pic.h
==============================================================================
--- trunk/include/parrot/pic.h (original)
+++ trunk/include/parrot/pic.h Fri Jun 1 13:23:28 2007
@@ -80,7 +80,12 @@
typedef int (*arg_pass_f)(Interp *, PMC *sig,
char *src_base, void **src_pc, char *dest_base, void **dest_pc);
-int parrot_pic_check_sig(Interp *, const PMC *sig1, const PMC *sig2, int
*type);
+int parrot_pic_check_sig(Interp *, const PMC *sig1, const PMC *sig2, int *type)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
int parrot_pic_is_safe_to_jit(Interp *, PMC *sub,
PMC *sig_args, PMC *sig_results, int *flags);
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c (original)
+++ trunk/src/debug.c Fri Jun 1 13:23:28 2007
@@ -2149,18 +2149,13 @@
/*
-=item C<static void
-dump_string(Interp *interp, STRING *s)>
-
Dumps the buflen, flags, bufused, strlen, and offset associated with a string
and the string itself.
-=cut
-
*/
static void
-dump_string(Interp *interp, STRING *s)
+dump_string(Interp *interp, const STRING *s /*NULLOK*/)
{
if (!s)
return;
@@ -2169,7 +2164,7 @@
PIO_eprintf(interp, "\tFlags =\t%12ld\n", PObj_get_FLAGS(s));
PIO_eprintf(interp, "\tBufused =\t%12ld\n", s->bufused);
PIO_eprintf(interp, "\tStrlen =\t%12ld\n", s->strlen);
- PIO_eprintf(interp, "\tOffset =\t%12d\n",
+ PIO_eprintf(interp, "\tOffset =\t%12ld\n",
(char*) s->strstart - (char*) PObj_bufstart(s));
PIO_eprintf(interp, "\tString =\t%S\n", s);
}
@@ -2260,31 +2255,31 @@
void
PDB_info(Interp *interp)
{
- PIO_eprintf(interp, "Total memory allocated = %d\n",
+ PIO_eprintf(interp, "Total memory allocated = %ld\n",
interpinfo(interp, TOTAL_MEM_ALLOC));
- PIO_eprintf(interp, "DOD runs = %d\n",
+ PIO_eprintf(interp, "DOD runs = %ld\n",
interpinfo(interp, DOD_RUNS));
- PIO_eprintf(interp, "Lazy DOD runs = %d\n",
+ PIO_eprintf(interp, "Lazy DOD runs = %ld\n",
interpinfo(interp, LAZY_DOD_RUNS));
- PIO_eprintf(interp, "Collect runs = %d\n",
+ PIO_eprintf(interp, "Collect runs = %ld\n",
interpinfo(interp, COLLECT_RUNS));
- PIO_eprintf(interp, "Collect memory = %d\n",
+ PIO_eprintf(interp, "Collect memory = %ld\n",
interpinfo(interp, TOTAL_COPIED));
- PIO_eprintf(interp, "Active PMCs = %d\n",
+ PIO_eprintf(interp, "Active PMCs = %ld\n",
interpinfo(interp, ACTIVE_PMCS));
- PIO_eprintf(interp, "Extended PMCs = %d\n",
+ PIO_eprintf(interp, "Extended PMCs = %ld\n",
interpinfo(interp, EXTENDED_PMCS));
- PIO_eprintf(interp, "Timely DOD PMCs = %d\n",
+ PIO_eprintf(interp, "Timely DOD PMCs = %ld\n",
interpinfo(interp, IMPATIENT_PMCS));
- PIO_eprintf(interp, "Total PMCs = %d\n",
+ PIO_eprintf(interp, "Total PMCs = %ld\n",
interpinfo(interp, TOTAL_PMCS));
- PIO_eprintf(interp, "Active buffers = %d\n",
+ PIO_eprintf(interp, "Active buffers = %ld\n",
interpinfo(interp, ACTIVE_BUFFERS));
- PIO_eprintf(interp, "Total buffers = %d\n",
+ PIO_eprintf(interp, "Total buffers = %ld\n",
interpinfo(interp, TOTAL_BUFFERS));
- PIO_eprintf(interp, "Header allocations since last collect = %d\n",
+ PIO_eprintf(interp, "Header allocations since last collect = %ld\n",
interpinfo(interp, HEADER_ALLOCS_SINCE_COLLECT));
- PIO_eprintf(interp, "Memory allocations since last collect = %d\n",
+ PIO_eprintf(interp, "Memory allocations since last collect = %ld\n",
interpinfo(interp, MEM_ALLOCS_SINCE_COLLECT));
}
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c (original)
+++ trunk/src/exceptions.c Fri Jun 1 13:23:28 2007
@@ -198,7 +198,7 @@
= stack_entry(interp, interp->dynamic_env, 0);
if (!e)
real_exception(interp, NULL, 1,
- "Mark %d not found.", mark);
+ "Mark %ld not found.", (long)mark);
(void)stack_pop(interp, &interp->dynamic_env,
NULL, e->entry_type);
if (e->entry_type == STACK_ENTRY_MARK) {
Modified: trunk/src/io/io.c
==============================================================================
--- trunk/src/io/io.c (original)
+++ trunk/src/io/io.c Fri Jun 1 13:23:28 2007
@@ -693,14 +693,8 @@
/*
-=item C<PMC *
-PIO_open(Interp *interp, ParrotIOLayer *layer, const char *spath,
- const char *sflags)>
-
Creates and returns a C<ParrotIO> PMC for C<*spath>.
-=cut
-
*/
PMC *
@@ -1006,7 +1000,7 @@
*/
INTVAL
-PIO_putps(Interp *interp, PMC *pmc, STRING *s)
+PIO_putps(Interp *interp, PMC *pmc, STRING *s /*NULLOK*/)
{
ParrotIOLayer * const l = (ParrotIOLayer *)PMC_struct_val(pmc);
ParrotIO * const io = (ParrotIO *)PMC_data0(pmc);
Modified: trunk/src/pmc/os.pmc
==============================================================================
--- trunk/src/pmc/os.pmc (original)
+++ trunk/src/pmc/os.pmc Fri Jun 1 13:23:28 2007
@@ -505,10 +505,9 @@
string_cstring_free(coldpath);
string_cstring_free(cnewpath);
- if (ret < 0)
- {
- char *errmsg = strerror(errno) ;
- real_exception(interp, NULL, E_SystemError, errmsg);
+ if (ret < 0) {
+ const char * const errmsg = strerror(errno) ;
+ real_exception(interp, NULL, E_SystemError, "%s", errmsg);
}
}
Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c (original)
+++ trunk/src/pmc_freeze.c Fri Jun 1 13:23:28 2007
@@ -859,7 +859,7 @@
info->visit_action = pmc->vtable->freeze;
break;
default:
- internal_exception(1, "Illegal action %d", info->what);
+ internal_exception(1, "Illegal action %ld", (long)info->what);
break;
}
}