aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-04-04 00:41:39 +0000
committerUlrich Drepper <drepper@redhat.com>2004-04-04 00:41:39 +0000
commitabca9f7f5893adee7d0eac2ca8962b9c5321e0fe (patch)
treefbd2af557eec256cb4733c1b65f771124e474bef
parent6472c918f768547df3309f11a8158477ac032a5b (diff)
downloadglibc-abca9f7f5893adee7d0eac2ca8962b9c5321e0fe.zip
glibc-abca9f7f5893adee7d0eac2ca8962b9c5321e0fe.tar.gz
glibc-abca9f7f5893adee7d0eac2ca8962b9c5321e0fe.tar.bz2
Update.
* inet/test-ifaddrs.c: Fight warnings. * argp/argp-help.c: Fight warnings. * include/time.h: Declare __difftime.
-rw-r--r--ChangeLog6
-rw-r--r--argp/argp-help.c15
-rw-r--r--include/time.h1
-rw-r--r--inet/test-ifaddrs.c76
-rw-r--r--nptl/tst-clock2.c8
-rw-r--r--nptl_db/td_ta_clear_event.c4
-rw-r--r--nptl_db/td_ta_set_event.c4
-rw-r--r--nptl_db/td_ta_thr_iter.c4
8 files changed, 67 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 06b6d1d..c162fa8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2004-04-03 Ulrich Drepper <drepper@redhat.com>
+ * inet/test-ifaddrs.c: Fight warnings.
+
+ * argp/argp-help.c: Fight warnings.
+
+ * include/time.h: Declare __difftime.
+
* sysdeps/unix/sysv/linux/internal_statvfs.c: Restructure to avoid
duplication in 64-bit version.
* sysdeps/unix/sysv/linux/wordsize-64/internal_statvfs64.c: New file.
diff --git a/argp/argp-help.c b/argp/argp-help.c
index b7e088e..1921e52 100644
--- a/argp/argp-help.c
+++ b/argp/argp-help.c
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing help output
- Copyright (C) 1995-2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995-2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@@ -47,6 +47,7 @@ char *alloca ();
#include <assert.h>
#include <stdarg.h>
#include <ctype.h>
+#include <limits.h>
#ifdef USE_IN_LIBIO
# include <wchar.h>
#endif
@@ -452,8 +453,10 @@ make_hol (const struct argp *argp, struct hol_cluster *cluster)
hol->entries = malloc (sizeof (struct hol_entry) * hol->num_entries);
hol->short_options = malloc (num_short_options + 1);
- assert (hol->entries && hol->short_options
- && hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+ assert (hol->entries && hol->short_options);
+#if SIZE_MAX <= UINT_MAX
+ assert (hol->num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#endif
/* Fill in the entries. */
so = hol->short_options;
@@ -846,8 +849,10 @@ hol_append (struct hol *hol, struct hol *more)
char *short_options =
malloc (hol_so_len + strlen (more->short_options) + 1);
- assert (entries && short_options
- && num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+ assert (entries && short_options);
+#if SIZE_MAX <= UINT_MAX
+ assert (num_entries <= SIZE_MAX / sizeof (struct hol_entry));
+#endif
__mempcpy (__mempcpy (entries, hol->entries,
hol->num_entries * sizeof (struct hol_entry)),
diff --git a/include/time.h b/include/time.h
index 5a95be5..795eb5f 100644
--- a/include/time.h
+++ b/include/time.h
@@ -95,6 +95,7 @@ extern char * __strptime_internal (const char *rp, const char *fmt,
int era_cnt, __locale_t loc)
internal_function;
+extern double __difftime (time_t time1, time_t time0);
/* Use in the clock_* functions. Size of the field representing the
diff --git a/inet/test-ifaddrs.c b/inet/test-ifaddrs.c
index 5057fac..185859e 100644
--- a/inet/test-ifaddrs.c
+++ b/inet/test-ifaddrs.c
@@ -1,5 +1,5 @@
/* Test listing of network interface addresses.
- Copyright (C) 2002 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -25,10 +25,44 @@
#include <netinet/in.h>
#include <arpa/inet.h>
+static int failures;
+
+static const char *
+addr_string (struct sockaddr *sa, char *buf, size_t size)
+{
+ if (sa == NULL)
+ return "<none>";
+
+ switch (sa->sa_family)
+ {
+ case AF_INET:
+ return inet_ntop (AF_INET, &((struct sockaddr_in *) sa)->sin_addr,
+ buf, size);
+ case AF_INET6:
+ return inet_ntop (AF_INET6, &((struct sockaddr_in6 *) sa)->sin6_addr,
+ buf, size);
+#ifdef AF_LINK
+ case AF_LINK:
+ return "<link>";
+#endif
+ case AF_UNSPEC:
+ return "---";
+
+ case AF_PACKET:
+ return "<packet>";
+
+ default:
+ ++failures;
+ printf ("sa_family=%d %08x\n", sa->sa_family,
+ *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
+ return "<unexpected sockaddr family>";
+ }
+}
+
+
int
main (void)
{
- int failures = 0;
struct ifaddrs *ifaces, *ifa;
if (getifaddrs (&ifaces) < 0)
@@ -48,43 +82,11 @@ Name Flags Address Netmask Broadcast/Destination");
for (ifa = ifaces; ifa != NULL; ifa = ifa->ifa_next)
{
char abuf[64], mbuf[64], dbuf[64];
- inline const char *addr_string (struct sockaddr *sa, char *buf)
- {
- if (sa == NULL)
- return "<none>";
-
- switch (sa->sa_family)
- {
- case AF_INET:
- return inet_ntop (AF_INET,
- &((struct sockaddr_in *) sa)->sin_addr,
- buf, sizeof abuf);
- case AF_INET6:
- return inet_ntop (AF_INET6,
- &((struct sockaddr_in6 *) sa)->sin6_addr,
- buf, sizeof abuf);
-#ifdef AF_LINK
- case AF_LINK:
- return "<link>";
-#endif
- case AF_UNSPEC:
- return "---";
-
- case AF_PACKET:
- return "<packet>";
-
- default:
- ++failures;
- printf ("sa_family=%d %08x\n", sa->sa_family,
- *(int*)&((struct sockaddr_in *) sa)->sin_addr.s_addr);
- return "<unexpected sockaddr family>";
- }
- }
printf ("%-15s%#.4x %-15s %-15s %-15s\n",
ifa->ifa_name, ifa->ifa_flags,
- addr_string (ifa->ifa_addr, abuf),
- addr_string (ifa->ifa_netmask, mbuf),
- addr_string (ifa->ifa_broadaddr, dbuf));
+ addr_string (ifa->ifa_addr, abuf, sizeof (abuf)),
+ addr_string (ifa->ifa_netmask, mbuf, sizeof (mbuf)),
+ addr_string (ifa->ifa_broadaddr, dbuf, sizeof (dbuf)));
}
freeifaddrs (ifaces);
diff --git a/nptl/tst-clock2.c b/nptl/tst-clock2.c
index 62e5752..54f5041 100644
--- a/nptl/tst-clock2.c
+++ b/nptl/tst-clock2.c
@@ -25,6 +25,7 @@
#include <unistd.h>
+#if _POSIX_THREAD_CPUTIME
static pthread_barrier_t b2;
static pthread_barrier_t bN;
@@ -48,6 +49,7 @@ tf (void *arg)
return NULL;
}
+#endif
int
@@ -68,15 +70,15 @@ do_test (void)
pthread_t th[N + 1];
clockid_t cl[N + 1];
-#ifndef CLOCK_THREAD_CPUTIME_ID
+# ifndef CLOCK_THREAD_CPUTIME_ID
if (pthread_getcpuclockid (pthread_self (), &cl[0]) != 0)
{
puts ("own pthread_getcpuclockid failed");
return 1;
}
-#else
+# else
cl[0] = CLOCK_THREAD_CPUTIME_ID;
-#endif
+# endif
pthread_attr_t at;
diff --git a/nptl_db/td_ta_clear_event.c b/nptl_db/td_ta_clear_event.c
index d45d75b..99fa63c 100644
--- a/nptl_db/td_ta_clear_event.c
+++ b/nptl_db/td_ta_clear_event.c
@@ -1,5 +1,5 @@
/* Globally disable events.
- Copyright (C) 1999, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@@ -28,7 +28,7 @@ td_ta_clear_event (ta_arg, event)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t eventmask;
+ psaddr_t eventmask = 0;
void *copy;
LOG ("td_ta_clear_event");
diff --git a/nptl_db/td_ta_set_event.c b/nptl_db/td_ta_set_event.c
index 4fcc934..5d64e4d 100644
--- a/nptl_db/td_ta_set_event.c
+++ b/nptl_db/td_ta_set_event.c
@@ -1,5 +1,5 @@
/* Globally enable events.
- Copyright (C) 1999,2001,2002,2003 Free Software Foundation, Inc.
+ Copyright (C) 1999,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@@ -28,7 +28,7 @@ td_ta_set_event (ta_arg, event)
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t eventmask;
+ psaddr_t eventmask = 0;
void *copy;
LOG ("td_ta_set_event");
diff --git a/nptl_db/td_ta_thr_iter.c b/nptl_db/td_ta_thr_iter.c
index 18c5f2e..66e4376 100644
--- a/nptl_db/td_ta_thr_iter.c
+++ b/nptl_db/td_ta_thr_iter.c
@@ -1,5 +1,5 @@
/* Iterate over a process's threads.
- Copyright (C) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1999,2000,2001,2002,2003,2004 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 1999.
@@ -119,7 +119,7 @@ td_ta_thr_iter (const td_thragent_t *ta_arg, td_thr_iter_f *callback,
{
td_thragent_t *const ta = (td_thragent_t *) ta_arg;
td_err_e err;
- psaddr_t list;
+ psaddr_t list = 0;
LOG ("td_ta_thr_iter");