diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index ca9145fffe..df6f33f436 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,3 +1,21 @@ +2002-09-19 John David Anglin + + * cp-demangle.c (demangling_new): Cast 0 to enum. + (demangle_char): Cast return of strdup to char *. + (is_gnu_v3_mangled_ctor): Cast 0 to enum. + (is_gnu_v3_mangled_dtor): Likewise. + * cplus-dem.c (grow_vect): Cast return of xrealloc to void *. + (work_stuff_copy_to_from): Cast return of xmalloc to char **. + * fibheap.c (fibnode_new): Cast return of xcalloc to fibnode_t. + * md5.c (md5_process_bytes): Cast results back to const void *. + (md5_process_block): Add cast to const md5_uint32 *. + * regex.c (re_compile_fastmap): Cast enum to UCHAR_T. + * safe-ctype.c (L, XL, U, XU, D, P, _, C, Z, M, V, T, S): Add cast to + unsigned short. + * splay-tree.c (splay_tree_xmalloc_allocate): Cast return of xmalloc + to void *. + * vasprintf.c (int_vasprintf): Cast return of malloc to char *. + 2002-09-19 Nick Clifton * README: Update email addresses for bugs and patches. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index eece533e07..9adf5fd050 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -835,8 +835,8 @@ demangling_new (name, style) return NULL; } dm->style = style; - dm->is_constructor = 0; - dm->is_destructor = 0; + dm->is_constructor = (enum gnu_v3_ctor_kinds) 0; + dm->is_destructor = (enum gnu_v3_dtor_kinds) 0; return dm; } @@ -974,7 +974,7 @@ demangle_char (dm, c) else { if (error_message == NULL) - error_message = strdup ("Expected ?"); + error_message = (char *) strdup ("Expected ?"); error_message[9] = c; return error_message; } @@ -3974,7 +3974,7 @@ is_gnu_v3_mangled_ctor (name) return result; } else - return 0; + return (enum gnu_v3_ctor_kinds) 0; } @@ -3996,7 +3996,7 @@ is_gnu_v3_mangled_dtor (name) return result; } else - return 0; + return (enum gnu_v3_dtor_kinds) 0; } #endif /* IN_GLIBCPP_V3 */ diff --git a/libiberty/cplus-dem.c b/libiberty/cplus-dem.c index 63858986c6..4c4778375b 100644 --- a/libiberty/cplus-dem.c +++ b/libiberty/cplus-dem.c @@ -946,7 +946,7 @@ grow_vect (old_vect, size, min_size, element_size) *size *= 2; if (*size < min_size) *size = min_size; - *old_vect = xrealloc (*old_vect, *size * element_size); + *old_vect = (void *) xrealloc (*old_vect, *size * element_size); } } @@ -1206,7 +1206,7 @@ work_stuff_copy_to_from (to, from) if (from->ntmpl_args) to->tmpl_argvec - = xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); + = (char **) xmalloc (from->ntmpl_args * sizeof (to->tmpl_argvec[0])); for (i = 0; i < from->ntmpl_args; i++) { diff --git a/libiberty/fibheap.c b/libiberty/fibheap.c index 0ba9b8d6b0..36062d451a 100644 --- a/libiberty/fibheap.c +++ b/libiberty/fibheap.c @@ -66,7 +66,7 @@ fibnode_new () { fibnode_t node; - node = xcalloc (1, sizeof *node); + node = (fibnode_t) xcalloc (1, sizeof *node); node->left = node; node->right = node; diff --git a/libiberty/md5.c b/libiberty/md5.c index 9450586961..2e829fb3ee 100644 --- a/libiberty/md5.c +++ b/libiberty/md5.c @@ -229,7 +229,7 @@ md5_process_bytes (buffer, len, ctx) ctx->buflen = (left_over + add) & 63; } - buffer = (const char *) buffer + add; + buffer = (const void *) ((const char *) buffer + add); len -= add; } @@ -237,7 +237,7 @@ md5_process_bytes (buffer, len, ctx) if (len > 64) { md5_process_block (buffer, len & ~63, ctx); - buffer = (const char *) buffer + (len & ~63); + buffer = (const void *) ((const char *) buffer + (len & ~63)); len &= 63; } @@ -269,7 +269,7 @@ md5_process_block (buffer, len, ctx) struct md5_ctx *ctx; { md5_uint32 correct_words[16]; - const md5_uint32 *words = buffer; + const md5_uint32 *words = (const md5_uint32 *) buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; diff --git a/libiberty/regex.c b/libiberty/regex.c index e2763dc2a5..f9d9a4e26d 100644 --- a/libiberty/regex.c +++ b/libiberty/regex.c @@ -4648,7 +4648,7 @@ PREFIX(re_compile_fastmap) (bufp) while (1) { - if (p == pend || *p == succeed) + if (p == pend || *p == (UCHAR_T) succeed) { /* We have reached the (effective) end of pattern. */ if (!FAIL_STACK_EMPTY ()) diff --git a/libiberty/safe-ctype.c b/libiberty/safe-ctype.c index 0c2be3ed79..3bac84bf68 100644 --- a/libiberty/safe-ctype.c +++ b/libiberty/safe-ctype.c @@ -48,20 +48,20 @@ Boston, MA 02111-1307, USA. */ #define xd _sch_isxdigit /* Masks. */ -#define L lo|is |pr /* lower case letter */ -#define XL lo|is|xd|pr /* lowercase hex digit */ -#define U up|is |pr /* upper case letter */ -#define XU up|is|xd|pr /* uppercase hex digit */ -#define D di |xd|pr /* decimal digit */ -#define P pn |pr /* punctuation */ -#define _ pn|is |pr /* underscore */ +#define L (const unsigned short) (lo|is |pr) /* lower case letter */ +#define XL (const unsigned short) (lo|is|xd|pr) /* lowercase hex digit */ +#define U (const unsigned short) (up|is |pr) /* upper case letter */ +#define XU (const unsigned short) (up|is|xd|pr) /* uppercase hex digit */ +#define D (const unsigned short) (di |xd|pr) /* decimal digit */ +#define P (const unsigned short) (pn |pr) /* punctuation */ +#define _ (const unsigned short) (pn|is |pr) /* underscore */ -#define C cn /* control character */ -#define Z nv |cn /* NUL */ -#define M nv|sp |cn /* cursor movement: \f \v */ -#define V vs|sp |cn /* vertical space: \r \n */ -#define T nv|sp|bl|cn /* tab */ -#define S nv|sp|bl|pr /* space */ +#define C (const unsigned short) ( cn) /* control character */ +#define Z (const unsigned short) (nv |cn) /* NUL */ +#define M (const unsigned short) (nv|sp |cn) /* cursor movement: \f \v */ +#define V (const unsigned short) (vs|sp |cn) /* vertical space: \r \n */ +#define T (const unsigned short) (nv|sp|bl|cn) /* tab */ +#define S (const unsigned short) (nv|sp|bl|pr) /* space */ /* Are we ASCII? */ #if '\n' == 0x0A && ' ' == 0x20 && '0' == 0x30 \ diff --git a/libiberty/splay-tree.c b/libiberty/splay-tree.c index 3227ed3d3a..6f90fde05f 100644 --- a/libiberty/splay-tree.c +++ b/libiberty/splay-tree.c @@ -234,7 +234,7 @@ splay_tree_xmalloc_allocate (size, data) int size; void *data ATTRIBUTE_UNUSED; { - return xmalloc (size); + return (void *) xmalloc (size); } static void diff --git a/libiberty/vasprintf.c b/libiberty/vasprintf.c index d438225fc1..aa20e5bff0 100644 --- a/libiberty/vasprintf.c +++ b/libiberty/vasprintf.c @@ -138,7 +138,7 @@ int_vasprintf (result, format, args) #ifdef TEST global_total_width = total_width; #endif - *result = malloc (total_width); + *result = (char *) malloc (total_width); if (*result != NULL) return vsprintf (*result, format, *args); else