Skip to content

Commit

Permalink
more funcation annotations
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.parrot.org/parrot/trunk@45501 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information
petdance committed Apr 10, 2010
1 parent 2b24e3d commit b69d1a3
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 65 deletions.
75 changes: 46 additions & 29 deletions include/parrot/io.h
@@ -1,5 +1,5 @@
/* io.h
* Copyright (C) 2001-2003, Parrot Foundation.
* Copyright (C) 2001-2010, Parrot Foundation.
* SVN Info
* $Id$
* Overview:
Expand Down Expand Up @@ -584,24 +584,29 @@ void Parrot_io_flush_filehandle(PARROT_INTERP, ARGMOD(PMC *pmc))
FUNC_MODIFIES(*pmc);

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
unsigned char * Parrot_io_get_buffer_end(SHIM_INTERP,
ARGIN_NULLOK(PMC *filehandle));
ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_CAN_RETURN_NULL
unsigned char * Parrot_io_get_buffer_next(SHIM_INTERP,
ARGIN(PMC *filehandle))
ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
unsigned char * Parrot_io_get_buffer_start(SHIM_INTERP,
ARGIN(PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
PIOOFF_T Parrot_io_get_file_position(SHIM_INTERP, ARGIN(PMC *filehandle))
PARROT_WARN_UNUSED_RESULT
PIOOFF_T Parrot_io_get_file_position(SHIM_INTERP,
ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
Expand All @@ -613,24 +618,26 @@ INTVAL Parrot_io_get_flags(SHIM_INTERP, ARGIN(PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PIOOFF_T Parrot_io_get_last_file_position(SHIM_INTERP,
ARGIN(PMC *filehandle))
ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
PIOHANDLE Parrot_io_get_os_handle(SHIM_INTERP, ARGIN(PMC *filehandle))
PARROT_WARN_UNUSED_RESULT
PIOHANDLE Parrot_io_get_os_handle(SHIM_INTERP, ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_EXPORT
INTVAL Parrot_io_is_closed_filehandle(PARROT_INTERP, ARGMOD(PMC *pmc))
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_io_is_closed_filehandle(PARROT_INTERP, ARGIN(const PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
FUNC_MODIFIES(*pmc);
__attribute__nonnull__(2);

PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
INTVAL Parrot_io_is_encoding(PARROT_INTERP,
ARGIN(PMC *filehandle),
ARGIN(const PMC *filehandle),
ARGIN(STRING *value))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
Expand All @@ -644,9 +651,10 @@ INTVAL Parrot_io_parse_open_flags(PARROT_INTERP,

PARROT_EXPORT
void Parrot_io_set_file_position(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
PIOOFF_T file_pos)
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

PARROT_EXPORT
void Parrot_io_set_file_size(SHIM_INTERP,
Expand All @@ -660,21 +668,24 @@ void Parrot_io_set_flags(SHIM_INTERP, ARGIN(PMC *filehandle), INTVAL flags)

PARROT_EXPORT
void Parrot_io_set_os_handle(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
PIOHANDLE file_descriptor)
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

PARROT_CAN_RETURN_NULL
void Parrot_io_clear_buffer(PARROT_INTERP, ARGIN(PMC *filehandle))
void Parrot_io_clear_buffer(PARROT_INTERP, ARGMOD(PMC *filehandle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

PARROT_CAN_RETURN_NULL
INTVAL Parrot_io_get_buffer_flags(SHIM_INTERP, ARGIN(PMC *filehandle))
INTVAL Parrot_io_get_buffer_flags(SHIM_INTERP, ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_CAN_RETURN_NULL
size_t Parrot_io_get_buffer_size(SHIM_INTERP, ARGIN(PMC *filehandle))
PARROT_WARN_UNUSED_RESULT
size_t Parrot_io_get_buffer_size(SHIM_INTERP, ARGIN(const PMC *filehandle))
__attribute__nonnull__(2);

PARROT_WARN_UNUSED_RESULT
Expand All @@ -687,37 +698,43 @@ STRING * Parrot_io_make_string(PARROT_INTERP,
FUNC_MODIFIES(*buf);

void Parrot_io_set_buffer_end(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
ARGIN_NULLOK(unsigned char *new_end))
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

void Parrot_io_set_buffer_flags(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
INTVAL new_flags)
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

void Parrot_io_set_buffer_next(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
ARGIN_NULLOK(unsigned char *new_next))
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

void Parrot_io_set_buffer_size(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
size_t new_size)
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

void Parrot_io_set_buffer_start(SHIM_INTERP,
ARGIN(PMC *filehandle),
ARGMOD(PMC *filehandle),
ARGIN_NULLOK(unsigned char *new_start))
__attribute__nonnull__(2);
__attribute__nonnull__(2)
FUNC_MODIFIES(*filehandle);

#define ASSERT_ARGS_Parrot_io_close_filehandle __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_io_flush_filehandle __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
#define ASSERT_ARGS_Parrot_io_get_buffer_end __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_io_get_buffer_end __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(filehandle))
#define ASSERT_ARGS_Parrot_io_get_buffer_next __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(filehandle))
#define ASSERT_ARGS_Parrot_io_get_buffer_start __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
Expand Down
2 changes: 1 addition & 1 deletion include/parrot/io_unix.h
Expand Up @@ -55,7 +55,7 @@ INTVAL Parrot_io_getblksize_unix(PIOHANDLE fd);
INTVAL Parrot_io_init_unix(PARROT_INTERP)
__attribute__nonnull__(1);

INTVAL Parrot_io_is_closed_unix(PARROT_INTERP, ARGIN(PMC *filehandle))
INTVAL Parrot_io_is_closed_unix(PARROT_INTERP, ARGIN(const PMC *filehandle))
__attribute__nonnull__(1)
__attribute__nonnull__(2);

Expand Down
3 changes: 1 addition & 2 deletions src/io/api.c
Expand Up @@ -179,9 +179,8 @@ Parrot_io_fdopen(PARROT_INTERP, ARGIN_NULLOK(PMC *pmc), PIOHANDLE fd,
{
ASSERT_ARGS(Parrot_io_fdopen)
PMC *new_filehandle;
INTVAL flags;
const INTVAL flags = Parrot_io_parse_open_flags(interp, sflags);

flags = Parrot_io_parse_open_flags(interp, sflags);
if (!flags)
return PMCNULL;

Expand Down

0 comments on commit b69d1a3

Please sign in to comment.