cvsuser 03/12/09 09:44:56
Modified: config/gen/cflags root.in
io io.c io_buf.c io_stdio.c io_unix.c
Log:
Make io/ compile without warnings using -Wunused
* config/gen/cflags/root.in: compile io/ with -Wunused
* io/*.c: Add some UNUSED(interpreter) and UNUSED(layer)
* io/io_stdio.c: Actually use the pio_stdio_flush function
Revision Changes Path
1.5 +3 -0 parrot/config/gen/cflags/root.in
Index: root.in
===================================================================
RCS file: /cvs/public/parrot/config/gen/cflags/root.in,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- root.in 28 Nov 2003 14:47:57 -0000 1.4
+++ root.in 9 Dec 2003 17:44:53 -0000 1.5
@@ -8,6 +8,9 @@
src/spf_render.c -{-Wformat-nonliteral} # noisy
src/tsq.c -{${optimize}} # never optimize tsq.c!
+# io should be -Wunsed clean
+{^io/} s/-Wno-unused/-Wunused/
+
# imcc file settings
{^imcc/} -{-Wwrite-strings -Wcast-qual} s/-Wno-unused/-Wunused/
imcc/instructions.c -{-Wformat-nonliteral} # noisy
1.76 +10 -2 parrot/io/io.c
Index: io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -w -r1.75 -r1.76
--- io.c 23 Nov 2003 06:07:10 -0000 1.75
+++ io.c 9 Dec 2003 17:44:55 -0000 1.76
@@ -1,7 +1,7 @@
/* io.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io.c,v 1.75 2003/11/23 06:07:10 mrjoltcola Exp $
+ * $Id: io.c,v 1.76 2003/12/09 17:44:55 boemmels Exp $
* Overview:
* This is the Parrot IO subsystem API. Generic IO stuff
* goes here, each specific layer goes in its own file...
@@ -158,8 +158,10 @@
PIO_finish(theINTERP)
{
ParrotIOLayer *p, *down;
+#if 0
ParrotIO *io;
int i;
+#endif
/* XXX is this all correct? */
@@ -705,6 +707,8 @@
{
ParrotIO *io = PMC_data(pmc);
+ UNUSED(interpreter);
+
/* io could be null here, but rather than return a negative error
* we just fake EOF since eof test is usually in a boolean context.
*/
@@ -727,7 +731,6 @@
INTVAL
PIO_putps(theINTERP, PMC *pmc, STRING *s)
{
- INTVAL retVal;
return PIO_write(interpreter, pmc, s->strstart, s->strlen);
}
@@ -800,6 +803,8 @@
{
ParrotIO *io = PMC_data(pmc);
+ UNUSED(interpreter);
+
if (io) {
return io->fd;
}
@@ -937,6 +942,9 @@
PIO_isatty(theINTERP, PMC *pmc)
{
ParrotIO *io = PMC_data(pmc);
+
+ UNUSED(interpreter);
+
if (!io)
return 0;
1.20 +5 -4 parrot/io/io_buf.c
Index: io_buf.c
===================================================================
RCS file: /cvs/public/parrot/io/io_buf.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -w -r1.19 -r1.20
--- io_buf.c 17 Nov 2003 17:22:05 -0000 1.19
+++ io_buf.c 9 Dec 2003 17:44:55 -0000 1.20
@@ -1,7 +1,7 @@
/* io_buf.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io_buf.c,v 1.19 2003/11/17 17:22:05 boemmels Exp $
+ * $Id: io_buf.c,v 1.20 2003/12/09 17:44:55 boemmels Exp $
* Overview:
* The "buf" layer of Parrot IO. Buffering and all the fun stuff.
*
@@ -46,8 +46,6 @@
ParrotIO *io, void *buffer, size_t len);
static size_t PIO_buf_write(theINTERP, ParrotIOLayer *l,
ParrotIO *io, const void *buffer, size_t len);
-static INTVAL PIO_buf_puts(theINTERP, ParrotIOLayer *l, ParrotIO *io,
- const char *s);
static PIOOFF_T PIO_buf_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
PIOOFF_T offset, INTVAL whence);
static PIOOFF_T PIO_buf_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
@@ -497,8 +495,11 @@
static PIOOFF_T
-PIO_buf_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io)
+PIO_buf_tell(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
+ UNUSED(interpreter);
+ UNUSED(layer)
+
return io->fpos;
}
1.37 +31 -8 parrot/io/io_stdio.c
Index: io_stdio.c
===================================================================
RCS file: /cvs/public/parrot/io/io_stdio.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -w -r1.36 -r1.37
--- io_stdio.c 19 Nov 2003 13:29:37 -0000 1.36
+++ io_stdio.c 9 Dec 2003 17:44:55 -0000 1.37
@@ -1,7 +1,7 @@
/* io_stdio.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io_stdio.c,v 1.36 2003/11/19 13:29:37 boemmels Exp $
+ * $Id: io_stdio.c,v 1.37 2003/12/09 17:44:55 boemmels Exp $
* Overview:
* This is the Parrot IO STDIO layer. This may provide a subset of
* full functionality, but must compile on any system with the
@@ -50,11 +50,9 @@
ParrotIO *io, void *buffer, size_t len);
static size_t PIO_stdio_write(theINTERP, ParrotIOLayer *layer,
ParrotIO *io, const void *buffer, size_t len);
-static INTVAL PIO_stdio_puts(theINTERP, ParrotIOLayer *l, ParrotIO *io,
- const char *s);
-static PIOOFF_T PIO_stdio_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
+static PIOOFF_T PIO_stdio_seek(theINTERP, ParrotIOLayer *layer, ParrotIO *io,
PIOOFF_T offset, INTVAL whence);
-static PIOOFF_T PIO_stdio_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
+static PIOOFF_T PIO_stdio_tell(theINTERP, ParrotIOLayer *layer, ParrotIO *io);
static INTVAL PIO_stdio_isatty(PIOHANDLE fd);
@@ -105,6 +103,9 @@
PIO_STDERR(interpreter)
= new_io_pmc(interpreter,
PIO_stdio_fdopen(interpreter, layer, stderr, PIO_F_WRITE));
+#else /* PIO_OS_STDIO */
+ UNUSED(interpreter);
+ UNUSED(layer);
#endif /* PIO_OS_STDIO */
return 0;
}
@@ -124,6 +125,8 @@
FILE *fptr;
type = PIO_TYPE_FILE;
+ UNUSED(layer);
+
if ((flags & (PIO_F_WRITE | PIO_F_READ)) == 0)
return NULL;
@@ -158,6 +161,8 @@
INTVAL mode;
mode = 0;
+ UNUSED(layer);
+
if (PIO_stdio_isatty(fptr))
flags |= PIO_F_CONSOLE;
@@ -174,6 +179,10 @@
PIO_stdio_close(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
FILE *fptr = (FILE*)io->fd;
+
+ UNUSED(interpreter);
+ UNUSED(layer);
+
if (fptr != NULL)
fclose(fptr);
io->fd = (PIOHANDLE)NULL;
@@ -184,6 +193,8 @@
static INTVAL
PIO_stdio_isatty(PIOHANDLE fptr)
{
+ UNUSED(fptr);
+
/* no obvious way to check for this with STDIO */
return 0;
}
@@ -192,6 +203,8 @@
INTVAL
PIO_stdio_getblksize(PIOHANDLE fptr)
{
+ UNUSED(fptr);
+
/* Hard coded for now */
return PIO_BLKSIZE;
}
@@ -200,6 +213,9 @@
static INTVAL
PIO_stdio_flush(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
+ UNUSED(interpreter);
+ UNUSED(layer);
+
return fflush((FILE*)io->fd);
}
@@ -241,10 +257,14 @@
* Hard seek
*/
static PIOOFF_T
-PIO_stdio_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
+PIO_stdio_seek(theINTERP, ParrotIOLayer *layer, ParrotIO *io,
PIOOFF_T offset, INTVAL whence)
{
PIOOFF_T pos;
+
+ UNUSED(interpreter);
+ UNUSED(layer);
+
errno = 0;
if ((pos = fseek((FILE*)io->fd, offset, whence)) >= 0) {
@@ -259,8 +279,11 @@
static PIOOFF_T
-PIO_stdio_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io)
+PIO_stdio_tell(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
+ UNUSED(interpreter);
+ UNUSED(layer);
+
return(ftell((FILE*)io->fd));
}
@@ -282,7 +305,7 @@
PIO_null_write_async,
PIO_stdio_read,
PIO_null_read_async,
- PIO_null_flush,
+ PIO_stdio_flush,
PIO_stdio_seek,
PIO_stdio_tell,
PIO_null_setbuf,
1.44 +23 -6 parrot/io/io_unix.c
Index: io_unix.c
===================================================================
RCS file: /cvs/public/parrot/io/io_unix.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -w -r1.43 -r1.44
--- io_unix.c 25 Nov 2003 00:33:24 -0000 1.43
+++ io_unix.c 9 Dec 2003 17:44:55 -0000 1.44
@@ -1,7 +1,7 @@
/* io_unix.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io_unix.c,v 1.43 2003/11/25 00:33:24 mrjoltcola Exp $
+ * $Id: io_unix.c,v 1.44 2003/12/09 17:44:55 boemmels Exp $
* Overview:
* This is the Parrot IO UNIX layer. May be changed to
* include other platforms if that platform is similar
@@ -48,8 +48,6 @@
ParrotIO *io, void *buffer, size_t len);
static size_t PIO_unix_write(theINTERP, ParrotIOLayer *layer,
ParrotIO *io, const void *buffer, size_t len);
-static INTVAL PIO_unix_puts(theINTERP, ParrotIOLayer *l, ParrotIO *io,
- const char *s);
static PIOOFF_T PIO_unix_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
PIOOFF_T offset, INTVAL whence);
static PIOOFF_T PIO_unix_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
@@ -122,6 +120,9 @@
INTVAL mode;
INTVAL oflags, type;
PIOHANDLE fd;
+
+ UNUSED(layer);
+
type = PIO_TYPE_FILE;
mode = DEFAULT_OPEN_MODE;
@@ -229,10 +230,12 @@
# ifdef PARROT_HAS_HEADER_FCNTL
INTVAL rflags;
# endif
+
+ UNUSED(layer);
+
mode = 0;
oflags = flags_to_unix(flags);
- UNUSED(oflags)
/* FIXME - Check file handle flags, validity */
# ifdef PARROT_HAS_HEADER_FCNTL
@@ -263,6 +266,9 @@
static INTVAL
PIO_unix_close(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
+ UNUSED(interpreter);
+ UNUSED(layer);
+
if (io->fd >= 0)
close(io->fd);
io->fd = -1;
@@ -317,6 +323,9 @@
static INTVAL
PIO_unix_flush(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
+ UNUSED(interpreter);
+ UNUSED(layer);
+
return fsync(io->fd);
}
@@ -397,10 +406,14 @@
* Hard seek
*/
static PIOOFF_T
-PIO_unix_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
+PIO_unix_seek(theINTERP, ParrotIOLayer *layer, ParrotIO *io,
PIOOFF_T offset, INTVAL whence)
{
PIOOFF_T pos;
+
+ UNUSED(interpreter);
+ UNUSED(layer);
+
if ((pos = lseek(io->fd, offset, whence)) >= 0) {
io->lpos = io->fpos;
io->fpos = pos;
@@ -412,9 +425,13 @@
static PIOOFF_T
-PIO_unix_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io)
+PIO_unix_tell(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
PIOOFF_T pos;
+
+ UNUSED(interpreter);
+ UNUSED(layer);
+
pos = lseek(io->fd, (PIOOFF_T)0, SEEK_CUR);
return pos;
}