2000-11-20  Jakub Jelinek  <jakub@redhat.com>

	* iconvdata/bug-iconv2.c (main): Use %zd in format string.
	* io/test-lfs.c (do_test): Cast statbuf.st_size to long long.
	* malloc/tst-valloc.c (main): Cast valloc return value to long.
	* malloc/tst-obstack.c (verbose_malloc): Use %zd in format string.
	* math/test-fpucw.c (main): Use %lx in format string, cast
	control words to long.
	* stdio-common/tst-fmemopen.c (main): Use %td in format strings.
	* stdlib/tst-strtol.c (tests): Avoid (bogus?) decimal constant is so
	large that it is unsigned warning.

	* sysdeps/unix/sysv/linux/sparc/bits/types.h (__ssize_t): Changing
	it to long on sparc64.

2000-11-20  Andreas Jaeger  <aj@suse.de>

	* nscd/nscd.h (termination_handler): Add noreturn attribute.
	(receiv_print_stats): Likewise.

	* elf/ldconfig.c (path_hwcap): Cast -1 for proper comparison.
This commit is contained in:
Ulrich Drepper 2000-11-20 17:40:29 +00:00
parent ce3019ccbb
commit 595538976b
17 changed files with 72 additions and 34 deletions

View File

@ -1,3 +1,25 @@
2000-11-20 Jakub Jelinek <jakub@redhat.com>
* iconvdata/bug-iconv2.c (main): Use %zd in format string.
* io/test-lfs.c (do_test): Cast statbuf.st_size to long long.
* malloc/tst-valloc.c (main): Cast valloc return value to long.
* malloc/tst-obstack.c (verbose_malloc): Use %zd in format string.
* math/test-fpucw.c (main): Use %lx in format string, cast
control words to long.
* stdio-common/tst-fmemopen.c (main): Use %td in format strings.
* stdlib/tst-strtol.c (tests): Avoid (bogus?) decimal constant is so
large that it is unsigned warning.
* sysdeps/unix/sysv/linux/sparc/bits/types.h (__ssize_t): Changing
it to long on sparc64.
2000-11-20 Andreas Jaeger <aj@suse.de>
* nscd/nscd.h (termination_handler): Add noreturn attribute.
(receiv_print_stats): Likewise.
* elf/ldconfig.c (path_hwcap): Cast -1 for proper comparison.
2000-11-20 Ulrich Drepper <drepper@redhat.com>
* malloc/thread-m.h: gcc doesn't tolerate zero-sized types anymore.

View File

@ -191,10 +191,12 @@ path_hwcap (const char *path)
h = _dl_string_hwcap (ptr + 1);
if (h == -1)
h = _dl_string_platform (ptr + 1);
if (h == -1)
break;
if (h == (uint64_t) -1)
{
h = _dl_string_platform (ptr + 1);
if (h == (uint64_t) -1)
break;
}
hwcap += 1ULL << h;
/* Search the next part of the path. */

View File

@ -38,7 +38,7 @@ main (void)
exit (1);
puts ("This used to crash");
printf ("%d\n", iconv (cd_a, &from, &from_left, &to, &to_left));
printf ("%zd\n", iconv (cd_a, &from, &from_left, &to, &to_left));
iconv_close (cd_a);
puts ("works now");

View File

@ -122,9 +122,9 @@ do_test (int argc, char *argv[])
error (0, errno, "stat64 is not supported");
else if (ret == -1)
error (EXIT_FAILURE, errno, "cannot stat file `%s'", name);
else if (statbuf.st_size != (TWO_GB+100+5))
else if (statbuf.st_size != (TWO_GB + 100 + 5))
error (EXIT_FAILURE, 0, "stat reported size %lld instead of %lld.",
statbuf.st_size, (TWO_GB+100+5));
(long long int) statbuf.st_size, (TWO_GB + 100 + 5));
return 0;
}

View File

@ -1,3 +1,13 @@
2000-11-20 Jakub Jelinek <jakub@redhat.com>
* Examples/ex3.c (main): Cast int to long before casting to void *.
(search): Cast void * to long, not int.
* Examples/ex8.c (main, thread): Similarly.
* Examples/ex11.c (main): Similarly.
* Examples/ex14.c (worker, do_test): Similarly.
* ecmutex.c (worker, do_test): Similarly.
(nlocks): Cast to int.
2000-11-08 Bruce Mitchener <bruce@cubik.org>
* linuxthreads.texi: Add documentation for pthreads attributes

View File

@ -128,7 +128,8 @@ main (void)
for (n = 0; n < NWRITERS; ++n)
{
int err = pthread_create (&thwr[n], NULL, writer_thread, (void *) n);
int err = pthread_create (&thwr[n], NULL, writer_thread,
(void *) (long int) n);
if (err != 0)
error (EXIT_FAILURE, err, "cannot create writer thread");
@ -136,7 +137,8 @@ main (void)
for (n = 0; n < NREADERS; ++n)
{
int err = pthread_create (&thrd[n], NULL, reader_thread, (void *) n);
int err = pthread_create (&thrd[n], NULL, reader_thread,
(void *) (long int) n);
if (err != 0)
error (EXIT_FAILURE, err, "cannot create reader thread");

View File

@ -19,7 +19,7 @@ static void *
worker (void *arg)
{
void *result = NULL;
int nr = (int) arg;
int nr = (long int) arg;
int i;
for (i = 0; i < ROUNDS; ++i)
@ -110,7 +110,7 @@ do_test (void)
/* Start the threads. */
for (i = 0; i < NTHREADS; ++i)
if (pthread_create (&threads[i], NULL, worker, (void *) i) != 0)
if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0)
{
printf ("Failed to start thread %d\n", i);
exit (1);

View File

@ -35,7 +35,7 @@ int main(int argc, char ** argv)
/* Create the searching threads */
for (started=0; started<NUM_THREADS; started++)
pthread_create(&threads[started], NULL, search, (void *)pid);
pthread_create(&threads[started], NULL, search, (void *) (long int) pid);
/* Wait for (join) all the searching threads */
for (i=0; i<NUM_THREADS; i++)
@ -66,7 +66,7 @@ void print_it(void *arg)
void *search(void *arg)
{
int num = (int) arg;
int num = (long int) arg;
int i, j, ntries;
pthread_t tid;

View File

@ -68,7 +68,7 @@ main (void)
pthread_join (th, &res);
return (int) res;
return (int) (long int) res;
}
@ -97,5 +97,5 @@ thread (void *arg)
if (status == 0)
status = var != (PREPARE_BIT | PARENT_BIT);
return (void *) status;
return (void *) (long int) status;
}

View File

@ -14,7 +14,7 @@ static pthread_mutex_t locks[] =
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP,
PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
};
#define nlocks (sizeof (locks) / sizeof (locks[0]))
#define nlocks ((int) (sizeof (locks) / sizeof (locks[0])))
static pthread_barrier_t barrier;
#define SYNC pthread_barrier_wait (&barrier)
@ -30,7 +30,7 @@ worker (void *arg)
/* We are locking the and unlocked the locks and check the errors.
Since we are using the error-checking variant the implementation
should report them. */
int nr = (int) arg;
int nr = (long int) arg;
int i;
void *result = NULL;
int retval;
@ -141,7 +141,7 @@ do_test (void)
pthread_barrier_init (&barrier, NULL, NTHREADS);
for (i = 0; i < NTHREADS; ++i)
if (pthread_create (&threads[i], NULL, worker, (void *) i) != 0)
if (pthread_create (&threads[i], NULL, worker, (void *) (long int) i) != 0)
{
printf ("failed to create thread %d: %m\n", i);
exit (1);

View File

@ -14,7 +14,7 @@ static void *
verbose_malloc (size_t size)
{
void *buf = malloc (size);
printf ("malloc (%u) => %p\n", size, buf);
printf ("malloc (%zu) => %p\n", size, buf);
return buf;
}

View File

@ -3,19 +3,21 @@
#include <stdio.h>
#include <stdlib.h>
int main(void)
int
main (void)
{
char *p;
int pagesize = getpagesize ();
int i;
p = valloc (pagesize);
i = (int) p;
i = (long int) p;
if ((i & (pagesize-1)) != 0) {
fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
exit(1);
}
if ((i & (pagesize-1)) != 0)
{
fprintf (stderr, "Alignment problem: valloc returns %p\n", p);
exit (1);
}
return 0;
}

View File

@ -32,8 +32,8 @@ main (void)
cw &= ~_FPU_RESERVED;
if (cw != (_FPU_DEFAULT & ~_FPU_RESERVED))
printf ("control word is 0x%x but should be 0x%x.\n",
cw, (_FPU_DEFAULT & ~_FPU_RESERVED));
printf ("control word is 0x%lx but should be 0x%lx.\n",
(long int) cw, (long int) (_FPU_DEFAULT & ~_FPU_RESERVED));
return cw != (_FPU_DEFAULT & ~_FPU_RESERVED);

View File

@ -102,7 +102,7 @@ extern const char *server_user;
/* Prototypes for global functions. */
/* nscd.c */
extern void termination_handler (int signum);
extern void termination_handler (int signum) __attribute__ ((__noreturn__));
extern int nscd_open_socket (void);
/* connections.c */
@ -115,7 +115,7 @@ extern int nscd_parse_file (const char *fname, struct database dbs[lastdb]);
/* nscd_stat.c */
extern void send_stats (int fd, struct database dbs[lastdb]);
extern int receive_print_stats (void);
extern int receive_print_stats (void) __attribute__ ((__noreturn__));
/* cache.c */
extern struct hashentry *cache_search (int type, void *key, size_t len,

View File

@ -34,7 +34,7 @@ main (void)
fputc (ch, stdout);
if (ch != *cp)
{
printf ("\ncharacter %d: '%c' instead of '%c'\n",
printf ("\ncharacter %td: '%c' instead of '%c'\n",
cp - blah, ch, *cp);
exit (1);
}
@ -79,7 +79,7 @@ main (void)
fputc (ch, stdout);
if (ch != *cp)
{
printf ("%d character: '%c' instead of '%c'\n",
printf ("%td character: '%c' instead of '%c'\n",
cp - blah, ch, *cp);
exit (1);
}

View File

@ -70,8 +70,8 @@ static const struct ltest tests[] =
{"922337203685477580777", 9223372036854775807, 0, 0, ERANGE},
{"9223372036854775810", 9223372036854775807, 0, 0, ERANGE},
{"-2147483648", -2147483648, 0, 0, 0},
{"-9223372036854775808", -9223372036854775808, 0, 0, 0},
{"-9223372036854775809", -9223372036854775808, 0, 0, ERANGE},
{"-9223372036854775808", 0x8000000000000000, 0, 0, 0},
{"-9223372036854775809", 0x8000000000000000, 0, 0, ERANGE},
{"0x112233445566778899z", 9223372036854775807, 16, 'z', ERANGE},
{"0xFFFFFFFFFFFF00FF" , 9223372036854775807, 0, 0, ERANGE},
#endif

View File

@ -81,7 +81,7 @@ typedef __quad_t __off64_t; /* "" (LFS) */
typedef __quad_t __loff_t; /* Type of file sizes and offsets. */
typedef int __pid_t; /* Type of process identifications. */
#if __WORDSIZE == 64
typedef long long int __ssize_t; /* Type of a byte count, or error. */
typedef long int __ssize_t; /* Type of a byte count, or error. */
#else
typedef int __ssize_t; /* Type of a byte count, or error. */
#endif