From: ghazi Date: Wed, 7 Jun 2000 21:13:14 +0000 (+0000) Subject: libiberty: X-Git-Url: http://git.sourceforge.jp/view?p=pf3gnuchains%2Fgcc-fork.git;a=commitdiff_plain;h=da8bd873fe10f6278a039cd7feea5b00fb393221;ds=sidebyside libiberty: * configure.in (ac_libiberty_warn_cflags): Add -pedantic. * choose-temp.c (try, choose_temp_base, make_temp_file): Constify. * cp-demangle.c (demangle_char): Change parameter from char to int. (demangle_expression, demangle_expr_primary): Remove extra semi-colon in prototype. * dyn-string.c (dyn_string_append_char): Change parameter from char to int. * memcmp.c (memcmp): Constify. * mkstemps.c (gcc_uint64_t): Mark GNUC `long long' case with __extension__. * partition.c (elem_compare): Prototype. Don't cast away const-ness. * setenv.c (setenv): Use braces to avoid ambiguous `else'. include: * demangle.h (demangling_styles): Remove trailing comma in enum. * dyn-string.h (dyn_string_append_char): Change parameter from char to int. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@34447 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/include/ChangeLog b/include/ChangeLog index c74f03e3204..9e5617dc429 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,10 @@ +2000-06-07 Kaveh R. Ghazi + + * demangle.h (demangling_styles): Remove trailing comma in enum. + + * dyn-string.h (dyn_string_append_char): Change parameter from + char to int. + 2000-06-04 Alex Samuel * dyn-string.h: Move here from gcc/dyn-string.h. Add new functions. diff --git a/include/demangle.h b/include/demangle.h index 146c895d96b..61dd23071a4 100644 --- a/include/demangle.h +++ b/include/demangle.h @@ -59,7 +59,7 @@ extern enum demangling_styles arm_demangling = DMGL_ARM, hp_demangling = DMGL_HP, edg_demangling = DMGL_EDG, - gnu_new_abi_demangling = DMGL_GNU_NEW_ABI, + gnu_new_abi_demangling = DMGL_GNU_NEW_ABI } current_demangling_style; /* Define string names for the various demangling styles. */ diff --git a/include/dyn-string.h b/include/dyn-string.h index 30c0624baa2..3e2213e5bc6 100644 --- a/include/dyn-string.h +++ b/include/dyn-string.h @@ -58,7 +58,7 @@ extern dyn_string_t dyn_string_append PARAMS ((dyn_string_t, dyn_string_t)); extern dyn_string_t dyn_string_append_cstr PARAMS ((dyn_string_t, const char *)); extern dyn_string_t dyn_string_append_char - PARAMS ((dyn_string_t, char)); + PARAMS ((dyn_string_t, int)); extern void dyn_string_substring PARAMS ((dyn_string_t, dyn_string_t, int, int)); extern int dyn_string_eq PARAMS ((dyn_string_t, dyn_string_t)); diff --git a/libiberty/ChangeLog b/libiberty/ChangeLog index 34f2908cba7..a9a15f116f3 100644 --- a/libiberty/ChangeLog +++ b/libiberty/ChangeLog @@ -1,5 +1,28 @@ 2000-06-07 Kaveh R. Ghazi + * configure.in (ac_libiberty_warn_cflags): Add -pedantic. + + * choose-temp.c (try, choose_temp_base, make_temp_file): Constify. + + * cp-demangle.c (demangle_char): Change parameter from char to int. + (demangle_expression, demangle_expr_primary): Remove extra + semi-colon in prototype. + + * dyn-string.c (dyn_string_append_char): Change parameter from + char to int. + + * memcmp.c (memcmp): Constify. + + * mkstemps.c (gcc_uint64_t): Mark GNUC `long long' case with + __extension__. + + * partition.c (elem_compare): Prototype. Don't cast away + const-ness. + + * setenv.c (setenv): Use braces to avoid ambiguous `else'. + +2000-06-07 Kaveh R. Ghazi + * Makefile.in (cp-demangle.o): Depend on $(INCDIR)/demangle.h. * cp-demangle.c: Include demangle.h. diff --git a/libiberty/choose-temp.c b/libiberty/choose-temp.c index 826d818ed62..1a475dd6fb9 100644 --- a/libiberty/choose-temp.c +++ b/libiberty/choose-temp.c @@ -79,9 +79,11 @@ extern int mkstemps (); If success, DIR is returned. Otherwise NULL is returned. */ -static char * +static const char *try PARAMS ((const char *, const char *)); + +static const char * try (dir, base) - char *dir, *base; + const char *dir, *base; { if (base != 0) return base; @@ -102,7 +104,7 @@ try (dir, base) char * choose_temp_base () { - char *base = 0; + const char *base = 0; char *temp_filename; int len; static char tmp[] = { DIR_SEPARATOR, 't', 'm', 'p', 0 }; @@ -147,7 +149,7 @@ char * make_temp_file (suffix) const char *suffix; { - char *base = 0; + const char *base = 0; char *temp_filename; int base_len, suffix_len; int fd; diff --git a/libiberty/configure b/libiberty/configure index 891c656ebc4..ef375bbcccd 100755 --- a/libiberty/configure +++ b/libiberty/configure @@ -845,7 +845,7 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_libiberty_warn_cflags='-W -Wall -Wtraditional' + ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' ac_test_CFLAGS="${CFLAGS+set}" ac_save_CFLAGS="$CFLAGS" CFLAGS= diff --git a/libiberty/configure.in b/libiberty/configure.in index 0814ae32967..6ad054a6448 100644 --- a/libiberty/configure.in +++ b/libiberty/configure.in @@ -55,7 +55,7 @@ AC_PROG_CC_GNU if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_libiberty_warn_cflags='-W -Wall -Wtraditional' + ac_libiberty_warn_cflags='-W -Wall -Wtraditional -pedantic' dnl Check whether -g works, even if CFLAGS is set, in case the package dnl plays around with CFLAGS (such as to build both debugging and dnl normal versions of a library), tasteless as that idea is. diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c index 502035f4ff2..2feac6c30ef 100644 --- a/libiberty/cp-demangle.c +++ b/libiberty/cp-demangle.c @@ -713,7 +713,7 @@ demangling_delete (dm) structure. */ static status_t demangle_char - PARAMS ((demangling_t, char)); + PARAMS ((demangling_t, int)); static status_t demangle_mangled_name PARAMS ((demangling_t)); static status_t demangle_encoding @@ -765,11 +765,11 @@ static status_t demangle_literal static status_t demangle_template_arg PARAMS ((demangling_t)); static status_t demangle_expression - PARAMS ((demangling_t));; + PARAMS ((demangling_t)); static status_t demangle_scope_expression PARAMS ((demangling_t)); static status_t demangle_expr_primary - PARAMS ((demangling_t));; + PARAMS ((demangling_t)); static status_t demangle_substitution PARAMS ((demangling_t, int *, int *)); static status_t demangle_local_name @@ -789,7 +789,7 @@ static status_t cp_demangle static status_t demangle_char (dm, c) demangling_t dm; - char c; + int c; { static char *error_message = NULL; diff --git a/libiberty/dyn-string.c b/libiberty/dyn-string.c index f6fad618031..2ae64ebb6c2 100644 --- a/libiberty/dyn-string.c +++ b/libiberty/dyn-string.c @@ -275,7 +275,7 @@ dyn_string_append_cstr (ds, s) dyn_string_t dyn_string_append_char (ds, c) dyn_string_t ds; - char c; + int c; { /* Make room for the extra character. */ dyn_string_resize (ds, ds->length + 1); diff --git a/libiberty/memcmp.c b/libiberty/memcmp.c index 127ae0c8019..0fd21cad11e 100644 --- a/libiberty/memcmp.c +++ b/libiberty/memcmp.c @@ -25,8 +25,8 @@ int DEFUN(memcmp, (str1, str2, count), const PTR str1 AND const PTR str2 AND size_t count) { - register unsigned char *s1 = (unsigned char*)str1; - register unsigned char *s2 = (unsigned char*)str2; + register const unsigned char *s1 = (const unsigned char*)str1; + register const unsigned char *s2 = (const unsigned char*)str2; while (count-- > 0) { diff --git a/libiberty/mkstemps.c b/libiberty/mkstemps.c index 16c16a23263..6ef526ece3d 100644 --- a/libiberty/mkstemps.c +++ b/libiberty/mkstemps.c @@ -39,7 +39,7 @@ /* We need to provide a type for gcc_uint64_t. */ #ifdef __GNUC__ -typedef unsigned long long gcc_uint64_t; +__extension__ typedef unsigned long long gcc_uint64_t; #else typedef unsigned long gcc_uint64_t; #endif diff --git a/libiberty/partition.c b/libiberty/partition.c index 52fb128d7bf..6975af49594 100644 --- a/libiberty/partition.c +++ b/libiberty/partition.c @@ -34,6 +34,8 @@ #include "libiberty.h" #include "partition.h" +static int elem_compare PARAMS ((const void *, const void *)); + /* Creates a partition of NUM_ELEMENTS elements. Initially each element is in a class by itself. */ @@ -128,8 +130,8 @@ elem_compare (elem1, elem2) const void *elem1; const void *elem2; { - int e1 = * (int *) elem1; - int e2 = * (int *) elem2; + int e1 = * (const int *) elem1; + int e2 = * (const int *) elem2; if (e1 < e2) return -1; else if (e1 > e2) diff --git a/libiberty/setenv.c b/libiberty/setenv.c index eec13006c22..a90c83ad78e 100644 --- a/libiberty/setenv.c +++ b/libiberty/setenv.c @@ -72,11 +72,13 @@ setenv (name, value, replace) size = 0; if (__environ != NULL) - for (ep = __environ; *ep != NULL; ++ep) - if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') - break; - else - ++size; + { + for (ep = __environ; *ep != NULL; ++ep) + if (!strncmp (*ep, name, namelen) && (*ep)[namelen] == '=') + break; + else + ++size; + } if (__environ == NULL || *ep == NULL) {