Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cage] shim unused arguments in src/io/*.c
silence c++ compiler warnings
  • Loading branch information
Reini Urban committed Mar 6, 2014
1 parent 4a1d5b2 commit cd859f3
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 74 deletions.
4 changes: 2 additions & 2 deletions src/io/io_private.h
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2008, Parrot Foundation.
Copyright (C) 2001-2014, Parrot Foundation.
=head1 NAME
Expand Down Expand Up @@ -165,7 +165,7 @@ struct _ParrotIOData {

/* Get an editable version of the IO_VTABLE structure, typically used during
vtable initialization. */
#define IO_EDITABLE_IO_VTABLE(i, idx) ((IO_VTABLE *)(void *)(&((i)->piodata->vtables[(idx)])))
#define IO_EDITABLE_IO_VTABLE(i, idx) (IO_VTABLE *)(&((i)->piodata->vtables[(idx)]))


/* HEADERIZER BEGIN: src/io/utilities.c */
Expand Down
46 changes: 17 additions & 29 deletions src/io/pipe.c
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2012, Parrot Foundation.
Copyright (C) 2001-2014, Parrot Foundation.
=head1 NAME
Expand Down Expand Up @@ -29,7 +29,6 @@ This file implements the IO_VTABLE for pipes and helper functions.
static void io_pipe_adv_position(PARROT_INTERP,
ARGMOD(PMC *handle),
size_t offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand All @@ -51,15 +50,13 @@ static const STR_VTABLE * io_pipe_get_encoding(PARROT_INTERP,
__attribute__nonnull__(2);

static INTVAL io_pipe_get_flags(PARROT_INTERP, ARGIN(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static PIOHANDLE io_pipe_get_piohandle(PARROT_INTERP, ARGIN(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static PIOOFF_T io_pipe_get_position(PARROT_INTERP, ARGMOD(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand Down Expand Up @@ -105,20 +102,17 @@ static PIOOFF_T io_pipe_seek(PARROT_INTERP,
static void io_pipe_set_eof(PARROT_INTERP,
ARGMOD(PMC *handle),
INTVAL is_set)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

static void io_pipe_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static void io_pipe_set_position(PARROT_INTERP,
ARGMOD(PMC *handle),
PIOOFF_T pos)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand All @@ -128,7 +122,6 @@ static PIOOFF_T io_pipe_tell(PARROT_INTERP, ARGMOD(PMC *handle))
FUNC_MODIFIES(*handle);

static size_t io_pipe_total_size(PARROT_INTERP, ARGIN(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static INTVAL io_pipe_write_b(PARROT_INTERP,
Expand All @@ -141,8 +134,7 @@ static INTVAL io_pipe_write_b(PARROT_INTERP,
FUNC_MODIFIES(*handle);

#define ASSERT_ARGS_io_pipe_adv_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_close __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
Expand All @@ -153,14 +145,12 @@ static INTVAL io_pipe_write_b(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_get_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_get_piohandle __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_get_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_is_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
Expand All @@ -180,20 +170,16 @@ static INTVAL io_pipe_write_b(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_set_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_set_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_tell __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_total_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_pipe_write_b __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle) \
Expand Down Expand Up @@ -332,7 +318,7 @@ io_pipe_is_eof(PARROT_INTERP, ARGMOD(PMC *handle))
}

static void
io_pipe_set_eof(PARROT_INTERP, ARGMOD(PMC *handle), INTVAL is_set)
io_pipe_set_eof(SHIM_INTERP, ARGMOD(PMC *handle), INTVAL is_set)
{
ASSERT_ARGS(io_pipe_set_eof)
if (is_set)
Expand Down Expand Up @@ -394,7 +380,7 @@ Pipes don't keep track of position. Ignore.
*/

static void
io_pipe_adv_position(PARROT_INTERP, ARGMOD(PMC *handle), size_t offset)
io_pipe_adv_position(SHIM_INTERP, ARGMOD(PMC *handle), size_t offset)
{
ASSERT_ARGS(io_pipe_adv_position)
UNUSED(handle);
Expand All @@ -414,7 +400,7 @@ Pipes don't keep track of position. Ignore.
*/

static void
io_pipe_set_position(PARROT_INTERP, ARGMOD(PMC *handle), PIOOFF_T pos)
io_pipe_set_position(SHIM_INTERP, ARGMOD(PMC *handle), PIOOFF_T pos)
{
ASSERT_ARGS(io_pipe_set_position)
UNUSED(handle);
Expand All @@ -433,9 +419,10 @@ Pipes don't keep track of position. Return 0.
*/

static PIOOFF_T
io_pipe_get_position(PARROT_INTERP, ARGMOD(PMC *handle))
io_pipe_get_position(SHIM_INTERP, ARGMOD(PMC *handle))
{
ASSERT_ARGS(io_pipe_get_position)
UNUSED(handle);
/* Pipes don't keep track of file position internally. Return 0 */
return (PIOOFF_T)0;
}
Expand Down Expand Up @@ -577,7 +564,7 @@ Set flags on the Pipe.
*/

static void
io_pipe_set_flags(PARROT_INTERP, ARGIN(PMC *handle), INTVAL flags)
io_pipe_set_flags(SHIM_INTERP, ARGIN(PMC *handle), INTVAL flags)
{
ASSERT_ARGS(io_pipe_set_flags)
PARROT_FILEHANDLE(handle)->flags = flags;
Expand All @@ -594,7 +581,7 @@ Get the flags from the pipe.
*/

static INTVAL
io_pipe_get_flags(PARROT_INTERP, ARGIN(PMC *handle))
io_pipe_get_flags(SHIM_INTERP, ARGIN(PMC *handle))
{
ASSERT_ARGS(io_pipe_get_flags)
return PARROT_FILEHANDLE(handle)->flags;
Expand All @@ -611,9 +598,10 @@ Pipes have an unknown total size.
*/

static size_t
io_pipe_total_size(PARROT_INTERP, ARGIN(PMC *handle))
io_pipe_total_size(SHIM_INTERP, ARGIN(PMC *handle))
{
ASSERT_ARGS(io_pipe_total_size)
UNUSED(handle);
return PIO_UNKNOWN_SIZE;
}

Expand Down
45 changes: 19 additions & 26 deletions src/io/socket.c
@@ -1,5 +1,5 @@
/*
Copyright (C) 2001-2011, Parrot Foundation.
Copyright (C) 2001-2014, Parrot Foundation.
=head1 NAME
Expand Down Expand Up @@ -33,7 +33,6 @@ This file implements the Socket IO_VTABLE and some helper routines.
static void io_socket_adv_position(PARROT_INTERP,
ARGMOD(PMC *handle),
size_t offset)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand All @@ -43,7 +42,6 @@ static INTVAL io_socket_close(PARROT_INTERP, ARGMOD(PMC *handle))
FUNC_MODIFIES(*handle);

static INTVAL io_socket_flush(PARROT_INTERP, ARGMOD(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand All @@ -55,15 +53,13 @@ static const STR_VTABLE * io_socket_get_encoding(PARROT_INTERP,
__attribute__nonnull__(2);

static INTVAL io_socket_get_flags(PARROT_INTERP, ARGIN(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static PIOHANDLE io_socket_get_piohandle(PARROT_INTERP, ARGIN(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static PIOOFF_T io_socket_get_position(PARROT_INTERP, ARGMOD(PMC *handle))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand Down Expand Up @@ -116,13 +112,11 @@ static void io_socket_set_eof(PARROT_INTERP,
static void io_socket_set_flags(PARROT_INTERP,
ARGIN(PMC *handle),
INTVAL flags)
__attribute__nonnull__(1)
__attribute__nonnull__(2);

static void io_socket_set_position(PARROT_INTERP,
ARGMOD(PMC *handle),
PIOOFF_T pos)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*handle);

Expand All @@ -145,26 +139,22 @@ static INTVAL io_socket_write_b(PARROT_INTERP,
FUNC_MODIFIES(*handle);

#define ASSERT_ARGS_io_socket_adv_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_close __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_flush __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_get_encoding __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_get_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_get_piohandle __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_get_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_is_eof __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
Expand All @@ -187,11 +177,9 @@ static INTVAL io_socket_write_b(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_set_flags __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_set_position __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
PARROT_ASSERT_ARG(handle))
#define ASSERT_ARGS_io_socket_tell __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(handle))
Expand Down Expand Up @@ -297,9 +285,10 @@ Flush the socket. Currently this does nothing.
*/

static INTVAL
io_socket_flush(PARROT_INTERP, ARGMOD(PMC *handle))
io_socket_flush(SHIM_INTERP, ARGMOD(PMC *handle))
{
ASSERT_ARGS(io_socket_flush)
UNUSED(handle)
/* TODO: Do we need to fsync the socket? */
return 0;
}
Expand Down Expand Up @@ -399,7 +388,7 @@ Do nothing. Sockets don't keep track of position.
*/

static void
io_socket_adv_position(PARROT_INTERP, ARGMOD(PMC *handle), size_t offset)
io_socket_adv_position(SHIM_INTERP, ARGMOD(PMC *handle), size_t offset)
{
ASSERT_ARGS(io_socket_adv_position)
UNUSED(handle)
Expand All @@ -408,7 +397,7 @@ io_socket_adv_position(PARROT_INTERP, ARGMOD(PMC *handle), size_t offset)
}

static void
io_socket_set_position(PARROT_INTERP, ARGMOD(PMC *handle), PIOOFF_T pos)
io_socket_set_position(SHIM_INTERP, ARGMOD(PMC *handle), PIOOFF_T pos)
{
ASSERT_ARGS(io_socket_set_position)
UNUSED(handle)
Expand All @@ -417,9 +406,10 @@ io_socket_set_position(PARROT_INTERP, ARGMOD(PMC *handle), PIOOFF_T pos)
}

static PIOOFF_T
io_socket_get_position(PARROT_INTERP, ARGMOD(PMC *handle))
io_socket_get_position(SHIM_INTERP, ARGMOD(PMC *handle))
{
ASSERT_ARGS(io_socket_get_position)
UNUSED(handle)
/* Socket doesn't keep track of position internally. Return 0 */
return (PIOOFF_T)0;
}
Expand All @@ -441,9 +431,10 @@ io_socket_open(PARROT_INTERP, ARGMOD(PMC *handle), ARGIN(STRING *path),
{
ASSERT_ARGS(io_socket_open)
PIOHANDLE os_handle;
GETATTR_Socket_os_handle(interp, handle, os_handle);
UNUSED(path);
UNUSED(flags);
UNUSED(mode);
GETATTR_Socket_os_handle(interp, handle, os_handle);
return Parrot_io_internal_flush(interp, os_handle);
}

Expand Down Expand Up @@ -506,17 +497,19 @@ Return C<PIO_F_WRITE | PIO_F_READ>. Sockets are always flagged r/w.
*/

static void
io_socket_set_flags(PARROT_INTERP, ARGIN(PMC *handle), INTVAL flags)
io_socket_set_flags(SHIM_INTERP, ARGIN(PMC *handle), INTVAL flags)
{
ASSERT_ARGS(io_socket_set_flags)
UNUSED(handle)
UNUSED(flags)
/* Ignore, for now */
}

static INTVAL
io_socket_get_flags(PARROT_INTERP, ARGIN(PMC *handle))
io_socket_get_flags(SHIM_INTERP, ARGIN(PMC *handle))
{
ASSERT_ARGS(io_socket_get_flags)
UNUSED(handle)
/* For now, just say that all sockets are read/write handles */
return PIO_F_WRITE | PIO_F_READ;
}
Expand Down

0 comments on commit cd859f3

Please sign in to comment.