+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.
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--;
/* 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
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
+
+
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)
extern char * strchr(const char *, int);
char *
-index (char *s, int c)
+index (const char *s, int c)
{
return strchr (s, c);
}
*/
-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);
}
/* 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);
}
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;
#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>. */
#endif
pid_t
-waitpid (pid_t pid, int *stat_loc, int options)
+waitpid (pid_t pid, int *stat_loc, int options ATTRIBUTE_UNUSED)
{
for (;;)
{