Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

added splint annotations and re-headerized

  • Loading branch information...
commit 4cd9ae70424870bf4e0d425fe6e60dbcba0c9e8e 1 parent 0c08c8a
@petdance petdance authored
View
17 compilers/imcc/api.c
@@ -33,6 +33,8 @@ IMCC call-in routines for use with the Parrot embedding API
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
static PMC * get_compreg_pmc(PARROT_INTERP, int is_pasm, int add_compreg)
__attribute__nonnull__(1);
@@ -84,8 +86,7 @@ is 1, register that compiler with Parrot under the name "PIR".
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
Parrot_Int
-imcc_get_pir_compreg_api(Parrot_PMC interp_pmc, int add_compreg,
- Parrot_PMC *compiler)
+imcc_get_pir_compreg_api(Parrot_PMC interp_pmc, int add_compreg, ARGOUT(Parrot_PMC *compiler))
{
ASSERT_ARGS(imcc_get_pir_compreg_api)
IMCC_API_CALLIN(interp_pmc, interp)
@@ -109,10 +110,8 @@ is 1, register that compiler with Parrot under the name "PASM".
*/
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
Parrot_Int
-imcc_get_pasm_compreg_api(Parrot_PMC interp_pmc, int add_compreg,
- Parrot_PMC *compiler)
+imcc_get_pasm_compreg_api(Parrot_PMC interp_pmc, int add_compreg, ARGOUT(Parrot_PMC *compiler))
{
ASSERT_ARGS(imcc_get_pasm_compreg_api)
IMCC_API_CALLIN(interp_pmc, interp)
@@ -134,6 +133,8 @@ C<add_compreg> is 1.
=cut
*/
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
static PMC *
get_compreg_pmc(PARROT_INTERP, int is_pasm, int add_compreg)
{
@@ -158,10 +159,10 @@ Compile a file using the given IMCCompiler PMC.
*/
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
Parrot_Int
imcc_compile_file_api(Parrot_PMC interp_pmc, Parrot_PMC compiler,
- Parrot_String file, Parrot_PMC *pbc)
+ Parrot_String file, ARGOUT(Parrot_PMC *pbc))
{
ASSERT_ARGS(imcc_compile_file_api)
IMCC_API_CALLIN(interp_pmc, interp)
@@ -188,7 +189,7 @@ the preprocessed text is dumped directly to stdout.
*/
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
Parrot_Int
imcc_preprocess_file_api(Parrot_PMC interp_pmc, Parrot_PMC compiler,
Parrot_String file)
View
30 compilers/imcc/main.c
@@ -74,6 +74,8 @@ static yyscan_t imcc_get_scanner(ARGMOD(imc_info_t *imcc))
__attribute__nonnull__(1)
FUNC_MODIFIES(*imcc);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static PMC * imcc_run_compilation_internal(
ARGMOD(imc_info_t *imcc),
ARGIN(STRING *source),
@@ -83,6 +85,8 @@ static PMC * imcc_run_compilation_internal(
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static PMC * imcc_run_compilation_reentrant(
ARGMOD(imc_info_t *imcc),
ARGIN(STRING *fullname),
@@ -94,9 +98,8 @@ static PMC * imcc_run_compilation_reentrant(
PARROT_CAN_RETURN_NULL
static struct _imc_info_t* prepare_reentrant_compile(
- ARGMOD(imc_info_t * imcc))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(* imcc);
+ ARGIN(imc_info_t *imcc))
+ __attribute__nonnull__(1);
#define ASSERT_ARGS_do_pre_process __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
@@ -513,6 +516,8 @@ may be a recursive compilation inside an existing compilation sequence.
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static PMC *
imcc_run_compilation_reentrant(ARGMOD(imc_info_t *imcc), ARGIN(STRING *fullname),
int is_file, int is_pasm)
@@ -539,6 +544,8 @@ All compilations go through this function.
*/
+PARROT_WARN_UNUSED_RESULT
+PARROT_CAN_RETURN_NULL
static PMC *
imcc_run_compilation_internal(ARGMOD(imc_info_t *imcc), ARGIN(STRING *source),
int is_file, int is_pasm)
@@ -593,15 +600,15 @@ imcc_run_compilation_internal(ARGMOD(imc_info_t *imcc), ARGIN(STRING *source),
/*
-=item C<static struct _imc_info_t* prepare_reentrant_compile(imc_info_t * imcc)>
+=item C<static struct _imc_info_t* prepare_reentrant_compile(imc_info_t *imcc)>
Prepare IMCC for a reentrant compile. Push a new imc_info_t structure onto the
list and set the new one as the current one. Return the new info structure.
returns NULL if not in a reentrant situation. The return value of this I<MUST>
be passed to C<exit_reentrant_compile>.
-=item C<imc_info_t * exit_reentrant_compile(imc_info_t * imcc, struct
-_imc_info_t *new_info)>
+=item C<imc_info_t * exit_reentrant_compile(imc_info_t *imcc, struct _imc_info_t
+*new_info)>
Exit reentrant compile. Restore compiler state back to what it was for the
previous compile, if any.
@@ -610,10 +617,10 @@ previous compile, if any.
PARROT_CAN_RETURN_NULL
static struct _imc_info_t*
-prepare_reentrant_compile(ARGMOD(imc_info_t * imcc))
+prepare_reentrant_compile(ARGIN(imc_info_t *imcc))
{
ASSERT_ARGS(prepare_reentrant_compile)
- struct _imc_info_t * new_info = imcc;
+ struct _imc_info_t *new_info = imcc;
if (imcc->last_unit) {
/* a reentrant compile */
new_info = (imc_info_t*) calloc(1, sizeof (imc_info_t));
@@ -627,9 +634,10 @@ prepare_reentrant_compile(ARGMOD(imc_info_t * imcc))
return new_info;
}
+PARROT_IGNORABLE_RESULT
+PARROT_CANNOT_RETURN_NULL
imc_info_t *
-exit_reentrant_compile(ARGMOD(imc_info_t * imcc),
- ARGMOD_NULLOK(struct _imc_info_t *new_info))
+exit_reentrant_compile(ARGIN(imc_info_t *imcc), ARGMOD_NULLOK(struct _imc_info_t *new_info))
{
ASSERT_ARGS(exit_reentrant_compile)
if (new_info && new_info->prev == imcc) {
@@ -654,7 +662,7 @@ Deallocate memory associated with IMCC.
*/
void
-imcc_destroy(ARGMOD(imc_info_t * imcc))
+imcc_destroy(ARGFREE(imc_info_t * imcc))
{
ASSERT_ARGS(imcc_destroy)
Hash * const macros = imcc->macros;
View
26 include/imcc/api.h
@@ -11,37 +11,45 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
Parrot_Int imcc_compile_file_api(
Parrot_PMC interp_pmc,
Parrot_PMC compiler,
Parrot_String file,
- Parrot_PMC *pbc);
+ ARGOUT(Parrot_PMC *pbc))
+ __attribute__nonnull__(4)
+ FUNC_MODIFIES(*pbc);
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
Parrot_Int imcc_get_pasm_compreg_api(
Parrot_PMC interp_pmc,
int add_compreg,
- Parrot_PMC *compiler);
+ ARGOUT(Parrot_PMC *compiler))
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*compiler);
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
Parrot_Int imcc_get_pir_compreg_api(
Parrot_PMC interp_pmc,
int add_compreg,
- Parrot_PMC *compiler);
+ ARGOUT(Parrot_PMC *compiler))
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*compiler);
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
Parrot_Int imcc_preprocess_file_api(
Parrot_PMC interp_pmc,
Parrot_PMC compiler,
Parrot_String file);
-#define ASSERT_ARGS_imcc_compile_file_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_imcc_get_pasm_compreg_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
-#define ASSERT_ARGS_imcc_get_pir_compreg_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_imcc_compile_file_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pbc))
+#define ASSERT_ARGS_imcc_get_pasm_compreg_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(compiler))
+#define ASSERT_ARGS_imcc_get_pir_compreg_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(compiler))
#define ASSERT_ARGS_imcc_preprocess_file_api __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: compilers/imcc/api.c */
View
13 include/imcc/embed.h
@@ -77,11 +77,12 @@ void imcc_set_verbosity(ARGMOD(imc_info_t *imcc), INTVAL verbose)
__attribute__nonnull__(1)
FUNC_MODIFIES(*imcc);
+PARROT_IGNORABLE_RESULT
+PARROT_CANNOT_RETURN_NULL
imc_info_t * exit_reentrant_compile(
- ARGMOD(imc_info_t * imcc),
+ ARGIN(imc_info_t *imcc),
ARGMOD_NULLOK(struct _imc_info_t *new_info))
__attribute__nonnull__(1)
- FUNC_MODIFIES(* imcc)
FUNC_MODIFIES(*new_info);
PARROT_CANNOT_RETURN_NULL
@@ -93,10 +94,7 @@ PMC * imcc_compile_string(
__attribute__nonnull__(2)
FUNC_MODIFIES(*imcc);
-void imcc_destroy(ARGMOD(imc_info_t * imcc))
- __attribute__nonnull__(1)
- FUNC_MODIFIES(* imcc);
-
+void imcc_destroy(ARGFREE(imc_info_t * imcc));
#define ASSERT_ARGS_imcc_compile_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(fullname))
@@ -123,8 +121,7 @@ void imcc_destroy(ARGMOD(imc_info_t * imcc))
#define ASSERT_ARGS_imcc_compile_string __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(imcc) \
, PARROT_ASSERT_ARG(source))
-#define ASSERT_ARGS_imcc_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(imcc))
+#define ASSERT_ARGS_imcc_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: compilers/imcc/main.c */
View
1  include/parrot/interpreter.h
@@ -485,6 +485,7 @@ PMC * Parrot_get_compiler(PARROT_INTERP, ARGIN(STRING *type))
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
Interp * Parrot_int_get_interp_from_pmc(ARGIN(PMC * interp_pmc))
__attribute__nonnull__(1);
View
9 include/parrot/packfile.h
@@ -773,8 +773,10 @@ void Parrot_pf_execute_bytecode_program(PARROT_INTERP,
FUNC_MODIFIES(*args);
PARROT_EXPORT
-PMC * Parrot_pf_get_packfile_pmc(PARROT_INTERP, PackFile * pf)
- __attribute__nonnull__(1);
+PARROT_CANNOT_RETURN_NULL
+PMC * Parrot_pf_get_packfile_pmc(PARROT_INTERP, ARGIN(PackFile *pf))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
PARROT_EXPORT
void Parrot_pf_set_current_packfile(PARROT_INTERP,
@@ -969,7 +971,8 @@ void Parrot_pf_mark_packfile(PARROT_INTERP, ARGMOD(PackFile * pf))
, PARROT_ASSERT_ARG(pf) \
, PARROT_ASSERT_ARG(args))
#define ASSERT_ARGS_Parrot_pf_get_packfile_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pf))
#define ASSERT_ARGS_Parrot_pf_set_current_packfile \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
View
1  src/interp/inter_misc.c
@@ -447,6 +447,7 @@ Do not use with any other type of PMC.
*/
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
Interp *
Parrot_int_get_interp_from_pmc(ARGIN(PMC * interp_pmc))
{
View
21 src/packfile/api.c
@@ -243,8 +243,11 @@ static void mark_1_ct_seg(PARROT_INTERP, ARGMOD(PackFile_ConstTable *ct))
__attribute__nonnull__(2)
FUNC_MODIFIES(*ct);
-static void mark_packfile_pmc(PARROT_INTERP, PMC * ptr_pmc, void * ptr_raw)
- __attribute__nonnull__(1);
+static void mark_packfile_pmc(PARROT_INTERP,
+ SHIM(PMC *ptr_pmc),
+ ARGIN(void *ptr_raw))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3);
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
@@ -434,7 +437,8 @@ static int sub_pragma(PARROT_INTERP,
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ct))
#define ASSERT_ARGS_mark_packfile_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ptr_raw))
#define ASSERT_ARGS_PackFile_append __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_PackFile_Constant_unpack_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -1427,7 +1431,7 @@ PackFile_new(PARROT_INTERP, INTVAL is_mapped)
/*
-=item C<PMC * Parrot_pf_get_packfile_pmc(PARROT_INTERP, PackFile * pf)>
+=item C<PMC * Parrot_pf_get_packfile_pmc(PARROT_INTERP, PackFile *pf)>
Get a new PMC to hold the PackFile* structure. The exact type of PMC returned
is not important, and consuming code should not rely on any particular type
@@ -1436,8 +1440,8 @@ being returned. The only guarantees which are made by this interface are that:
1) The PackFile* structure can be retrieved by VTABLE_get_pointer
2) The PackFile* structure is marked for GC when the PMC is marked for GC
-=item C<static void mark_packfile_pmc(PARROT_INTERP, PMC * ptr_pmc, void *
-ptr_raw)>
+=item C<static void mark_packfile_pmc(PARROT_INTERP, PMC *ptr_pmc, void
+*ptr_raw)>
Mark the PackFile PMC for GC
@@ -1446,8 +1450,9 @@ Mark the PackFile PMC for GC
*/
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
PMC *
-Parrot_pf_get_packfile_pmc(PARROT_INTERP, PackFile * pf)
+Parrot_pf_get_packfile_pmc(PARROT_INTERP, ARGIN(PackFile *pf))
{
ASSERT_ARGS(Parrot_pf_get_packfile_pmc)
PMC * const ptr = Parrot_pmc_new(interp, enum_class_PtrObj);
@@ -1461,7 +1466,7 @@ Parrot_pf_get_packfile_pmc(PARROT_INTERP, PackFile * pf)
}
static void
-mark_packfile_pmc(PARROT_INTERP, PMC * ptr_pmc, void * ptr_raw)
+mark_packfile_pmc(PARROT_INTERP, SHIM(PMC *ptr_pmc), ARGIN(void *ptr_raw))
{
ASSERT_ARGS(mark_packfile_pmc)
PackFile * const pf = (PackFile*) ptr_raw;
Please sign in to comment.
Something went wrong with that request. Please try again.