]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
merge from gcc
authorDJ Delorie <dj@redhat.com>
Sat, 2 Apr 2005 20:20:01 +0000 (20:20 +0000)
committerDJ Delorie <dj@redhat.com>
Sat, 2 Apr 2005 20:20:01 +0000 (20:20 +0000)
libiberty/ChangeLog
libiberty/bsearch.c
libiberty/config.in
libiberty/configure
libiberty/configure.ac
libiberty/index.c
libiberty/rindex.c
libiberty/strstr.c
libiberty/strtol.c
libiberty/waitpid.c

index 1e20162a4a2052bb0aa1c83f3beff6341ae22ab7..3099668761251399ce396b2d1a60e79eb9a28c88 100644 (file)
@@ -1,3 +1,12 @@
+2005-04-02  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
+
+       * configure.ac (ac_libiberty_warn_cflags): Add -Wwrite-strings
+       -Wstrict-prototypes.
+       * configure, config.in: Regenerate.
+
+       * bsearch.c, index.c, rindex.c, strstr.c, strtol.c, waitpid.c: Fix
+       warnings and reconcile interfaces with relevant standards.
+
 2005-04-02  Ian Lance Taylor  <ian@airs.com>
 
        * cp-demangle.c: Update copyright.
index bb5555eff3cdc8f5075340619fdf4be7bbdc81a0..771d5de7b12aa7c3222fae913ccf22b0fb9fcd5d 100644 (file)
@@ -79,7 +79,7 @@ bsearch (register const void *key, const void *base0,
                p = base + (lim >> 1) * size;
                cmp = (*compar)(key, p);
                if (cmp == 0)
-                       return (p);
+                       return (void *)p;
                if (cmp > 0) {  /* key > p: move right */
                        base = (const char *)p + size;
                        lim--;
index 6eb169e2eec3e805ffe435844bec04291a6b28b2..ad71e76c09a2137b5ae0d742b7ad01ee197d317a 100644 (file)
 /* Define to 1 if you have the `vsprintf' function. */
 #undef HAVE_VSPRINTF
 
+/* Define to 1 if you have the `wait3' function. */
+#undef HAVE_WAIT3
+
+/* Define to 1 if you have the `wait4' function. */
+#undef HAVE_WAIT4
+
 /* Define to 1 if you have the `waitpid' function. */
 #undef HAVE_WAITPID
 
index f76d3c5732f4e18490a2a8a0a44749a8153275f2..3aa3963ea198525894102862c92cb484c3b92e47 100755 (executable)
@@ -2930,7 +2930,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
 ac_c_preproc_warn_flag=yes
 
 if test x$GCC = xyes; then
-  ac_libiberty_warn_cflags='-W -Wall -pedantic'
+  ac_libiberty_warn_cflags='-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes'
 fi
 
 
@@ -4885,6 +4885,8 @@ if test "x" = "y"; then
 
 
 
+
+
 
 
 
index 6c4347da36c6141f6ae5e63dea8e4d2afed0438e..9f4749139062bcdf4ceeab8955cec6b245911959 100644 (file)
@@ -114,7 +114,7 @@ AC_PROG_CC
 AC_PROG_CPP_WERROR
 
 if test x$GCC = xyes; then
-  ac_libiberty_warn_cflags='-W -Wall -pedantic'
+  ac_libiberty_warn_cflags='-W -Wall -pedantic -Wwrite-strings -Wstrict-prototypes'
 fi
 AC_SUBST(ac_libiberty_warn_cflags)
 
index c37edca024ea735aa0e0d6808319cc6c37cd424e..acd0a45fc0295bcafd7baf3f114ff9a4f8a8761f 100644 (file)
@@ -15,7 +15,7 @@ deprecated in new programs in favor of @code{strchr}.
 extern char * strchr(const char *, int);
 
 char *
-index (char *s, int c)
+index (const char *s, int c)
 {
   return strchr (s, c);
 }
index 741fd8ecb7ce44e7001087f55d426dd4fb763609..194ef9fad7861a60e7789023318e4d59413293ff 100644 (file)
@@ -12,10 +12,10 @@ deprecated in new programs in favor of @code{strrchr}.
 
 */
 
-extern char *strrchr ();
+extern char *strrchr (const char *, int);
 
 char *
-rindex (char *s, int c)
+rindex (const char *s, int c)
 {
   return strrchr (s, c);
 }
index ff8abd20f786add836af29c309109533f0965aba..60902ea40ee80b513a525f9403728398ea876d7e 100644 (file)
@@ -20,23 +20,22 @@ length, the function returns @var{string}.
 /* FIXME:  The above description is ANSI compiliant.  This routine has not
    been validated to comply with it.  -fnf */
 
+#include <stddef.h>
+
+extern char *strchr (const char *, int);
+extern int strncmp (const void *, const void *, size_t);
+extern size_t strlen (const char *);
+
 char *
-strstr (char *s1, char *s2)
+strstr (const char *s1, const char *s2)
 {
-  register char *p = s1;
-  extern char *strchr ();
-  extern int strncmp ();
-#if __GNUC__ >= 2
-  extern __SIZE_TYPE__ strlen (const char *);
-#endif
-  register int len = strlen (s2);
+  const char *p = s1;
+  const size_t len = strlen (s2);
 
   for (; (p = strchr (p, *s2)) != 0; p++)
     {
       if (strncmp (p, s2, len) == 0)
-       {
-         return (p);
-       }
+       return (char *)p;
     }
   return (0);
 }
index 5f2a1cebb201c0f2252c0ee350bb177d0c949693..acc7882192bb4e8bd114a0b34ef3ffe7645b03d9 100644 (file)
@@ -144,7 +144,7 @@ strtol(const char *nptr, char **endptr, register int base)
                        break;
                if (c >= base)
                        break;
-               if (any < 0 || acc > cutoff || acc == cutoff && c > cutlim)
+               if (any < 0 || acc > cutoff || (acc == cutoff && c > cutlim))
                        any = -1;
                else {
                        any = 1;
index 33f2f8e38cca3620db6b00dd2b56e8d264316aa8..fd519d7696e074573f37b204c0a8485d5a2b8d0f 100644 (file)
@@ -13,6 +13,7 @@ does the return value.  The third argument is unused in @libib{}.
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
+#include "ansidecl.h"
 
 /* On some systems (such as WindISS), you must include <sys/types.h>
    to get the definition of "pid_t" before you include <sys/wait.h>.  */
@@ -23,7 +24,7 @@ does the return value.  The third argument is unused in @libib{}.
 #endif
 
 pid_t
-waitpid (pid_t pid, int *stat_loc, int options)
+waitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED)
 {
   for (;;)
     {