Author: petdance
Date: Thu Jun 7 15:32:19 2007
New Revision: 18866
Modified:
trunk/include/parrot/datatypes.h
trunk/include/parrot/mmd.h
trunk/include/parrot/string_funcs.h
trunk/src/datatypes.c
trunk/src/hash.c
trunk/src/list.c
trunk/src/mmd.c
trunk/src/objects.c
trunk/src/pic.c
trunk/src/pmc.c
trunk/src/stacks.c
trunk/src/string.c
trunk/tools/build/headerize.pl
Log:
The headerizer used to remove "const"s that did not need to be in the header.
Unfortunately, MSVC didnt agree and barfed. So I put it back the way it was
before.
Modified: trunk/include/parrot/datatypes.h
==============================================================================
--- trunk/include/parrot/datatypes.h (original)
+++ trunk/include/parrot/datatypes.h Thu Jun 7 15:32:19 2007
@@ -130,9 +130,13 @@
PARROT_API INTVAL Parrot_get_datatype_enum( Interp *interp,
const STRING *typename /*NN*/ )
- __attribute__nonnull__(2);
+ __attribute__nonnull__(2)
+ __attribute__pure__
+ __attribute__warn_unused_result__;
+
+PARROT_API STRING * Parrot_get_datatype_name( Interp *interp, INTVAL type )
+ __attribute__warn_unused_result__;
-PARROT_API STRING * Parrot_get_datatype_name( Interp *interp, INTVAL type );
/* HEADERIZER END: src/datatypes.c */
#endif /* PARROT_DATATYPES_H_GUARD */
Modified: trunk/include/parrot/mmd.h
==============================================================================
--- trunk/include/parrot/mmd.h (original)
+++ trunk/include/parrot/mmd.h Thu Jun 7 15:32:19 2007
@@ -67,7 +67,8 @@
INTVAL left_type,
INTVAL right_type,
int *is_pmc /*NN*/ )
- __attribute__nonnull__(5);
+ __attribute__nonnull__(5)
+ __attribute__warn_unused_result__;
PARROT_API void mmd_add_by_class( Interp *interp,
INTVAL functype,
Modified: trunk/include/parrot/string_funcs.h
==============================================================================
--- trunk/include/parrot/string_funcs.h (original)
+++ trunk/include/parrot/string_funcs.h Thu Jun 7 15:32:19 2007
@@ -151,11 +151,13 @@
PARROT_API STRING * string_from_const_cstring( Interp *interp,
const char *buffer /*NULLOK*/,
- UINTVAL len );
+ const UINTVAL len )
+ __attribute__warn_unused_result__;
PARROT_API STRING * string_from_cstring( Interp *interp,
- const char *buffer /*NULLOK*/,
- UINTVAL len );
+ const char * const buffer /*NULLOK*/,
+ const UINTVAL len )
+ __attribute__warn_unused_result__;
PARROT_API STRING * string_from_int( Interp *interp, INTVAL i );
PARROT_API STRING * string_from_num( Interp *interp, FLOATVAL f );
@@ -284,7 +286,8 @@
STRING *s /*NULLOK*/ );
PARROT_API char * string_to_cstring( Interp *interp,
- const STRING *s /* NULLOK */ );
+ const STRING *s /* NULLOK */ )
+ __attribute__warn_unused_result__;
PARROT_API INTVAL string_to_int( Interp *interp, const STRING *s /*NULLOK*/ );
PARROT_API FLOATVAL string_to_num( Interp *interp,
Modified: trunk/src/datatypes.c
==============================================================================
--- trunk/src/datatypes.c (original)
+++ trunk/src/datatypes.c Thu Jun 7 15:32:19 2007
@@ -30,8 +30,8 @@
PARROT_API
INTVAL
-Parrot_get_datatype_enum(Interp *interp, const STRING * const typename /*NN*/)
-/* PURE, WARN_UNUSED */
+Parrot_get_datatype_enum(Interp *interp, const STRING *typename /*NN*/)
+ /* PURE, WARN_UNUSED */
{
char * const type = string_to_cstring(interp, typename);
int i;
@@ -58,7 +58,7 @@
PARROT_API
STRING *
Parrot_get_datatype_name(Interp *interp, INTVAL type)
-/* WARN_UNUSED */
+ /* WARN_UNUSED */
{
const char * const s =
(type < enum_first_type || type >= enum_last_type)
Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c (original)
+++ trunk/src/hash.c Thu Jun 7 15:32:19 2007
@@ -166,7 +166,7 @@
PARROT_API
void
-parrot_dump_hash(Interp *interp, const Hash * const hash)
+parrot_dump_hash(Interp *interp, const Hash *hash)
{
}
@@ -179,7 +179,7 @@
PARROT_API
void
-parrot_mark_hash(Interp *interp, Hash * const hash /*NN*/)
+parrot_mark_hash(Interp *interp, Hash *hash /*NN*/)
{
UINTVAL found = 0;
int mark_key = 0;
@@ -674,7 +674,7 @@
PARROT_API
void *
-parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC * const key /*NN*/)
+parrot_hash_get_idx(Interp *interp, const Hash *hash, PMC *key /*NN*/)
/* PURE, WARN_UNUSED */
{
INTVAL i = PMC_int_val(key);
Modified: trunk/src/list.c
==============================================================================
--- trunk/src/list.c (original)
+++ trunk/src/list.c Thu Jun 7 15:32:19 2007
@@ -1277,7 +1277,7 @@
PARROT_API
List *
-list_clone(Interp *interp, List * const other /*NN*/)
+list_clone(Interp *interp, List *other /*NN*/)
/* WARN_UNUSED */
{
List *l;
@@ -1421,7 +1421,7 @@
PARROT_API
INTVAL
-list_length(Interp *interp, const List * const list /*NN*/)
+list_length(Interp *interp, const List *list /*NN*/)
/* PURE, WARN_UNUSED */
{
UNUSED(interp);
Modified: trunk/src/mmd.c
==============================================================================
--- trunk/src/mmd.c (original)
+++ trunk/src/mmd.c Thu Jun 7 15:32:19 2007
@@ -99,7 +99,8 @@
PARROT_API
funcptr_t
get_mmd_dispatch_type(Interp *interp, INTVAL func_nr, INTVAL left_type,
- INTVAL right_type, int * const is_pmc /*NN*/ )
+ INTVAL right_type, int *is_pmc /*NN*/ )
+ /* WARN_UNUSED */
{
funcptr_t func, func_;
INTVAL r;
Modified: trunk/src/objects.c
==============================================================================
--- trunk/src/objects.c (original)
+++ trunk/src/objects.c Thu Jun 7 15:32:19 2007
@@ -392,7 +392,7 @@
PARROT_API
INTVAL
-Parrot_MMD_method_idx(Interp *interp, const char * const name)
+Parrot_MMD_method_idx(Interp *interp, const char *name)
/* WARN_UNUSED, PURE */
{
INTVAL i;
Modified: trunk/src/pic.c
==============================================================================
--- trunk/src/pic.c (original)
+++ trunk/src/pic.c Thu Jun 7 15:32:19 2007
@@ -122,7 +122,7 @@
*/
void
-parrot_PIC_alloc_store(Interp *interp, struct PackFile_ByteCode * const cs
/*NN*/, size_t n)
+parrot_PIC_alloc_store(Interp *interp, struct PackFile_ByteCode *cs /*NN*/,
size_t n)
{
size_t size, poly;
Parrot_PIC_store *store;
@@ -149,7 +149,7 @@
}
void
-parrot_PIC_destroy(Interp *interp, struct PackFile_ByteCode * const cs /*NN*/)
+parrot_PIC_destroy(Interp *interp, struct PackFile_ByteCode *cs /*NN*/)
{
Parrot_PIC_store *store;
@@ -358,8 +358,8 @@
* the type PARROT_ARG_CONSTANT stands for mixed types or constants
*/
int
-parrot_pic_check_sig(Interp *interp, const PMC * const sig1 /*NN*/,
- const PMC * const sig2 /*NN*/, int * const type /*NN*/)
+parrot_pic_check_sig(Interp *interp, const PMC *sig1 /*NN*/,
+ const PMC *sig2 /*NN*/, int *type /*NN*/)
{
int i, n, t0, t1, t2;
t0 = 0; /* silence compiler uninit warning */
@@ -631,8 +631,8 @@
}
void
-parrot_pic_find_infix_v_pp(Interp *interp, PMC * const left /*NN*/, PMC *
const right /*NN*/,
- Parrot_MIC * const mic /*NN*/, opcode_t * const cur_opcode
/*NN*/)
+parrot_pic_find_infix_v_pp(Interp *interp, PMC *left /*NN*/, PMC *right /*NN*/,
+ Parrot_MIC *mic /*NN*/, opcode_t *cur_opcode /*NN*/)
{
funcptr_t func;
int is_pmc;
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c (original)
+++ trunk/src/pmc.c Thu Jun 7 15:32:19 2007
@@ -365,7 +365,7 @@
PARROT_API
INTVAL
-pmc_type(Interp* interp, STRING * const name)
+pmc_type(Interp* interp, STRING *name)
/* PURE, WARN_UNUSED */
{
PMC * const classname_hash = interp->class_hash;
@@ -381,14 +381,14 @@
/*
-FUNCDOC: pmc_type
+FUNCDOC: pmc_type_p
Returns the PMC type for C<name>.
*/
PARROT_API
INTVAL
-pmc_type_p(Interp* interp, PMC * const name)
+pmc_type_p(Interp* interp, PMC *name)
{
PMC * const classname_hash = interp->class_hash;
PMC * const item = (PMC *)VTABLE_get_pointer_keyed(interp, classname_hash,
name);
Modified: trunk/src/stacks.c
==============================================================================
--- trunk/src/stacks.c (original)
+++ trunk/src/stacks.c Thu Jun 7 15:32:19 2007
@@ -378,7 +378,7 @@
PARROT_API
Stack_entry_type
-get_entry_type(Interp *interp, const Stack_Entry_t * const entry /*NN*/)
+get_entry_type(Interp *interp, const Stack_Entry_t *entry /*NN*/)
/* PURE, WARN_UNUSED */
{
return entry->entry_type;
Modified: trunk/src/string.c
==============================================================================
--- trunk/src/string.c (original)
+++ trunk/src/string.c Thu Jun 7 15:32:19 2007
@@ -490,6 +490,7 @@
STRING *
string_from_cstring(Interp *interp,
const char * const buffer /*NULLOK*/, const UINTVAL len)
+ /* WARN_UNUSED */
{
return string_make_direct(interp, buffer, len ? len :
buffer ? strlen(buffer) : 0,
@@ -509,7 +510,8 @@
PARROT_API
STRING *
string_from_const_cstring(Interp *interp,
- const char * const buffer /*NULLOK*/, const UINTVAL len)
+ const char *buffer /*NULLOK*/, const UINTVAL len)
+ /* WARN_UNUSED */
{
return string_make_direct(interp, buffer, len ? len :
buffer ? strlen(buffer) : 0,
@@ -1236,7 +1238,7 @@
PARROT_API
INTVAL
-string_compare(Interp *interp, const STRING * const s1 /*NULLOK*/, const
STRING * const s2 /*NULLOK*/)
+string_compare(Interp *interp, const STRING *s1 /*NULLOK*/, const STRING *s2
/*NULLOK*/)
/* PURE, WARN_UNUSED */
{
if (!s1 && !s2) {
@@ -1269,7 +1271,7 @@
PARROT_API
INTVAL
-string_equal(Interp *interp, const STRING * const s1 /*NULLOK*/, const STRING
* const s2 /*NULLOK*/)
+string_equal(Interp *interp, const STRING *s1 /*NULLOK*/, const STRING *s2
/*NULLOK*/)
/* PURE, WARN_UNUSED */
{
if ((s1 == s2) || (!s1 && !s2)) {
@@ -1903,7 +1905,8 @@
PARROT_API
char *
-string_to_cstring(Interp *interp, const STRING * const s /* NULLOK */)
+string_to_cstring(Interp *interp, const STRING *s /* NULLOK */)
+ /* WARN_UNUSED */
{
char *p;
/*
Modified: trunk/tools/build/headerize.pl
==============================================================================
--- trunk/tools/build/headerize.pl (original)
+++ trunk/tools/build/headerize.pl Thu Jun 7 15:32:19 2007
@@ -153,12 +153,6 @@
for (@parms) {
/\S+\s+\S+/ || ( $_ eq '...' ) || ( $_ eq 'void' ) || /theINTERP/
or die "Bad parms in $proto";
- if ( m{(?<!/)\*} ) { # Pointers?
- s/\*\s*const\s+/*/;
- }
- else {
- s/^const\s+//;
- }
}
my $static;