diff options
author | Jakub Jelinek <jakub@redhat.com> | 2007-04-16 23:59:09 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2007-04-16 23:59:09 +0000 |
commit | e220c524c93b053a1dea504a2d18288ff8f32b9a (patch) | |
tree | 4193293c838a7db46f2cc0c2b50cb8601dcddb8d | |
parent | a891c7b0e014df5df027249f59cb444b87afdf30 (diff) | |
download | glibc-e220c524c93b053a1dea504a2d18288ff8f32b9a.tar.gz glibc-e220c524c93b053a1dea504a2d18288ff8f32b9a.tar.xz glibc-e220c524c93b053a1dea504a2d18288ff8f32b9a.zip |
Updated to fedora-glibc-20070416T2350 cvs/fedora-glibc-2_5_90-21
59 files changed, 1541 insertions, 435 deletions
diff --git a/ChangeLog b/ChangeLog index b54e3bc79c..8c1cb9f653 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,207 @@ * locale/programs/locarchive.c (add_alias, insert_name): Remove static. +2007-04-16 Ulrich Drepper <drepper@redhat.com> + + [BZ #4364] + * posix/unistd.h (_XOPEN_VERSION): Define appropriately for SUSv3. + +2007-04-15 Jakub Jelinek <jakub@redhat.com> + + * locale/programs/locarchive.c (INITIAL_NUM_NAMES, + INITIAL_SIZE_STRINGS, INITIAL_NUM_LOCREC): Update to accomodate + current number of locales in SUPPORTED. + (create_archive): Initialize serial. + (enlarge_archive): Preserve aliases rather than duplicating + their locrecs. + +2007-04-13 Jakub Jelinek <jakub@redhat.com> + + * libio/genops.c (_IO_default_finish): Call _IO_lock_fini + after _IO_un_link, not before it. + + * stdio-common/printf_fp.c (___printf_fp): Fix exponent -4 + special case handling when wcp == wstartp + 1. Fix a comment typo. + * stdio-common/tfformat.c (sprint_doubles): Add a new testcase. + +2007-03-30 Jakub Jelinek <jakub@redhat.com> + + * libio/libio.h (__underflow, __uflow, __overflow, __wunderflow, + __wuflow, __woverflow, _IO_getc, _IO_putc, _IO_peekc_locked, _IO_padn, + _IO_sgetn, _IO_seekoff, _IO_seekpos, _IO_getwc, _IO_putwc, _IO_wpadn): + Remove __THROW. + * libio/fileops.c (new_do_write, _IO_file_xsgetn_mmap, + _IO_file_xsgetn_maybe_mmap): Likewise. + * libio/oldfileops.c (old_do_write): Likewise. + * libio/libioP.h (_IO_switch_to_get_mode, _IO_switch_to_wget_mode, + _IO_init_marker, _IO_init_wmarker, _IO_default_uflow, + _IO_wdefault_uflow, _IO_default_setbuf, _IO_default_seekpos, + _IO_do_write, _IO_new_do_write, _IO_old_do_write, _IO_wdo_write, + _IO_flush_all_lockp, _IO_flush_all, _IO_cleanup, + _IO_flush_all_linebuffered, _IO_new_fgetpos, _IO_old_fgetpos, + _IO_new_fsetpos, _IO_old_fsetpos, _IO_new_fgetpos64, + _IO_old_fgetpos64, _IO_new_fsetpos64, _IO_old_fsetpos64, + _IO_file_setbuf, _IO_file_seekoff, _IO_file_xsputn, _IO_file_xsgetn, + _IO_file_underflow, _IO_file_underflow_mmap, + _IO_file_underflow_maybe_mmap, _IO_file_overflow, _IO_file_attach, + _IO_file_open, _IO_file_fopen, _IO_file_write, _IO_file_read, + _IO_file_sync, _IO_file_close_it, _IO_file_finish, + _IO_new_file_attach, _IO_new_file_close_it, _IO_new_file_finish, + _IO_new_file_fopen, _IO_new_file_setbuf, _IO_file_setbuf_mmap, + _IO_new_file_sync, _IO_new_file_underflow, _IO_new_file_overflow, + _IO_new_file_seekoff, _IO_new_file_write, _IO_new_file_xsputn, + _IO_old_file_setbuf, _IO_old_file_seekoff, _IO_old_file_xsputn, + _IO_old_file_underflow, _IO_old_file_overflow, _IO_old_file_attach, + _IO_old_file_fopen, _IO_old_file_write, _IO_old_file_sync, + _IO_old_file_close_it, _IO_old_file_finish, _IO_wfile_xsputn, + _IO_wfile_setbuf, _IO_wfile_sync, _IO_wfile_underflow, + _IO_wfile_overflow, _IO_wfile_seekoff, _IO_old_proc_open, + _IO_old_proc_close, _IO_getdelim, _IO_flush_all_internal, + _IO_adjust_column_internal, _IO_default_uflow_internal, + _IO_default_xsgetn_internal, _IO_wdefault_xsputn_internal, + _IO_wdefault_xsgetn_internal, _IO_wdefault_uflow_internal, + _IO_file_setbuf_internal, _IO_file_seekoff_internal, + _IO_file_xsputn_internal, _IO_file_xsgetn_internal, + _IO_file_close_it_internal, _IO_file_underflow_internal, + _IO_file_overflow_internal, _IO_file_attach_internal, + _IO_file_fopen_internal, _IO_file_sync_internal, + _IO_file_finish_internal, _IO_wfile_xsputn_internal, + _IO_wfile_seekoff_internal, _IO_wfile_sync_internal, + _IO_switch_to_wget_mode_internal, _IO_padn_internal, + _IO_switch_to_get_mode_internal, _IO_seekoff_unlocked, + _IO_seekpos_unlocked): Likewise. + (_IO_strtod, _IO_dtoa, _IO_outfloat, _IO_read, _IO_write, + _IO_lseek, _IO_close, _IO_fstat): Remove unused prototypes. + +2007-04-16 Jakub Jelinek <jakub@redhat.com> + + * locale/programs/locarchive.c (show_archive_content): Fix sizeof + argument in xmalloc size computation. + +2007-04-01 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Use + math_opt_barrier and math_force_eval macros. + +2007-03-27 Jakub Jelinek <jakub@redhat.com> + + [BZ #3306] + * math/math_private.h (math_opt_barrier, math_force_eval): Define. + * sysdeps/i386/fpu/math_private.h: New file. + * sysdeps/x86_64/fpu/math_private.h: New file. + * math/s_nexttowardf.c (__nexttowardf): Use math_opt_barrier and + math_force_eval macros. Use "+m" constraint on asm rather than + "=m" and "m". + * math/s_nextafter.c (__nextafter): Likewise. + * sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c (__nexttoward): + Likewise. + * sysdeps/ieee754/flt-32/s_nextafterf.c (__nextafterf): Likewise. + * sysdeps/ieee754/ldbl-128/s_nexttoward.c (__nexttoward): Likewise. + * sysdeps/ieee754/ldbl-96/s_nexttoward.c (__nexttoward): Likewise. + * sysdeps/i386/fpu/s_nextafterl.c (__nextafterl): Use + math_opt_barrier and math_force_eval macros. + * sysdeps/ieee754/ldbl-128/s_nextafterl.c (__nextafterl): Likewise. + * sysdeps/ieee754/ldbl-96/s_nextafterl.c (__nextafterl): Likewise. + * sysdeps/i386/fpu/s_nexttoward.c: Include float.h. + (__nexttoward): Use math_opt_barrier and + math_force_eval macros. Use "+m" constraint on asm rather than + "=m" and "m". Only use asm to force double result if + FLT_EVAL_METHOD is 2. + * sysdeps/i386/fpu/s_nexttowardf.c: Include float.h. + (__nexttowardf): Use math_opt_barrier and + math_force_eval macros. Use "+m" constraint on asm rather than + "=m" and "m". Only use asm to force double result if + FLT_EVAL_METHOD is not 0. + * sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c: Include float.h. + (__nexttowardf): Use math_opt_barrier and + math_force_eval macros. If FLT_EVAL_METHOD is not 0, force + x to float using asm. + * sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c: Include float.h. + (__nldbl_nexttowardf): Use math_opt_barrier and + math_force_eval macros. If FLT_EVAL_METHOD is not 0, force + x to float using asm. + * sysdeps/ieee754/ldbl-96/s_nexttowardf.c: Include float.h. + (__nexttowardf): Use math_opt_barrier and math_force_eval + macros. If FLT_EVAL_METHOD is not 0, force x to float using asm. + * math/bug-nextafter.c (zero, inf): New variables. + (main): Add new tests. + * math/bug-nexttoward.c (zero, inf): New variables. + (main): Add new tests. + +2007-03-22 Jakub Jelinek <jakub@redhat.com> + + [BZ #3427] + * sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Clear all + exceptions both in SW and MXCSR. + * sysdeps/x86_64/fpu/feupdateenv.c: New file. + * sysdeps/x86_64/fpu/feenablxcpt.c (feenableexcept): Remove dead code. + * sysdeps/x86_64/fpu/fedisblxcpt.c (fedisableexcept): Likewise. + * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions + in MXCSR if SSE is available. + * sysdeps/i386/fpu/feupdateenv.c: Include unistd.h, dl-procinfo.h + and ldsodefs.h. + (__feupdateenv): Query exceptions also from MXCSR if SSE is available. + Fix comment typo. + * sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions. + Return 0 rather than 1. + * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Fix comment typo. + Remove incorrect part of a comment. Fix argument to feraiseexcept. + * math/test-fenv.c (feholdexcept_tests): New function. + (main): Call it. + +2007-01-05 Richard B. Kreckel <kreckel@ginac.de> + + [BZ #3427] + * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions + in SW. + +2007-04-13 Jakub Jelinek <jakub@redhat.com> + + [BZ #4344] + * elf/ldconfig.c (search_dir): Fix 2 off-by-2 errors. + Reported by David Anderson <davea42@earthlink.net>. + +2007-04-07 Ulrich Drepper <drepper@redhat.com> + + * posix/sys/wait.h: Remove unnecessary forward declaration. + +2007-04-05 Jakub Jelinek <jakub@redhat.com> + + * nis/nis_call.c (__nisfind_server): Replace (*dir)->do_servers + with obj->do_servers after first_shoot. + +2007-04-03 Ulrich Drepper <drepper@redhat.com> + + * posix/Makefile (routines): Add sched_cpucount. + (tests): Add tst-cpucount. + * posix/sched_cpucount.c: New file. + * posix/tst-cpucount.c: New file. + * posix/Versions: Export __sched_cpucount with version GLIBC_2.6. + * bits/sched.h: Define __CPU_COUNT. Declare __sched_cpucount. + * sysdeps/unix/sysv/linux/bits/sched.h: Likewise. + * posix/sched.h: Define CPU_COUNT. + +2007-03-27 Jakub Jelinek <jakub@redhat.com> + + * posix/fnmatch.c (STRUCT): Define. + (fnmatch): Pass NULL as last argument to internal_fn{,w}match. + * posix/fnmatch_loop.c (struct STRUCT): New type. + (FCT): Add ends argument. If ends != NULL and normal * is + seen in the pattern, store current pattern and string pointers + and return. Adjust recursive calls. + (EXT): Adjust FCT callers. + (STRUCT): Undef at the end of the file. + * posix/Makefile (tests): Add tst-fnmatch2. + * posix/tst-fnmatch2.c: New test. + +2007-04-01 Jakub Jelinek <jakub@redhat.com> + + * sysdeps/ia64/fpu/fesetround.c (fesetround): Return 0 on success + and 1 on failure. + + * sysdeps/unix/sysv/linux/sync_file_range.c (sync_file_range): + Change last argument to unsigned int. + 2007-03-23 Jakub Jelinek <jakub@redhat.com> * scripts/check-local-headers.sh: Filter out sys/capability.h. diff --git a/bits/sched.h b/bits/sched.h index 91b6dca0ca..32434a3798 100644 --- a/bits/sched.h +++ b/bits/sched.h @@ -1,6 +1,6 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996, 1997, 2001, 2003 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 2001, 2003, 2007 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 @@ -68,4 +68,7 @@ typedef struct ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) # define __CPU_ISSET(cpu, cpusetp) \ (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) +extern int __sched_cpucount (size_t __setsize, cpu_set_t *__setp) __THROW; +# define __CPU_COUNT(cpusetp) \ + __sched_cpucount (sizeof (cpu_set_t), cpusetp) #endif diff --git a/elf/ldconfig.c b/elf/ldconfig.c index cb3b6c3b65..1aa8376b65 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -707,10 +707,10 @@ search_dir (const struct dir_entry *entry) + 1, ".#prelink#.", sizeof (".#prelink#.") - 1) == 0) continue; } - len += strlen (entry->path); + len += strlen (entry->path) + 2; if (len > file_name_len) { - file_name_len = len + 1; + file_name_len = len; file_name = alloca (file_name_len); if (!opt_chroot) real_file_name = file_name; @@ -718,10 +718,10 @@ search_dir (const struct dir_entry *entry) sprintf (file_name, "%s/%s", entry->path, direntry->d_name); if (opt_chroot) { - len = strlen (dir_name) + strlen (direntry->d_name); + len = strlen (dir_name) + strlen (direntry->d_name) + 2; if (len > real_file_name_len) { - real_file_name_len = len + 1; + real_file_name_len = len; real_file_name = alloca (real_file_name_len); } sprintf (real_file_name, "%s/%s", dir_name, direntry->d_name); diff --git a/fedora/branch.mk b/fedora/branch.mk index 46bd255f2b..0bbd32ce6d 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-fc7 -fedora-sync-date := 2007-03-31 16:09 UTC -fedora-sync-tag := fedora-glibc-20070331T1609 +fedora-sync-date := 2007-04-16 23:50 UTC +fedora-sync-tag := fedora-glibc-20070416T2350 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index a8b70f8a0b..fcd12f4c9c 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -1564,6 +1564,10 @@ rm -f *.filelist* and any user supplied /usr/lib/locale/*_* directories, then unlink the locale-archive template - this should save > 80MB of glibc-common occupied disk space +- fix _XOPEN_VERSION (BZ#4364) +- fix printf with %g and values tiny bit smaller than 1.e-4 (#235864, + BZ#4362) +- fix NIS+ __nisfind_server (#235229) * Sat Mar 31 2007 Jakub Jelinek <jakub@redhat.com> 2.5.90-20 - assorted NIS+ speedups (#223467) diff --git a/libio/fileops.c b/libio/fileops.c index dbd7a7a8f2..886b3729c3 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995, 1997-2005, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997-2005, 2006, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -472,7 +473,7 @@ _IO_file_setbuf_mmap (fp, p, len) return result; } -static _IO_size_t new_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; +static _IO_size_t new_do_write (_IO_FILE *, const char *, _IO_size_t); /* Write TO_DO bytes from DATA to FP. Then mark FP as having empty buffers. */ @@ -1468,8 +1469,7 @@ _IO_file_xsgetn (fp, data, n) } INTDEF(_IO_file_xsgetn) -static _IO_size_t _IO_file_xsgetn_mmap (_IO_FILE *, void *, _IO_size_t) - __THROW; +static _IO_size_t _IO_file_xsgetn_mmap (_IO_FILE *, void *, _IO_size_t); static _IO_size_t _IO_file_xsgetn_mmap (fp, data, n) _IO_FILE *fp; @@ -1528,8 +1528,7 @@ _IO_file_xsgetn_mmap (fp, data, n) return s - (char *) data; } -static _IO_size_t _IO_file_xsgetn_maybe_mmap (_IO_FILE *, void *, _IO_size_t) - __THROW; +static _IO_size_t _IO_file_xsgetn_maybe_mmap (_IO_FILE *, void *, _IO_size_t); static _IO_size_t _IO_file_xsgetn_maybe_mmap (fp, data, n) _IO_FILE *fp; diff --git a/libio/genops.c b/libio/genops.c index 8d62da7781..3f8d71a50f 100644 --- a/libio/genops.c +++ b/libio/genops.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1995,1997-2002, 2003, 2004, 2006 +/* Copyright (C) 1993,1995,1997-2002, 2003, 2004, 2006, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -696,12 +696,12 @@ _IO_default_finish (fp, dummy) fp->_IO_save_base = NULL; } + INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp); + #ifdef _IO_MTSAFE_IO if (fp->_lock != NULL) _IO_lock_fini (*fp->_lock); #endif - - INTUSE(_IO_un_link) ((struct _IO_FILE_plus *) fp); } INTDEF(_IO_default_finish) diff --git a/libio/libio.h b/libio/libio.h index 428e035540..9df08614ee 100644 --- a/libio/libio.h +++ b/libio/libio.h @@ -410,12 +410,12 @@ extern void _IO_cookie_init (struct _IO_cookie_file *__cfile, int __read_write, extern "C" { #endif -extern int __underflow (_IO_FILE *) __THROW; -extern int __uflow (_IO_FILE *) __THROW; -extern int __overflow (_IO_FILE *, int) __THROW; -extern _IO_wint_t __wunderflow (_IO_FILE *) __THROW; -extern _IO_wint_t __wuflow (_IO_FILE *) __THROW; -extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW; +extern int __underflow (_IO_FILE *); +extern int __uflow (_IO_FILE *); +extern int __overflow (_IO_FILE *, int); +extern _IO_wint_t __wunderflow (_IO_FILE *); +extern _IO_wint_t __wuflow (_IO_FILE *); +extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t); #if __GNUC__ >= 3 # define _IO_BE(expr, res) __builtin_expect ((expr), res) @@ -448,12 +448,12 @@ extern _IO_wint_t __woverflow (_IO_FILE *, _IO_wint_t) __THROW; #define _IO_feof_unlocked(__fp) (((__fp)->_flags & _IO_EOF_SEEN) != 0) #define _IO_ferror_unlocked(__fp) (((__fp)->_flags & _IO_ERR_SEEN) != 0) -extern int _IO_getc (_IO_FILE *__fp) __THROW; -extern int _IO_putc (int __c, _IO_FILE *__fp) __THROW; +extern int _IO_getc (_IO_FILE *__fp); +extern int _IO_putc (int __c, _IO_FILE *__fp); extern int _IO_feof (_IO_FILE *__fp) __THROW; extern int _IO_ferror (_IO_FILE *__fp) __THROW; -extern int _IO_peekc_locked (_IO_FILE *__fp) __THROW; +extern int _IO_peekc_locked (_IO_FILE *__fp); /* This one is for Emacs. */ #define _IO_PENDING_OUTPUT_COUNT(_fp) \ @@ -482,17 +482,17 @@ extern int _IO_vfscanf (_IO_FILE * __restrict, const char * __restrict, _IO_va_list, int *__restrict); extern int _IO_vfprintf (_IO_FILE *__restrict, const char *__restrict, _IO_va_list); -extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t) __THROW; -extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t) __THROW; +extern _IO_ssize_t _IO_padn (_IO_FILE *, int, _IO_ssize_t); +extern _IO_size_t _IO_sgetn (_IO_FILE *, void *, _IO_size_t); -extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW; +extern _IO_off64_t _IO_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_off64_t _IO_seekpos (_IO_FILE *, _IO_off64_t, int); extern void _IO_free_backup_area (_IO_FILE *) __THROW; #if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T -extern _IO_wint_t _IO_getwc (_IO_FILE *__fp) __THROW; -extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp) __THROW; +extern _IO_wint_t _IO_getwc (_IO_FILE *__fp); +extern _IO_wint_t _IO_putwc (wchar_t __wc, _IO_FILE *__fp); extern int _IO_fwide (_IO_FILE *__fp, int __mode) __THROW; # if __GNUC__ >= 2 /* While compiling glibc we have to handle compatibility with very old @@ -531,7 +531,7 @@ extern int _IO_vfwscanf (_IO_FILE * __restrict, const wchar_t * __restrict, _IO_va_list, int *__restrict); extern int _IO_vfwprintf (_IO_FILE *__restrict, const wchar_t *__restrict, _IO_va_list); -extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t) __THROW; +extern _IO_ssize_t _IO_wpadn (_IO_FILE *, wint_t, _IO_ssize_t); extern void _IO_free_wbackup_area (_IO_FILE *) __THROW; #endif diff --git a/libio/libioP.h b/libio/libioP.h index a2cd4c2202..a574b40f77 100644 --- a/libio/libioP.h +++ b/libio/libioP.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1997-2003,2004,2005,2006 +/* Copyright (C) 1993, 1997-2003,2004,2005,2006,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -380,7 +380,7 @@ typedef struct _IO_FILE *_IO_ITER; extern void _IO_switch_to_main_get_area (_IO_FILE *) __THROW; extern void _IO_switch_to_backup_area (_IO_FILE *) __THROW; -extern int _IO_switch_to_get_mode (_IO_FILE *) __THROW; +extern int _IO_switch_to_get_mode (_IO_FILE *); extern void _IO_init (_IO_FILE *, int) __THROW; extern int _IO_sputbackc (_IO_FILE *, int) __THROW; extern int _IO_sungetc (_IO_FILE *) __THROW; @@ -394,7 +394,7 @@ extern unsigned _IO_adjust_column (unsigned, const char *, int) __THROW; extern void _IO_switch_to_main_wget_area (_IO_FILE *) __THROW; extern void _IO_switch_to_wbackup_area (_IO_FILE *) __THROW; -extern int _IO_switch_to_wget_mode (_IO_FILE *) __THROW; +extern int _IO_switch_to_wget_mode (_IO_FILE *); extern void _IO_wsetb (_IO_FILE *, wchar_t *, wchar_t *, int) __THROW; extern wint_t _IO_sputbackwc (_IO_FILE *, wint_t) __THROW; extern wint_t _IO_sungetwc (_IO_FILE *) __THROW; @@ -404,8 +404,8 @@ extern unsigned _IO_adjust_wcolumn (unsigned, const wchar_t *, int) __THROW; /* Marker-related function. */ -extern void _IO_init_marker (struct _IO_marker *, _IO_FILE *) __THROW; -extern void _IO_init_wmarker (struct _IO_marker *, _IO_FILE *) __THROW; +extern void _IO_init_marker (struct _IO_marker *, _IO_FILE *); +extern void _IO_init_wmarker (struct _IO_marker *, _IO_FILE *); extern void _IO_remove_marker (struct _IO_marker *) __THROW; extern int _IO_marker_difference (struct _IO_marker *, struct _IO_marker *) __THROW; @@ -434,22 +434,22 @@ libc_hidden_proto (_IO_list_resetlock) /* Default jumptable functions. */ extern int _IO_default_underflow (_IO_FILE *) __THROW; -extern int _IO_default_uflow (_IO_FILE *) __THROW; -extern wint_t _IO_wdefault_uflow (_IO_FILE *) __THROW; +extern int _IO_default_uflow (_IO_FILE *); +extern wint_t _IO_wdefault_uflow (_IO_FILE *); extern int _IO_default_doallocate (_IO_FILE *) __THROW; extern int _IO_wdefault_doallocate (_IO_FILE *) __THROW; extern void _IO_default_finish (_IO_FILE *, int) __THROW; extern void _IO_wdefault_finish (_IO_FILE *, int) __THROW; extern int _IO_default_pbackfail (_IO_FILE *, int) __THROW; extern wint_t _IO_wdefault_pbackfail (_IO_FILE *, wint_t) __THROW; -extern _IO_FILE* _IO_default_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; +extern _IO_FILE* _IO_default_setbuf (_IO_FILE *, char *, _IO_ssize_t); extern _IO_size_t _IO_default_xsputn (_IO_FILE *, const void *, _IO_size_t); extern _IO_size_t _IO_wdefault_xsputn (_IO_FILE *, const void *, _IO_size_t); extern _IO_size_t _IO_default_xsgetn (_IO_FILE *, void *, _IO_size_t); extern _IO_size_t _IO_wdefault_xsgetn (_IO_FILE *, void *, _IO_size_t); extern _IO_off64_t _IO_default_seekoff (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_off64_t _IO_default_seekpos (_IO_FILE *, _IO_off64_t, int) __THROW; +extern _IO_off64_t _IO_default_seekpos (_IO_FILE *, _IO_off64_t, int); extern _IO_ssize_t _IO_default_write (_IO_FILE *, const void *, _IO_ssize_t); extern _IO_ssize_t _IO_default_read (_IO_FILE *, void *, _IO_ssize_t); extern int _IO_default_stat (_IO_FILE *, void *) __THROW; @@ -473,22 +473,22 @@ extern const struct _IO_jump_t _IO_old_proc_jumps attribute_hidden; extern const struct _IO_jump_t _IO_str_jumps attribute_hidden; extern const struct _IO_jump_t _IO_wstr_jumps attribute_hidden; extern const struct _IO_codecvt __libio_codecvt attribute_hidden; -extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; -extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t) __THROW; -extern int _IO_flush_all_lockp (int) __THROW; -extern int _IO_flush_all (void) __THROW; -extern int _IO_cleanup (void) __THROW; -extern void _IO_flush_all_linebuffered (void) __THROW; -extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *) __THROW; -extern int _IO_old_fgetpos (_IO_FILE *, _IO_fpos_t *) __THROW; -extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *) __THROW; -extern int _IO_old_fsetpos (_IO_FILE *, const _IO_fpos_t *) __THROW; -extern int _IO_new_fgetpos64 (_IO_FILE *, _IO_fpos64_t *) __THROW; -extern int _IO_old_fgetpos64 (_IO_FILE *, _IO_fpos64_t *) __THROW; -extern int _IO_new_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *) __THROW; -extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *) __THROW; +extern int _IO_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t); +extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t); +extern int _IO_flush_all_lockp (int); +extern int _IO_flush_all (void); +extern int _IO_cleanup (void); +extern void _IO_flush_all_linebuffered (void); +extern int _IO_new_fgetpos (_IO_FILE *, _IO_fpos_t *); +extern int _IO_old_fgetpos (_IO_FILE *, _IO_fpos_t *); +extern int _IO_new_fsetpos (_IO_FILE *, const _IO_fpos_t *); +extern int _IO_old_fsetpos (_IO_FILE *, const _IO_fpos_t *); +extern int _IO_new_fgetpos64 (_IO_FILE *, _IO_fpos64_t *); +extern int _IO_old_fgetpos64 (_IO_FILE *, _IO_fpos64_t *); +extern int _IO_new_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *); +extern int _IO_old_fsetpos64 (_IO_FILE *, const _IO_fpos64_t *); extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW; @@ -534,95 +534,79 @@ extern void _IO_old_init (_IO_FILE *fp, int flags) __THROW; /* Jumptable functions for files. */ extern int _IO_file_doallocate (_IO_FILE *) __THROW; -extern _IO_FILE* _IO_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_off64_t _IO_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; +extern _IO_FILE* _IO_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_off64_t _IO_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); extern _IO_off64_t _IO_file_seekoff_mmap (_IO_FILE *, _IO_off64_t, int, int) __THROW; -extern _IO_size_t _IO_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern _IO_size_t _IO_file_xsgetn (_IO_FILE *, void *, _IO_size_t) __THROW; +extern _IO_size_t _IO_file_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern _IO_size_t _IO_file_xsgetn (_IO_FILE *, void *, _IO_size_t); extern int _IO_file_stat (_IO_FILE *, void *) __THROW; extern int _IO_file_close (_IO_FILE *) __THROW; extern int _IO_file_close_mmap (_IO_FILE *) __THROW; -extern int _IO_file_underflow (_IO_FILE *) __THROW; -extern int _IO_file_underflow_mmap (_IO_FILE *) __THROW; -extern int _IO_file_underflow_maybe_mmap (_IO_FILE *) __THROW; -extern int _IO_file_overflow (_IO_FILE *, int) __THROW; +extern int _IO_file_underflow (_IO_FILE *); +extern int _IO_file_underflow_mmap (_IO_FILE *); +extern int _IO_file_underflow_maybe_mmap (_IO_FILE *); +extern int _IO_file_overflow (_IO_FILE *, int); #define _IO_file_is_open(__fp) ((__fp)->_fileno != -1) extern void _IO_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_file_attach (_IO_FILE *, int) __THROW; -extern _IO_FILE* _IO_file_open (_IO_FILE *, const char *, int, int, int, int) - __THROW; +extern _IO_FILE* _IO_file_attach (_IO_FILE *, int); +extern _IO_FILE* _IO_file_open (_IO_FILE *, const char *, int, int, int, int); libc_hidden_proto (_IO_file_open) -extern _IO_FILE* _IO_file_fopen (_IO_FILE *, const char *, const char *, int) - __THROW; -extern _IO_ssize_t _IO_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern _IO_ssize_t _IO_file_read (_IO_FILE *, void *, _IO_ssize_t) __THROW; -extern int _IO_file_sync (_IO_FILE *) __THROW; -extern int _IO_file_close_it (_IO_FILE *) __THROW; +extern _IO_FILE* _IO_file_fopen (_IO_FILE *, const char *, const char *, int); +extern _IO_ssize_t _IO_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern _IO_ssize_t _IO_file_read (_IO_FILE *, void *, _IO_ssize_t); +extern int _IO_file_sync (_IO_FILE *); +extern int _IO_file_close_it (_IO_FILE *); extern _IO_off64_t _IO_file_seek (_IO_FILE *, _IO_off64_t, int) __THROW; -extern void _IO_file_finish (_IO_FILE *, int) __THROW; +extern void _IO_file_finish (_IO_FILE *, int); -extern _IO_FILE* _IO_new_file_attach (_IO_FILE *, int) __THROW; -extern int _IO_new_file_close_it (_IO_FILE *) __THROW; -extern void _IO_new_file_finish (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_new_file_attach (_IO_FILE *, int); +extern int _IO_new_file_close_it (_IO_FILE *); +extern void _IO_new_file_finish (_IO_FILE *, int); extern _IO_FILE* _IO_new_file_fopen (_IO_FILE *, const char *, const char *, - int) __THROW; + int); extern void _IO_no_init (_IO_FILE *, int, int, struct _IO_wide_data *, const struct _IO_jump_t *) __THROW; extern void _IO_new_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_new_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_FILE* _IO_file_setbuf_mmap (_IO_FILE *, char *, _IO_ssize_t) - __THROW; -extern int _IO_new_file_sync (_IO_FILE *) __THROW; -extern int _IO_new_file_underflow (_IO_FILE *) __THROW; -extern int _IO_new_file_overflow (_IO_FILE *, int) __THROW; -extern _IO_off64_t _IO_new_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; -extern _IO_ssize_t _IO_new_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern _IO_size_t _IO_new_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; - -extern _IO_FILE* _IO_old_file_setbuf (_IO_FILE *, char *, _IO_ssize_t) __THROW; -extern _IO_off64_t _IO_old_file_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; -extern _IO_size_t _IO_old_file_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern int _IO_old_file_underflow (_IO_FILE *) __THROW; -extern int _IO_old_file_overflow (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_new_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_FILE* _IO_file_setbuf_mmap (_IO_FILE *, char *, _IO_ssize_t); +extern int _IO_new_file_sync (_IO_FILE *); +extern int _IO_new_file_underflow (_IO_FILE *); +extern int _IO_new_file_overflow (_IO_FILE *, int); +extern _IO_off64_t _IO_new_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_ssize_t _IO_new_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern _IO_size_t _IO_new_file_xsputn (_IO_FILE *, const void *, _IO_size_t); + +extern _IO_FILE* _IO_old_file_setbuf (_IO_FILE *, char *, _IO_ssize_t); +extern _IO_off64_t _IO_old_file_seekoff (_IO_FILE *, _IO_off64_t, int, int); +extern _IO_size_t _IO_old_file_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern int _IO_old_file_underflow (_IO_FILE *); +extern int _IO_old_file_overflow (_IO_FILE *, int); extern void _IO_old_file_init (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_old_file_attach (_IO_FILE *, int) __THROW; -extern _IO_FILE* _IO_old_file_fopen (_IO_FILE *, const char *, const char *) - __THROW; -extern _IO_ssize_t _IO_old_file_write (_IO_FILE *, const void *, _IO_ssize_t) - __THROW; -extern int _IO_old_file_sync (_IO_FILE *) __THROW; -extern int _IO_old_file_close_it (_IO_FILE *) __THROW; -extern void _IO_old_file_finish (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_old_file_attach (_IO_FILE *, int); +extern _IO_FILE* _IO_old_file_fopen (_IO_FILE *, const char *, const char *); +extern _IO_ssize_t _IO_old_file_write (_IO_FILE *, const void *, _IO_ssize_t); +extern int _IO_old_file_sync (_IO_FILE *); +extern int _IO_old_file_close_it (_IO_FILE *); +extern void _IO_old_file_finish (_IO_FILE *, int); extern int _IO_wfile_doallocate (_IO_FILE *) __THROW; -extern _IO_size_t _IO_wfile_xsputn (_IO_FILE *, const void *, _IO_size_t) - __THROW; -extern _IO_FILE* _IO_wfile_setbuf (_IO_FILE *, wchar_t *, _IO_ssize_t) __THROW; -extern wint_t _IO_wfile_sync (_IO_FILE *) __THROW; -extern wint_t _IO_wfile_underflow (_IO_FILE *) __THROW; -extern wint_t _IO_wfile_overflow (_IO_FILE *, wint_t) __THROW; -extern _IO_off64_t _IO_wfile_seekoff (_IO_FILE *, _IO_off64_t, int, int) - __THROW; +extern _IO_size_t _IO_wfile_xsputn (_IO_FILE *, const void *, _IO_size_t); +extern _IO_FILE* _IO_wfile_setbuf (_IO_FILE *, wchar_t *, _IO_ssize_t); +extern wint_t _IO_wfile_sync (_IO_FILE *); +extern wint_t _IO_wfile_underflow (_IO_FILE *); +extern wint_t _IO_wfile_overflow (_IO_FILE *, wint_t); +extern _IO_off64_t _IO_wfile_seekoff (_IO_FILE *, _IO_off64_t, int, int); /* Jumptable functions for proc_files. */ extern _IO_FILE* _IO_proc_open (_IO_FILE *, const char *, const char *) __THROW; extern _IO_FILE* _IO_new_proc_open (_IO_FILE *, const char *, const char *) __THROW; -extern _IO_FILE* _IO_old_proc_open (_IO_FILE *, const char *, const char *) - __THROW; +extern _IO_FILE* _IO_old_proc_open (_IO_FILE *, const char *, const char *); extern int _IO_proc_close (_IO_FILE *) __THROW; extern int _IO_new_proc_close (_IO_FILE *) __THROW; -extern int _IO_old_proc_close (_IO_FILE *) __THROW; +extern int _IO_old_proc_close (_IO_FILE *); /* Jumptable functions for strfiles. */ extern int _IO_str_underflow (_IO_FILE *) __THROW; @@ -660,73 +644,62 @@ extern int _IO_vsnprintf (char *string, _IO_size_t maxlen, extern _IO_size_t _IO_getline (_IO_FILE *,char *, _IO_size_t, int, int); extern _IO_size_t _IO_getline_info (_IO_FILE *,char *, _IO_size_t, int, int, int *); -extern _IO_ssize_t _IO_getdelim (char **, _IO_size_t *, int, _IO_FILE *) - __THROW; +extern _IO_ssize_t _IO_getdelim (char **, _IO_size_t *, int, _IO_FILE *); extern _IO_size_t _IO_getwline (_IO_FILE *,wchar_t *, _IO_size_t, wint_t, int); extern _IO_size_t _IO_getwline_info (_IO_FILE *,wchar_t *, _IO_size_t, wint_t, int, wint_t *); -extern double _IO_strtod (const char *, char **) __THROW; -extern char *_IO_dtoa (double __d, int __mode, int __ndigits, - int *__decpt, int *__sign, char **__rve) __THROW; -extern int _IO_outfloat (double __value, _IO_FILE *__sb, int __type, - int __width, int __precision, int __flags, - int __sign_mode, int __fill) __THROW; extern struct _IO_FILE_plus *_IO_list_all; extern void (*_IO_cleanup_registration_needed) (void); /* Prototype for functions with alternative entry point. */ -extern int _IO_flush_all_internal (void) __THROW; -extern unsigned _IO_adjust_column_internal (unsigned, const char *, int) - __THROW; +extern int _IO_flush_all_internal (void); +extern unsigned _IO_adjust_column_internal (unsigned, const char *, int); -extern int _IO_default_uflow_internal (_IO_FILE *) __THROW; +extern int _IO_default_uflow_internal (_IO_FILE *); extern void _IO_default_finish_internal (_IO_FILE *, int) __THROW; extern int _IO_default_pbackfail_internal (_IO_FILE *, int) __THROW; extern _IO_size_t _IO_default_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; -extern _IO_size_t _IO_default_xsgetn_internal (_IO_FILE *, void *, _IO_size_t) - __THROW; + _IO_size_t); +extern _IO_size_t _IO_default_xsgetn_internal (_IO_FILE *, void *, _IO_size_t); extern int _IO_default_doallocate_internal (_IO_FILE *) __THROW; extern void _IO_wdefault_finish_internal (_IO_FILE *, int) __THROW; extern wint_t _IO_wdefault_pbackfail_internal (_IO_FILE *, wint_t) __THROW; extern _IO_size_t _IO_wdefault_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; + _IO_size_t); extern _IO_size_t _IO_wdefault_xsgetn_internal (_IO_FILE *, void *, - _IO_size_t) __THROW; + _IO_size_t); extern int _IO_wdefault_doallocate_internal (_IO_FILE *) __THROW; -extern wint_t _IO_wdefault_uflow_internal (_IO_FILE *) __THROW; +extern wint_t _IO_wdefault_uflow_internal (_IO_FILE *); extern int _IO_file_doallocate_internal (_IO_FILE *) __THROW; -extern _IO_FILE* _IO_file_setbuf_internal (_IO_FILE *, char *, _IO_ssize_t) - __THROW; +extern _IO_FILE* _IO_file_setbuf_internal (_IO_FILE *, char *, _IO_ssize_t); extern _IO_off64_t _IO_file_seekoff_internal (_IO_FILE *, _IO_off64_t, - int, int) __THROW; + int, int); extern _IO_size_t _IO_file_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; -extern _IO_size_t _IO_file_xsgetn_internal (_IO_FILE *, void *, _IO_size_t) - __THROW; + _IO_size_t); +extern _IO_size_t _IO_file_xsgetn_internal (_IO_FILE *, void *, _IO_size_t); extern int _IO_file_stat_internal (_IO_FILE *, void *) __THROW; extern int _IO_file_close_internal (_IO_FILE *) __THROW; -extern int _IO_file_close_it_internal (_IO_FILE *) __THROW; -extern int _IO_file_underflow_internal (_IO_FILE *) __THROW; -extern int _IO_file_overflow_internal (_IO_FILE *, int) __THROW; +extern int _IO_file_close_it_internal (_IO_FILE *); +extern int _IO_file_underflow_internal (_IO_FILE *); +extern int _IO_file_overflow_internal (_IO_FILE *, int); extern void _IO_file_init_internal (struct _IO_FILE_plus *) __THROW; -extern _IO_FILE* _IO_file_attach_internal (_IO_FILE *, int) __THROW; +extern _IO_FILE* _IO_file_attach_internal (_IO_FILE *, int); extern _IO_FILE* _IO_file_fopen_internal (_IO_FILE *, const char *, - const char *, int) __THROW; + const char *, int); extern _IO_ssize_t _IO_file_read_internal (_IO_FILE *, void *, _IO_ssize_t); -extern int _IO_file_sync_internal (_IO_FILE *) __THROW; +extern int _IO_file_sync_internal (_IO_FILE *); extern _IO_off64_t _IO_file_seek_internal (_IO_FILE *, _IO_off64_t, int) __THROW; -extern void _IO_file_finish_internal (_IO_FILE *, int) __THROW; +extern void _IO_file_finish_internal (_IO_FILE *, int); extern _IO_size_t _IO_wfile_xsputn_internal (_IO_FILE *, const void *, - _IO_size_t) __THROW; + _IO_size_t); extern _IO_off64_t _IO_wfile_seekoff_internal (_IO_FILE *, _IO_off64_t, - int, int) __THROW; -extern wint_t _IO_wfile_sync_internal (_IO_FILE *) __THROW; + int, int); +extern wint_t _IO_wfile_sync_internal (_IO_FILE *); extern int _IO_str_underflow_internal (_IO_FILE *) __THROW; extern int _IO_str_overflow_internal (_IO_FILE *, int) __THROW; @@ -747,12 +720,12 @@ extern void _IO_wdoallocbuf_internal (_IO_FILE *) __THROW; extern _IO_size_t _IO_sgetn_internal (_IO_FILE *, void *, _IO_size_t); extern void _IO_flush_all_linebuffered_internal (void) __THROW; -extern int _IO_switch_to_wget_mode_internal (_IO_FILE *) __THROW; +extern int _IO_switch_to_wget_mode_internal (_IO_FILE *); extern void _IO_unsave_markers_internal (_IO_FILE *) __THROW; extern void _IO_switch_to_main_wget_area_internal (_IO_FILE *) __THROW; extern int _IO_wdo_write_internal (_IO_FILE *, const wchar_t *, _IO_size_t); extern int _IO_do_write_internal (_IO_FILE *, const char *, _IO_size_t); -extern _IO_ssize_t _IO_padn_internal (_IO_FILE *, int, _IO_ssize_t) __THROW; +extern _IO_ssize_t _IO_padn_internal (_IO_FILE *, int, _IO_ssize_t); extern _IO_size_t _IO_getline_info_internal (_IO_FILE *,char *, _IO_size_t, int, int, int *); extern _IO_size_t _IO_getline_internal (_IO_FILE *, char *, _IO_size_t, int, @@ -762,7 +735,7 @@ extern void _IO_free_backup_area_internal (_IO_FILE *) __THROW; extern void _IO_switch_to_wbackup_area_internal (_IO_FILE *) __THROW; extern void _IO_setb_internal (_IO_FILE *, char *, char *, int) __THROW; extern wint_t _IO_sputbackwc_internal (_IO_FILE *, wint_t) __THROW; -extern int _IO_switch_to_get_mode_internal (_IO_FILE *) __THROW; +extern int _IO_switch_to_get_mode_internal (_IO_FILE *); extern int _IO_vfscanf_internal (_IO_FILE * __restrict, const char * __restrict, _IO_va_list, int *__restrict); @@ -772,9 +745,9 @@ extern void _IO_doallocbuf_internal (_IO_FILE *) __THROW; extern void _IO_wsetb_internal (_IO_FILE *, wchar_t *, wchar_t *, int) __THROW; extern _IO_off64_t _IO_seekoff_unlocked (_IO_FILE *, _IO_off64_t, int, int) - attribute_hidden __THROW; + attribute_hidden; extern _IO_off64_t _IO_seekpos_unlocked (_IO_FILE *, _IO_off64_t, int) - attribute_hidden __THROW; + attribute_hidden; extern int _IO_putc_internal (int __c, _IO_FILE *__fp); extern void _IO_init_internal (_IO_FILE *, int) __THROW; extern void _IO_un_link_internal (struct _IO_FILE_plus *) __THROW; @@ -866,12 +839,6 @@ extern void _IO_un_link_internal (struct _IO_FILE_plus *) __THROW; #ifndef OS_FSTAT # define OS_FSTAT fstat #endif -struct stat; -extern _IO_ssize_t _IO_read (int, void *, _IO_size_t); -extern _IO_ssize_t _IO_write (int, const void *, _IO_size_t); -extern _IO_off64_t _IO_lseek (int, _IO_off64_t, int) __THROW; -extern int _IO_close (int); -extern int _IO_fstat (int, struct stat *) __THROW; extern int _IO_vscanf (const char *, _IO_va_list) __THROW; /* _IO_pos_BAD is an _IO_off64_t value indicating error, unknown, or EOF. */ diff --git a/libio/oldfileops.c b/libio/oldfileops.c index a69c87e8b8..3bd0aa175b 100644 --- a/libio/oldfileops.c +++ b/libio/oldfileops.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993, 1995, 1997-2004, 2005 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997-2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Per Bothner <bothner@cygnus.com>. @@ -271,7 +272,7 @@ _IO_old_file_setbuf (fp, p, len) return fp; } -static int old_do_write (_IO_FILE *, const char *, _IO_size_t) __THROW; +static int old_do_write (_IO_FILE *, const char *, _IO_size_t); /* Write TO_DO bytes from DATA to FP. Then mark FP as having empty buffers. */ diff --git a/locale/programs/locarchive.c b/locale/programs/locarchive.c index 201700dcb0..c1242db164 100644 --- a/locale/programs/locarchive.c +++ b/locale/programs/locarchive.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2002, 2003, 2005 Free Software Foundation, Inc. +/* Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2002. @@ -64,9 +64,9 @@ static const char *locnames[] = /* Size of the initial archive header. */ -#define INITIAL_NUM_NAMES 450 -#define INITIAL_SIZE_STRINGS 3500 -#define INITIAL_NUM_LOCREC 350 +#define INITIAL_NUM_NAMES 900 +#define INITIAL_SIZE_STRINGS 7500 +#define INITIAL_NUM_LOCREC 420 #define INITIAL_NUM_SUMS 2000 @@ -88,6 +88,7 @@ create_archive (const char *archivefname, struct locarhandle *ah) /* Create the initial content of the archive. */ head.magic = AR_MAGIC; + head.serial = 0; head.namehash_offset = sizeof (struct locarhead); head.namehash_used = 0; head.namehash_size = next_prime (INITIAL_NUM_NAMES); @@ -217,9 +218,12 @@ oldlocrecentcmp (const void *a, const void *b) } -/* forward decl for below */ +/* forward decls for below */ static uint32_t add_locale (struct locarhandle *ah, const char *name, locale_data_t data, bool replace); +void add_alias (struct locarhandle *ah, const char *alias, + bool replace, const char *oldname, + uint32_t *locrec_offset_p); static void enlarge_archive (struct locarhandle *ah, const struct locarhead *head) @@ -350,6 +354,7 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) qsort (oldlocrecarray, loccnt, sizeof (struct oldlocrecent), oldlocrecentcmp); + uint32_t last_locrec_offset = 0; for (cnt = 0; cnt < loccnt; ++cnt) { /* Insert this entry in the new hash table. */ @@ -368,10 +373,25 @@ enlarge_archive (struct locarhandle *ah, const struct locarhead *head) old_data[idx].sum); } - if (add_locale (&new_ah, - ((char *) ah->addr - + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset), - old_data, 0) == 0) + if (cnt > 0 && oldlocrecarray[cnt - 1].locrec == oldlocrec) + { + const char *oldname + = ((char *) ah->addr + + oldnamehashtab[oldlocrecarray[cnt - 1].cnt].name_offset); + + add_alias (&new_ah, + ((char *) ah->addr + + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset), + 0, oldname, &last_locrec_offset); + continue; + } + + last_locrec_offset = + add_locale (&new_ah, + ((char *) ah->addr + + oldnamehashtab[oldlocrecarray[cnt].cnt].name_offset), + old_data, 0); + if (last_locrec_offset == 0) error (EXIT_FAILURE, 0, _("cannot extend locale archive file")); } @@ -1428,7 +1448,7 @@ show_archive_content (int verbose) int sumused; files = (struct dataent *) xmalloc (head->sumhash_used - * sizeof (struct sumhashent)); + * sizeof (struct dataent)); sumhashtab = (struct sumhashent *) ((char *) ah.addr + head->sumhash_offset); diff --git a/math/bug-nextafter.c b/math/bug-nextafter.c index 2a967c75bf..1d21841ea6 100644 --- a/math/bug-nextafter.c +++ b/math/bug-nextafter.c @@ -4,6 +4,9 @@ #include <stdlib.h> #include <stdio.h> +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -34,6 +37,81 @@ main (void) ++result; } + i = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (m, i); + if (i < 0 || i >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + i = 0; + feclearexcept (FE_ALL_EXCEPT); + i = nextafterf (-m, -i); + if (i > 0 || i <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + i = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, i) != 0.0) + { + puts ("nextafterf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nextafterf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterf (m, -i) != 0.0) + { + puts ("nextafterf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterf- did not underflow"); + ++result; + } + double di = INFINITY; double dm = DBL_MAX; feclearexcept (FE_ALL_EXCEPT); @@ -59,5 +137,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nextafter (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, di) != 0.0) + { + puts ("nextafter+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nextafter (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafter (dm, -di) != 0.0) + { + puts ("nextafter- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafter- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != li) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (-lm, -li) != -li) + { + puts ("nextafterl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nextafterl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nextafterl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, li) != 0.0) + { + puts ("nextafterl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nextafterl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nextafterl (lm, -li) != 0.0) + { + puts ("nextafterl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nextafterl- did not underflow"); + ++result; + } +#endif + return result; } diff --git a/math/bug-nexttoward.c b/math/bug-nexttoward.c index e306a129c2..ff57e5e3f5 100644 --- a/math/bug-nexttoward.c +++ b/math/bug-nexttoward.c @@ -4,6 +4,9 @@ #include <stdlib.h> #include <stdio.h> +float zero = 0.0; +float inf = INFINITY; + int main (void) { @@ -35,6 +38,81 @@ main (void) ++result; } + fi = 0; + m = FLT_MIN; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (m, fi); + if (fi < 0 || fi >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + fi = 0; + feclearexcept (FE_ALL_EXCEPT); + fi = nexttowardf (-m, -fi); + if (fi > 0 || fi <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + fi = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (zero, inf); + if (m < 0.0 || m >= FLT_MIN) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, fi) != 0.0) + { + puts ("nexttowardf+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + m = nexttowardf (copysignf (zero, -1.0), -inf); + if (m > 0.0 || m <= -FLT_MIN) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardf (m, -fi) != 0.0) + { + puts ("nexttowardf- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardf- did not underflow"); + ++result; + } + tl = (long double) DBL_MAX + 1.0e305L; double di = INFINITY; double dm = DBL_MAX; @@ -61,5 +139,182 @@ main (void) ++result; } + di = 0; + dm = DBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (dm, di); + if (di < 0 || di >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + di = 0; + feclearexcept (FE_ALL_EXCEPT); + di = nexttoward (-dm, -di); + if (di > 0 || di <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + di = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (zero, inf); + if (dm < 0.0 || dm >= DBL_MIN) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, di) != 0.0) + { + puts ("nexttoward+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + dm = nexttoward (copysign (zero, -1.0), -inf); + if (dm > 0.0 || dm <= -DBL_MIN) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttoward (dm, -di) != 0.0) + { + puts ("nexttoward- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttoward- did not underflow"); + ++result; + } + +#ifndef NO_LONG_DOUBLE + long double li = INFINITY; + long double lm = LDBL_MAX; + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != li) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl+ did not overflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (-lm, -li) != -li) + { + puts ("nexttowardl failed"); + ++result; + } + if (fetestexcept (FE_OVERFLOW) == 0) + { + puts ("nexttowardl- did not overflow"); + ++result; + } + + li = 0; + lm = LDBL_MIN; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (lm, li); + if (li < 0 || li >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + li = 0; + feclearexcept (FE_ALL_EXCEPT); + li = nexttowardl (-lm, -li); + if (li > 0 || li <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + li = -INFINITY; + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (zero, inf); + if (lm < 0.0 || lm >= LDBL_MIN) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, li) != 0.0) + { + puts ("nexttowardl+ failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl+ did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + lm = nexttowardl (copysign (zero, -1.0), -inf); + if (lm > 0.0 || lm <= -LDBL_MIN) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } + feclearexcept (FE_ALL_EXCEPT); + if (nexttowardl (lm, -li) != 0.0) + { + puts ("nexttowardl- failed"); + ++result; + } + if (fetestexcept (FE_UNDERFLOW) == 0) + { + puts ("nexttowardl- did not underflow"); + ++result; + } +#endif + return result; } diff --git a/math/math_private.h b/math/math_private.h index 572e546831..129646f8c5 100644 --- a/math/math_private.h +++ b/math/math_private.h @@ -332,4 +332,10 @@ extern double __slowexp (double __x); extern double __slowpow (double __x, double __y, double __z); extern void __docos (double __x, double __dx, double __v[]); +#ifndef math_opt_barrier +#define math_opt_barrier(x) \ +({ __typeof (x) __x = x; __asm ("" : "+m" (__x)); __x; }) +#define math_force_eval(x) __asm __volatile ("" : : "m" (x)) +#endif + #endif /* _MATH_PRIVATE_H_ */ diff --git a/math/s_nextafter.c b/math/s_nextafter.c index 9c678b79c5..d2af52dda3 100644 --- a/math/s_nextafter.c +++ b/math/s_nextafter.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp #define nexttoward __internal_nexttoward #include <math.h> -#include "math_private.h" +#include <math_private.h> #include <float.h> #ifdef __STDC__ @@ -49,9 +49,12 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ + double u; INSERT_WORDS(x,hy&0x80000000,1); /* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u*u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ @@ -74,15 +77,12 @@ static char rcsid[] = "$NetBSD: s_nextafter.c,v 1.8 1995/05/10 20:47:58 jtc Exp if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; /* overflow */ } - if(hy<0x00100000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - INSERT_WORDS(y,hx,lx); - return y; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/math/s_nexttowardf.c b/math/s_nexttowardf.c index 1a1026612e..0494d1a4e9 100644 --- a/math/s_nexttowardf.c +++ b/math/s_nexttowardf.c @@ -21,7 +21,7 @@ */ #include <math.h> -#include "math_private.h" +#include <math_private.h> #include <float.h> #ifdef __STDC__ @@ -45,10 +45,12 @@ return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>20)-0x380 @@ -70,15 +72,12 @@ x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0) /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; } - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/math/test-fenv.c b/math/test-fenv.c index 78127c338e..4b710d83f3 100644 --- a/math/test-fenv.c +++ b/math/test-fenv.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 1998, 2000, 2001, 2003 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 2000, 2001, 2003, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de> and Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -636,6 +637,102 @@ feenv_tests (void) } +static void +feholdexcept_tests (void) +{ + fenv_t saved, saved2; + int res; + + feclearexcept (FE_ALL_EXCEPT); + fedisableexcept (FE_ALL_EXCEPT); +#ifdef FE_DIVBYZERO + feraiseexcept (FE_DIVBYZERO); +#endif + test_exceptions ("feholdexcept_tests FE_DIVBYZERO test", + DIVBYZERO_EXC, 0); + res = feholdexcept (&saved); + if (res != 0) + { + printf ("feholdexcept failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_TOWARDZERO + res = fesetround (FE_TOWARDZERO); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests 0 test", NO_EXC, 0); + feraiseexcept (FE_INVALID); + test_exceptions ("feholdexcept_tests FE_INVALID test", + INVALID_EXC, 0); + res = feupdateenv (&saved); + if (res != 0) + { + printf ("feupdateenv failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_TOWARDZERO + res = fegetround (); + if (res != FE_TONEAREST) + { + printf ("feupdateenv didn't restore rounding mode: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests FE_DIVBYZERO|FE_INVALID test", + DIVBYZERO_EXC | INVALID_EXC, 0); + feclearexcept (FE_ALL_EXCEPT); + feraiseexcept (FE_INVALID); +#if defined FE_TONEAREST && defined FE_UPWARD + res = fesetround (FE_UPWARD); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + res = feholdexcept (&saved2); + if (res != 0) + { + printf ("feholdexcept failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_UPWARD + res = fesetround (FE_TONEAREST); + if (res != 0) + { + printf ("fesetround failed: %d\n", res); + ++count_errors; + } +#endif + test_exceptions ("feholdexcept_tests 0 2nd test", NO_EXC, 0); + feraiseexcept (FE_INEXACT); + test_exceptions ("feholdexcept_tests FE_INEXACT test", + INEXACT_EXC, 0); + res = feupdateenv (&saved2); + if (res != 0) + { + printf ("feupdateenv failed: %d\n", res); + ++count_errors; + } +#if defined FE_TONEAREST && defined FE_UPWARD + res = fegetround (); + if (res != FE_UPWARD) + { + printf ("feupdateenv didn't restore rounding mode: %d\n", res); + ++count_errors; + } + fesetround (FE_TONEAREST); +#endif + test_exceptions ("feholdexcept_tests FE_INEXACT|FE_INVALID test", + INVALID_EXC | INEXACT_EXC, 0); + feclearexcept (FE_ALL_EXCEPT); +} + + /* IEC 559 and ISO C99 define a default startup environment */ static void initial_tests (void) @@ -654,6 +751,7 @@ main (void) initial_tests (); fe_tests (); feenv_tests (); + feholdexcept_tests (); if (count_errors) { diff --git a/nis/nis_call.c b/nis/nis_call.c index 32d47f8b84..fcf238db4e 100644 --- a/nis/nis_call.c +++ b/nis/nis_call.c @@ -772,15 +772,15 @@ __nisfind_server (const_nis_name name, int search_parent_first, if (result == NIS_SUCCESS) { - unsigned int server_len = (*dir)->do_servers.do_servers_len; + unsigned int server_len = obj->do_servers.do_servers_len; if (flags & MASTER_ONLY) server_len = 1; - result = __nisbind_create (dbp, (*dir)->do_servers.do_servers_val, + result = __nisbind_create (dbp, obj->do_servers.do_servers_val, server_len, ~0, ~0, flags); if (result == NIS_SUCCESS) { if ((flags & MASTER_ONLY) == 0 - || (*dir)->do_servers.do_servers_len == 1) + || obj->do_servers.do_servers_len == 1) { server_used = dbp->server_used; current_ep = dbp->current_ep; diff --git a/nptl/ChangeLog b/nptl/ChangeLog index eb35a94cc8..134b38a2fa 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,3 +1,8 @@ +2007-04-06 Ulrich Drepper <drepper@redhat.com> + + * tst-locale1.c: Avoid warnings. + * tst-locale2.c: Likewise. + 2007-03-19 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/unix/sysv/linux/powerpc/lowlevellock.h diff --git a/nptl/tst-locale1.c b/nptl/tst-locale1.c index 08b43704e5..2ee4c3fbce 100644 --- a/nptl/tst-locale1.c +++ b/nptl/tst-locale1.c @@ -10,7 +10,8 @@ int useless (void) { - pthread_create (0, 0, 0, 0); + pthread_t th; + pthread_create (&th, 0, (void *(*) (void *)) useless, 0); /* This is to check __libc_current_sigrt* can be used in statically linked apps. */ return SIGRTMIN; diff --git a/nptl/tst-locale2.c b/nptl/tst-locale2.c index 2c803e3ef0..c8821ad6b8 100644 --- a/nptl/tst-locale2.c +++ b/nptl/tst-locale2.c @@ -6,8 +6,9 @@ #include <pthread.h> /* This is never called, just here to get pthreads linked in. */ -void -useless (void) +void * +useless (void *a) { - pthread_create (0, 0, 0, 0); + pthread_t th; + pthread_create (&th, 0, useless, a); } diff --git a/posix/Makefile b/posix/Makefile index 74571cd036..467d0dc213 100644 --- a/posix/Makefile +++ b/posix/Makefile @@ -66,7 +66,7 @@ routines := \ spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \ spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam \ posix_madvise \ - get_child_max + get_child_max sched_cpucount include ../Makeconfig @@ -90,7 +90,7 @@ tests := tstgetopt testfnm runtests runptests \ tst-execv1 tst-execv2 tst-execl1 tst-execl2 \ tst-execve1 tst-execve2 tst-execle1 tst-execle2 \ tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \ - tst-getaddrinfo3 + tst-getaddrinfo3 tst-fnmatch2 tst-cpucount xtests := bug-ga2 ifeq (yes,$(build-shared)) test-srcs := globtest diff --git a/posix/Versions b/posix/Versions index f529ee9d8e..1e1bda8b7b 100644 --- a/posix/Versions +++ b/posix/Versions @@ -122,6 +122,9 @@ libc { GLIBC_2.3.4 { regexec; } + GLIBC_2.6 { + __sched_cpucount; + } GLIBC_PRIVATE { __libc_fork; __libc_pwrite; } diff --git a/posix/fnmatch.c b/posix/fnmatch.c index 3fa7c322d1..c6cdb88772 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003 +/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2002,2003,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -209,6 +209,7 @@ __wcschrnul (s, c) # define FCT internal_fnmatch # define EXT ext_match # define END end_pattern +# define STRUCT fnmatch_struct # define L(CS) CS # ifdef _LIBC # define BTOWC(C) __btowc (C) @@ -235,7 +236,8 @@ __wcschrnul (s, c) # define INT wint_t # define FCT internal_fnwmatch # define EXT ext_wmatch -# define END end_wpattern +# define END end_wpattern +# define STRUCT fnwmatch_struct # define L(CS) L##CS # define BTOWC(C) (C) # define STRLEN(S) __wcslen (S) @@ -397,12 +399,12 @@ fnmatch (pattern, string, flags) } return internal_fnwmatch (wpattern, wstring, wstring + n, - flags & FNM_PERIOD, flags); + flags & FNM_PERIOD, flags, NULL); } # endif /* mbstate_t and mbsrtowcs or _LIBC. */ return internal_fnmatch (pattern, string, string + strlen (string), - flags & FNM_PERIOD, flags); + flags & FNM_PERIOD, flags, NULL); } # ifdef _LIBC diff --git a/posix/fnmatch_loop.c b/posix/fnmatch_loop.c index 02a4e9030c..2bdd837184 100644 --- a/posix/fnmatch_loop.c +++ b/posix/fnmatch_loop.c @@ -1,5 +1,5 @@ -/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2003,2004,2005 - Free Software Foundation, Inc. +/* Copyright (C) 1991,1992,1993,1996,1997,1998,1999,2000,2001,2003,2004,2005, + 2007 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 @@ -17,10 +17,18 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ +struct STRUCT +{ + const CHAR *pattern; + const CHAR *string; + int no_leading_period; +}; + /* Match STRING against the filename pattern PATTERN, returning zero if it matches, nonzero if not. */ static int FCT (const CHAR *pattern, const CHAR *string, - const CHAR *string_end, int no_leading_period, int flags) + const CHAR *string_end, int no_leading_period, int flags, + struct STRUCT *ends) internal_function; static int EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, int no_leading_period, int flags) @@ -29,12 +37,13 @@ static const CHAR *END (const CHAR *patternp) internal_function; static int internal_function -FCT (pattern, string, string_end, no_leading_period, flags) +FCT (pattern, string, string_end, no_leading_period, flags, ends) const CHAR *pattern; const CHAR *string; const CHAR *string_end; int no_leading_period; int flags; + struct STRUCT *ends; { register const CHAR *p = pattern, *n = string; register UCHAR c; @@ -97,6 +106,13 @@ FCT (pattern, string, string_end, no_leading_period, flags) if (res != -1) return res; } + else if (ends != NULL) + { + ends->pattern = p - 1; + ends->string = n; + ends->no_leading_period = no_leading_period; + return 0; + } if (n != string_end && *n == L('.') && no_leading_period) return FNM_NOMATCH; @@ -157,7 +173,9 @@ FCT (pattern, string, string_end, no_leading_period, flags) else { const CHAR *endp; + struct STRUCT end; + end.pattern = NULL; endp = MEMCHR (n, (flags & FNM_FILE_NAME) ? L('/') : L('\0'), string_end - n); if (endp == NULL) @@ -170,36 +188,46 @@ FCT (pattern, string, string_end, no_leading_period, flags) { int flags2 = ((flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD)); - int no_leading_period2 = no_leading_period; - for (--p; n < endp; ++n, no_leading_period2 = 0) - if (FCT (p, n, string_end, no_leading_period2, flags2) - == 0) - return 0; + for (--p; n < endp; ++n, no_leading_period = 0) + if (FCT (p, n, string_end, no_leading_period, flags2, + &end) == 0) + goto found; } else if (c == L('/') && (flags & FNM_FILE_NAME)) { while (n < string_end && *n != L('/')) ++n; if (n < string_end && *n == L('/') - && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags) - == 0)) + && (FCT (p, n + 1, string_end, flags & FNM_PERIOD, flags, + NULL) == 0)) return 0; } else { int flags2 = ((flags & FNM_FILE_NAME) ? flags : (flags & ~FNM_PERIOD)); - int no_leading_period2 = no_leading_period; if (c == L('\\') && !(flags & FNM_NOESCAPE)) c = *p; c = FOLD (c); - for (--p; n < endp; ++n, no_leading_period2 = 0) + for (--p; n < endp; ++n, no_leading_period = 0) if (FOLD ((UCHAR) *n) == c - && (FCT (p, n, string_end, no_leading_period2, flags2) - == 0)) - return 0; + && (FCT (p, n, string_end, no_leading_period, flags2, + &end) == 0)) + { + found: + if (end.pattern == NULL) + return 0; + break; + } + if (end.pattern != NULL) + { + p = end.pattern; + n = end.string; + no_leading_period = end.no_leading_period; + continue; + } } } @@ -1098,7 +1126,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, switch (opt) { case L('*'): - if (FCT (p, string, string_end, no_leading_period, flags) == 0) + if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0) return 0; /* FALLTHROUGH */ @@ -1109,7 +1137,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, /* First match the prefix with the current pattern with the current pattern. */ if (FCT (list->str, string, rs, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0 + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + NULL) == 0 /* This was successful. Now match the rest with the rest of the pattern. */ && (FCT (p, rs, string_end, @@ -1117,7 +1146,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0, flags & FNM_FILE_NAME - ? flags : flags & ~FNM_PERIOD) == 0 + ? flags : flags & ~FNM_PERIOD, NULL) == 0 /* This didn't work. Try the whole pattern. */ || (rs != string && FCT (pattern - 1, rs, string_end, @@ -1126,7 +1155,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, : (rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0), flags & FNM_FILE_NAME - ? flags : flags & ~FNM_PERIOD) == 0))) + ? flags : flags & ~FNM_PERIOD, NULL) == 0))) /* It worked. Signal success. */ return 0; } @@ -1136,7 +1165,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, return FNM_NOMATCH; case L('?'): - if (FCT (p, string, string_end, no_leading_period, flags) == 0) + if (FCT (p, string, string_end, no_leading_period, flags, NULL) == 0) return 0; /* FALLTHROUGH */ @@ -1148,7 +1177,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, pattern list. */ if (FCT (STRCAT (list->str, p), string, string_end, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0) + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + NULL) == 0) /* It worked. Signal success. */ return 0; while ((list = list->next) != NULL); @@ -1163,7 +1193,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, for (runp = list; runp != NULL; runp = runp->next) if (FCT (runp->str, string, rs, no_leading_period, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) == 0) + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + NULL) == 0) break; /* If none of the patterns matched see whether the rest does. */ @@ -1172,8 +1203,8 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, rs == string ? no_leading_period : rs[-1] == '/' && NO_LEADING_PERIOD (flags) ? 1 : 0, - flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD) - == 0)) + flags & FNM_FILE_NAME ? flags : flags & ~FNM_PERIOD, + NULL) == 0)) /* This is successful. */ return 0; } @@ -1198,6 +1229,7 @@ EXT (INT opt, const CHAR *pattern, const CHAR *string, const CHAR *string_end, #undef FCT #undef EXT #undef END +#undef STRUCT #undef MEMPCPY #undef MEMCHR #undef STRCOLL diff --git a/posix/sched.h b/posix/sched.h index 7cfdbf1f96..becad0f365 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -1,5 +1,5 @@ /* Definitions for POSIX 1003.1b-1993 (aka POSIX.4) scheduling interface. - Copyright (C) 1996,1997,1999,2001-2003,2004 Free Software Foundation, Inc. + Copyright (C) 1996,1997,1999,2001-2004,2007 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 @@ -65,11 +65,12 @@ extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; #ifdef __USE_GNU /* Access macros for `cpu_set'. */ -#define CPU_SETSIZE __CPU_SETSIZE -#define CPU_SET(cpu, cpusetp) __CPU_SET (cpu, cpusetp) -#define CPU_CLR(cpu, cpusetp) __CPU_CLR (cpu, cpusetp) -#define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp) -#define CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp) +# define CPU_SETSIZE __CPU_SETSIZE +# define CPU_SET(cpu, cpusetp) __CPU_SET (cpu, cpusetp) +# define CPU_CLR(cpu, cpusetp) __CPU_CLR (cpu, cpusetp) +# define CPU_ISSET(cpu, cpusetp) __CPU_ISSET (cpu, cpusetp) +# define CPU_ZERO(cpusetp) __CPU_ZERO (cpusetp) +# define CPU_COUNT(cpusetp) __CPU_COUNT (cpusetp) /* Set the CPU affinity for a task */ diff --git a/posix/sched_cpucount.c b/posix/sched_cpucount.c new file mode 100644 index 0000000000..d7f6b7b49f --- /dev/null +++ b/posix/sched_cpucount.c @@ -0,0 +1,52 @@ +/* Copyright (C) 2007 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 + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <limits.h> +#include <sched.h> + + +int +__sched_cpucount (size_t setsize, cpu_set_t *setp) +{ + int s = 0; + for (unsigned int j = 0; j < setsize / sizeof (__cpu_mask); ++j) + { + __cpu_mask l = setp->__bits[j]; + if (l == 0) + continue; + +#if LONG_BIT > 32 + l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul); + l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul); + l = (l & 0x0f0f0f0f0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0f0f0f0f0ful); + l = (l & 0x00ff00ff00ff00fful) + ((l >> 8) & 0x00ff00ff00ff00fful); + l = (l & 0x0000ffff0000fffful) + ((l >> 16) & 0x0000ffff0000fffful); + l = (l & 0x00000000fffffffful) + ((l >> 32) & 0x00000000fffffffful); +#else + l = (l & 0x55555555ul) + ((l >> 1) & 0x55555555ul); + l = (l & 0x33333333ul) + ((l >> 2) & 0x33333333ul); + l = (l & 0x0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0ful); + l = (l & 0x00ff00fful) + ((l >> 8) & 0x00ff00fful); + l = (l & 0x0000fffful) + ((l >> 16) & 0x0000fffful); +#endif + + s += l; + } + + return s; +} diff --git a/posix/sys/wait.h b/posix/sys/wait.h index d7a58eab13..fe103570db 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005 +/* Copyright (C) 1991-1994,1996-2001,2003,2004,2005,2007 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -171,10 +171,6 @@ extern __pid_t wait3 (__WAIT_STATUS __stat_loc, int __options, #endif #ifdef __USE_BSD -/* This being here makes the prototypes valid whether or not - we have already included <sys/resource.h> to define `struct rusage'. */ -struct rusage; - /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage) __THROW; diff --git a/posix/tst-cpucount.c b/posix/tst-cpucount.c new file mode 100644 index 0000000000..fe3cded732 --- /dev/null +++ b/posix/tst-cpucount.c @@ -0,0 +1,27 @@ +#include <sched.h> +#include <stdio.h> + +static int +do_test (void) +{ + cpu_set_t c; + + CPU_ZERO (&c); + + for (int cnt = 0; cnt < 130; ++cnt) + { + int n = CPU_COUNT (&c); + if (n != cnt) + { + printf ("expected %d, not %d\n", cnt, n); + return 1; + } + + CPU_SET (cnt, &c); + } + + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/posix/tst-fnmatch2.c b/posix/tst-fnmatch2.c new file mode 100644 index 0000000000..28a0871c1c --- /dev/null +++ b/posix/tst-fnmatch2.c @@ -0,0 +1,35 @@ +#include <fnmatch.h> +#include <stdio.h> + +int +do_test (void) +{ + char pattern[] = "a*b*c*d*e*f*g*h*i*j*k*l*m*n*o*p*q*r*s*t*u*v*w*x*y*z*"; + const char *string = "aaaabbbbccccddddeeeeffffgggghhhhiiiijjjjkkkkllllmmmm" + "nnnnooooppppqqqqrrrrssssttttuuuuvvvvwwwwxxxxyyyy"; + if (fnmatch (pattern, string, 0) != FNM_NOMATCH) + { + puts ("First fnmatch didn't return FNM_NOMATCH"); + return 1; + } + pattern[(sizeof pattern) - 3] = '*'; + if (fnmatch (pattern, string, 0) != 0) + { + puts ("Second fnmatch didn't return 0"); + return 1; + } + if (fnmatch ("a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD) != FNM_NOMATCH) + { + puts ("Third fnmatch didn't return FNM_NOMATCH"); + return 1; + } + if (fnmatch ("a*b/*", "abbb/xy", FNM_PATHNAME | FNM_PERIOD) != 0) + { + puts ("Fourth fnmatch didn't return 0"); + return 1; + } + return 0; +} + +#define TEST_FUNCTION do_test () +#include "../test-skeleton.c" diff --git a/posix/unistd.h b/posix/unistd.h index c74190dfc3..577925c0fa 100644 --- a/posix/unistd.h +++ b/posix/unistd.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc. +/* Copyright (C) 1991-2006, 2007 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 @@ -56,7 +56,9 @@ __BEGIN_DECLS #define _POSIX2_LOCALEDEF 200112L /* X/Open version number to which the library conforms. It is selectable. */ -#ifdef __USE_UNIX98 +#ifdef __USE_XOPEN2K +# define _XOPEN_VERSION 600 +#elif defined __USE_UNIX98 # define _XOPEN_VERSION 500 #else # define _XOPEN_VERSION 4 diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c index c27c0d496c..9b796eac2f 100644 --- a/stdio-common/printf_fp.c +++ b/stdio-common/printf_fp.c @@ -990,7 +990,7 @@ ___printf_fp (FILE *fp, 0)) /* This is a special case: the rounded number is 1.0, the format is 'g' or 'G', and the alternative format - is selected. This means the result mist be "1.". */ + is selected. This means the result must be "1.". */ --added_zeros; } @@ -1081,12 +1081,17 @@ ___printf_fp (FILE *fp, /* This is another special case. The exponent of the number is really smaller than -4, which requires the 'e'/'E' format. But after rounding the number has an exponent of -4. */ - assert (wcp >= wstartp + 2); + assert (wcp >= wstartp + 1); assert (wstartp[0] == L'1'); __wmemcpy (wstartp, L"0.0001", 6); wstartp[1] = decimalwc; - wmemset (wstartp + 6, L'0', wcp - (wstartp + 2)); - wcp += 4; + if (wcp >= wstartp + 2) + { + wmemset (wstartp + 6, L'0', wcp - (wstartp + 2)); + wcp += 4; + } + else + wcp += 5; } else { diff --git a/stdio-common/tfformat.c b/stdio-common/tfformat.c index 0370834e9f..259e2e0b18 100644 --- a/stdio-common/tfformat.c +++ b/stdio-common/tfformat.c @@ -4020,6 +4020,7 @@ sprint_double_type sprint_doubles[] = {__LINE__, 0.000956, "0.001", "%#.0g"}, {__LINE__, 0.000098, "0.0001", "%#.0g"}, {__LINE__, 0.0000996, "0.00010", "%#.2g"}, + {__LINE__, 9.999999999999999e-05, "0.0001", "%g"}, {0 } diff --git a/sysdeps/i386/fpu/feholdexcpt.c b/sysdeps/i386/fpu/feholdexcpt.c index feaa24b8d9..e9fdfcae87 100644 --- a/sysdeps/i386/fpu/feholdexcpt.c +++ b/sysdeps/i386/fpu/feholdexcpt.c @@ -1,5 +1,6 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1999, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2003, 2004, 2005, 2007 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -26,14 +27,19 @@ int feholdexcept (fenv_t *envp) { - unsigned short int work; + fenv_t temp; /* Store the environment. */ - __asm__ ("fnstenv %0" : "=m" (*envp)); + __asm__ ("fnstenv %0" : "=m" (temp)); + *envp = temp; /* Now set all exceptions to non-stop. */ - work = envp->__control_word | 0x3f; - __asm__ ("fldcw %0" : : "m" (*&work)); + temp.__control_word |= 0x3f; + + /* And clear all exceptions. */ + temp.__status_word &= ~0x3f; + + __asm__ ("fldenv %0" : : "m" (temp)); /* If the CPU supports SSE we set the MXCSR as well. */ if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) @@ -43,8 +49,8 @@ feholdexcept (fenv_t *envp) /* Get the current control word. */ __asm__ ("stmxcsr %0" : "=m" (*&xwork)); - /* Set all exceptions to non-stop. */ - xwork |= 0x1f80; + /* Set all exceptions to non-stop and clear them. */ + xwork = (xwork | 0x1f80) & ~0x3f; __asm__ ("ldmxcsr %0" : : "m" (*&xwork)); } diff --git a/sysdeps/i386/fpu/feupdateenv.c b/sysdeps/i386/fpu/feupdateenv.c index a443f500bc..a58963837f 100644 --- a/sysdeps/i386/fpu/feupdateenv.c +++ b/sysdeps/i386/fpu/feupdateenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 1997,99,2000,01 Free Software Foundation, Inc. + Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. @@ -20,20 +20,29 @@ #include <fenv.h> #include <bp-sym.h> +#include <unistd.h> +#include <dl-procinfo.h> +#include <ldsodefs.h> int __feupdateenv (const fenv_t *envp) { fexcept_t temp; + unsigned int xtemp = 0; /* Save current exceptions. */ __asm__ ("fnstsw %0" : "=m" (*&temp)); - temp &= FE_ALL_EXCEPT; + + /* If the CPU supports SSE we test the MXCSR as well. */ + if ((GLRO(dl_hwcap) & HWCAP_I386_XMM) != 0) + __asm__ ("stmxcsr %0" : "=m" (*&xtemp)); + + temp = (temp | xtemp) & FE_ALL_EXCEPT; /* Install new environment. */ fesetenv (envp); - /* Raise the safed exception. Incidently for us the implementation + /* Raise the saved exception. Incidently for us the implementation defined format of the values in objects of type fexcept_t is the same as the ones specified using the FE_* constants. */ feraiseexcept ((int) temp); diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h new file mode 100644 index 0000000000..a426788ef1 --- /dev/null +++ b/sysdeps/i386/fpu/math_private.h @@ -0,0 +1,18 @@ +#ifndef _MATH_PRIVATE_H + +#define math_opt_barrier(x) \ +({ __typeof(x) __x; \ + __asm ("" : "=t" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "m" (x)); \ + else \ + __asm __volatile ("" : : "f" (x)); \ + } \ +while (0) + +#include <math/math_private.h> +#endif diff --git a/sysdeps/i386/fpu/s_nextafterl.c b/sysdeps/i386/fpu/s_nextafterl.c index 5b617cb4e7..aef0a144e5 100644 --- a/sysdeps/i386/fpu/s_nextafterl.c +++ b/sysdeps/i386/fpu/s_nextafterl.c @@ -27,7 +27,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -52,9 +52,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(esx>=0) { /* x > 0 */ if(esx>esy||((esx==esy) && (hx>hy||((hx==hy)&&(lx>ly))))) { @@ -109,12 +112,9 @@ static char rcsid[] = "$NetBSD: $"; } esy = esx&0x7fff; if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } + if(esy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; diff --git a/sysdeps/i386/fpu/s_nexttoward.c b/sysdeps/i386/fpu/s_nexttoward.c index 2bd768e448..9bd86a3724 100644 --- a/sysdeps/i386/fpu/s_nexttoward.c +++ b/sysdeps/i386/fpu/s_nexttoward.c @@ -27,7 +27,8 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> +#include <float.h> #ifdef __STDC__ double __nexttoward(double x, long double y) @@ -52,10 +53,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 @@ -85,16 +88,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7ff00000; if(hy>=0x7ff00000) { x = x+x; /* overflow */ - /* Force conversion to double. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/sysdeps/i386/fpu/s_nexttowardf.c b/sysdeps/i386/fpu/s_nexttowardf.c index 3fbe53c338..25f70e4f4d 100644 --- a/sysdeps/i386/fpu/s_nexttowardf.c +++ b/sysdeps/i386/fpu/s_nexttowardf.c @@ -19,7 +19,8 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include <math_private.h> +#include <float.h> #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -44,10 +45,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 @@ -69,16 +72,14 @@ static char rcsid[] = "$NetBSD: $"; hy = hx&0x7f800000; if(hy>=0x7f800000) { x = x+x; /* overflow */ - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/ia64/fpu/feholdexcpt.c b/sysdeps/ia64/fpu/feholdexcpt.c index 27c9a1109e..e50fbfada5 100644 --- a/sysdeps/ia64/fpu/feholdexcpt.c +++ b/sysdeps/ia64/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 1997, 1999, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1997, 1999, 2000, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999 @@ -23,12 +23,20 @@ int feholdexcept (fenv_t *envp) { + fenv_t fpsr; /* Save the current state. */ - fegetenv (envp); + __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr)); + *envp = fpsr; - /* set the trap disable bit */ - __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (*envp | FE_ALL_EXCEPT)); + /* Set the trap disable bits. */ + fpsr |= FE_ALL_EXCEPT; - return 1; + /* And clear the exception bits. */ + fpsr &= ~(fenv_t) (FE_ALL_EXCEPT << 13); + + __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr)); + + /* Success. */ + return 0; } libm_hidden_def (feholdexcept) diff --git a/sysdeps/ia64/fpu/fesetround.c b/sysdeps/ia64/fpu/fesetround.c index 351bcc2f10..13801c848b 100644 --- a/sysdeps/ia64/fpu/fesetround.c +++ b/sysdeps/ia64/fpu/fesetround.c @@ -1,5 +1,5 @@ /* Set current rounding direction. - Copyright (C) 1999, 2000, 2005 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2005, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999. @@ -26,7 +26,7 @@ fesetround (int round) fenv_t fpsr; if (round & ~3) - return 0; + return 1; /* Get the current state. */ __asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr)); @@ -37,6 +37,6 @@ fesetround (int round) /* Put the new state in effect. */ __asm__ __volatile__ ("mov.m ar.fpsr=%0" :: "r" (fpsr) : "memory"); - return 1; + return 0; } libm_hidden_def (fesetround) diff --git a/sysdeps/ia64/fpu/feupdateenv.c b/sysdeps/ia64/fpu/feupdateenv.c index 544c38485d..72f12287fa 100644 --- a/sysdeps/ia64/fpu/feupdateenv.c +++ b/sysdeps/ia64/fpu/feupdateenv.c @@ -1,5 +1,5 @@ /* Install given floating-point environment and raise exceptions. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. + Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999. @@ -32,10 +32,8 @@ feupdateenv (const fenv_t *envp) /* Install new environment. */ fesetenv (envp); - /* Raise the safed exception. Incidently for us the implementation - defined format of the values in objects of type fexcept_t is the - same as the ones specified using the FE_* constants. */ - feraiseexcept ((int) fpsr & FE_ALL_EXCEPT); + /* Raise the saved exceptions. */ + feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT); /* Success. */ return 0; diff --git a/sysdeps/ieee754/flt-32/s_nextafterf.c b/sysdeps/ieee754/flt-32/s_nextafterf.c index e1568e24c9..600c14621f 100644 --- a/sysdeps/ieee754/flt-32/s_nextafterf.c +++ b/sysdeps/ieee754/flt-32/s_nextafterf.c @@ -18,7 +18,7 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp #endif #include "math.h" -#include "math_private.h" +#include <math_private.h> #include <float.h> #ifdef __STDC__ @@ -40,9 +40,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp return x+y; if(x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ + float u; SET_FLOAT_WORD(x,(hy&0x80000000)|1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u*u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy) { /* x > y, x -= ulp */ @@ -61,15 +64,12 @@ static char rcsid[] = "$NetBSD: s_nextafterf.c,v 1.4 1995/05/10 20:48:01 jtc Exp if(hy>=0x7f800000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0) - asm ("" : "=m"(x) : "m"(x)); + asm ("" : "+m"(x)); return x; /* overflow */ } - if(hy<0x00800000) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(y,hx); - return y; - } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/ieee754/ldbl-128/s_nextafterl.c b/sysdeps/ieee754/ldbl-128/s_nextafterl.c index d3df668178..7bc869a518 100644 --- a/sysdeps/ieee754/ldbl-128/s_nextafterl.c +++ b/sysdeps/ieee754/ldbl-128/s_nextafterl.c @@ -25,7 +25,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -47,9 +47,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hx>hy||((hx==hy)&&(lx>ly))) { /* x > y, x -= ulp */ @@ -70,12 +73,9 @@ static char rcsid[] = "$NetBSD: $"; } hy = hx&0x7fff000000000000LL; if(hy==0x7fff000000000000LL) return x+x;/* overflow */ - if(hy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS64(y,hx,lx); - return y; - } + if(hy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS64(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-128/s_nexttoward.c b/sysdeps/ieee754/ldbl-128/s_nexttoward.c index 553e401973..178505c58f 100644 --- a/sysdeps/ieee754/ldbl-128/s_nexttoward.c +++ b/sysdeps/ieee754/ldbl-128/s_nexttoward.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #include <float.h> #ifdef __STDC__ @@ -53,10 +53,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (hy<0||(ix>>20)>(iy>>48)-0x3c00 @@ -87,16 +89,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c index e35ce50829..4f8aa7dec1 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c @@ -24,8 +24,8 @@ static char rcsid[] = "$NetBSD: $"; * Special cases: */ -#include "math.h" -#include "math_private.h" +#include <math.h> +#include <math_private.h> #include <math_ldbl_opt.h> #ifdef __STDC__ @@ -53,9 +53,12 @@ static char rcsid[] = "$NetBSD: $"; if(x==y) return y; /* x=y, return y */ if(ihx == 0 && ilx == 0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS64(x,hy&0x8000000000000000ULL,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (u); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(ihx>=0) { /* x > 0 */ if(ihx>ihy||((ihx==ihy)&&(ilx>ily))) { /* x > y, x -= ulp */ @@ -93,12 +96,9 @@ static char rcsid[] = "$NetBSD: $"; } hy = hx&0x7ff0000000000000LL; if(hy==0x7ff0000000000000LL) return x+x;/* overflow */ - if(hy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS64(y,hx,lx); - return y; - } + if(hy==0) { + long double u = x * x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS64(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c index 3335100592..e2f6521f57 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttoward.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #include <math_ldbl_opt.h> #include <float.h> @@ -55,10 +55,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(u_int32_t)((hy>>32)&0x80000000),1);/* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (hy<0||(ix>>20)>(iy>>52) @@ -89,16 +91,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c index a9373ff822..cf655fad16 100644 --- a/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c +++ b/sysdeps/ieee754/ldbl-128ibm/s_nexttowardf.c @@ -19,8 +19,9 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include <math_private.h> #include <math_ldbl_opt.h> +#include <float.h> #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -46,10 +47,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>52)-0x380 @@ -69,13 +72,16 @@ static char rcsid[] = "$NetBSD: $"; } } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + float u = x*x; + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/ieee754/ldbl-96/s_nextafterl.c b/sysdeps/ieee754/ldbl-96/s_nextafterl.c index 1798261b28..ed0877d6dd 100644 --- a/sysdeps/ieee754/ldbl-96/s_nextafterl.c +++ b/sysdeps/ieee754/ldbl-96/s_nextafterl.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #ifdef __STDC__ long double __nextafterl(long double x, long double y) @@ -48,9 +48,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if(x==y) return y; /* x=y, return y */ if((ix|hx|lx)==0) { /* x == 0 */ + long double u; SET_LDOUBLE_WORDS(x,esy&0x8000,0,1);/* return +-minsubnormal */ - y = x*x; - if(y==x) return y; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(esx<0x8000) { /* x > 0 */ if(ix>iy||((ix==iy) && (hx>hy||((hx==hy)&&(lx>ly))))) { @@ -85,13 +88,10 @@ static char rcsid[] = "$NetBSD: $"; } } esy = esx&0x7fff; - if(esy==0x7fff) return x+x; /* overflow */ - if(esy==0) { /* underflow */ - y = x*x; - if(y!=x) { /* raise underflow flag */ - SET_LDOUBLE_WORDS(y,esx,hx,lx); - return y; - } + if(esy==0x7fff) return x+x; /* overflow */ + if(esy==0) { + long double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_LDOUBLE_WORDS(x,esx,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-96/s_nexttoward.c b/sysdeps/ieee754/ldbl-96/s_nexttoward.c index 7945cb5cb1..e30438482c 100644 --- a/sysdeps/ieee754/ldbl-96/s_nexttoward.c +++ b/sysdeps/ieee754/ldbl-96/s_nexttoward.c @@ -26,7 +26,7 @@ static char rcsid[] = "$NetBSD: $"; */ #include "math.h" -#include "math_private.h" +#include <math_private.h> #include <float.h> #ifdef __STDC__ @@ -50,10 +50,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if((ix|lx)==0) { /* x == 0 */ - double x2; + double u; INSERT_WORDS(x,(esy&0x8000)<<16,1); /* return +-minsub */ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if (esy>=0x8000||((ix>>20)&0x7ff)>iy-0x3c00 @@ -84,16 +86,13 @@ static char rcsid[] = "$NetBSD: $"; if(hy>=0x7ff00000) { x = x+x; /* overflow */ if (FLT_EVAL_METHOD != 0 && FLT_EVAL_METHOD != 1) - /* Force conversion to float. */ - asm ("" : "=m"(x) : "m"(x)); + /* Force conversion to double. */ + asm ("" : "+m"(x)); return x; } - if(hy<0x00100000) { /* underflow */ - double x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - INSERT_WORDS(x2,hx,lx); - return x2; - } + if(hy<0x00100000) { + double u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } INSERT_WORDS(x,hx,lx); return x; diff --git a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c index a1c38b5d4c..6357975ffc 100644 --- a/sysdeps/ieee754/ldbl-96/s_nexttowardf.c +++ b/sysdeps/ieee754/ldbl-96/s_nexttowardf.c @@ -18,7 +18,8 @@ static char rcsid[] = "$NetBSD: $"; #endif #include "math.h" -#include "math_private.h" +#include <math_private.h> +#include <float.h> #ifdef __STDC__ float __nexttowardf(float x, long double y) @@ -41,10 +42,12 @@ static char rcsid[] = "$NetBSD: $"; return x+y; if((long double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,((esy&0x8000)<<16)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(esy>=0x8000||((ix>>23)&0xff)>iy-0x3f80 @@ -64,13 +67,16 @@ static char rcsid[] = "$NetBSD: $"; } } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c index d52526f719..68027f26fa 100644 --- a/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c +++ b/sysdeps/ieee754/ldbl-opt/s_nexttowardfd.c @@ -20,7 +20,10 @@ * Special cases: */ +#include <math.h> +#include <math_private.h> #include <math_ldbl_opt.h> +#include <float.h> float __nldbl_nexttowardf(float x, double y); @@ -39,10 +42,12 @@ float __nldbl_nexttowardf(float x, double y) return x+y; if((double) x==y) return y; /* x=y, return y */ if(ix==0) { /* x == 0 */ - float x2; + float u; SET_FLOAT_WORD(x,(u_int32_t)(hy&0x80000000)|1);/* return +-minsub*/ - x2 = x*x; - if(x2==x) return x2; else return x; /* raise underflow flag */ + u = math_opt_barrier (x); + u = u * u; + math_force_eval (u); /* raise underflow flag */ + return x; } if(hx>=0) { /* x > 0 */ if(hy<0||(ix>>23)>(iy>>20)-0x380 @@ -60,13 +65,16 @@ float __nldbl_nexttowardf(float x, double y) hx += 1; } hy = hx&0x7f800000; - if(hy>=0x7f800000) return x+x; /* overflow */ - if(hy<0x00800000) { /* underflow */ - float x2 = x*x; - if(x2!=x) { /* raise underflow flag */ - SET_FLOAT_WORD(x2,hx); - return x2; - } + if(hy>=0x7f800000) { + x = x+x; /* overflow */ + if (FLT_EVAL_METHOD != 0) + /* Force conversion to float. */ + asm ("" : "+m"(x)); + return x; + } + if(hy<0x00800000) { + float u = x*x; /* underflow */ + math_force_eval (u); /* raise underflow flag */ } SET_FLOAT_WORD(x,hx); return x; diff --git a/sysdeps/unix/sysv/linux/bits/sched.h b/sysdeps/unix/sysv/linux/bits/sched.h index 4a95a263f7..1d9c7b9f35 100644 --- a/sysdeps/unix/sysv/linux/bits/sched.h +++ b/sysdeps/unix/sysv/linux/bits/sched.h @@ -1,6 +1,7 @@ /* Definitions of constants and data structure for POSIX 1003.1b-1993 scheduling interface. - Copyright (C) 1996-1999,2001-2003,2005,2006 Free Software Foundation, Inc. + Copyright (C) 1996-1999,2001-2003,2005,2006,2007 + 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 @@ -127,4 +128,7 @@ typedef struct ((cpusetp)->__bits[__CPUELT (cpu)] &= ~__CPUMASK (cpu)) # define __CPU_ISSET(cpu, cpusetp) \ (((cpusetp)->__bits[__CPUELT (cpu)] & __CPUMASK (cpu)) != 0) +extern int __sched_cpucount (size_t __setsize, cpu_set_t *__setp) __THROW; +# define __CPU_COUNT(cpusetp) \ + __sched_cpucount (sizeof (cpu_set_t), cpusetp) #endif diff --git a/sysdeps/unix/sysv/linux/sync_file_range.c b/sysdeps/unix/sysv/linux/sync_file_range.c index 7519bb7fe6..4e267a1602 100644 --- a/sysdeps/unix/sysv/linux/sync_file_range.c +++ b/sysdeps/unix/sysv/linux/sync_file_range.c @@ -1,5 +1,5 @@ /* Selective file content synch'ing. - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2007 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 @@ -27,7 +27,7 @@ #ifdef __NR_sync_file_range int -sync_file_range (int fd, __off64_t from, __off64_t to, int flags) +sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { return INLINE_SYSCALL (sync_file_range, 6, fd, __LONG_LONG_PAIR ((long) (from >> 32), (long) from), @@ -36,7 +36,7 @@ sync_file_range (int fd, __off64_t from, __off64_t to, int flags) } #else int -sync_file_range (int fd, __off64_t from, __off64_t to, int flags) +sync_file_range (int fd, __off64_t from, __off64_t to, unsigned int flags) { __set_errno (ENOSYS); return -1; diff --git a/sysdeps/x86_64/fpu/fedisblxcpt.c b/sysdeps/x86_64/fpu/fedisblxcpt.c index e8157da126..261c1e877c 100644 --- a/sysdeps/x86_64/fpu/fedisblxcpt.c +++ b/sysdeps/x86_64/fpu/fedisblxcpt.c @@ -1,5 +1,5 @@ /* Disable floating-point exceptions. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2001. @@ -24,7 +24,7 @@ int fedisableexcept (int excepts) { unsigned short int new_exc, old_exc; - unsigned int new, old; + unsigned int new; excepts &= FE_ALL_EXCEPT; @@ -40,8 +40,6 @@ fedisableexcept (int excepts) __asm__ ("stmxcsr %0" : "=m" (*&new)); /* The SSE exception masks are shifted by 7 bits. */ - old = (~new) & (FE_ALL_EXCEPT << 7); - new |= excepts << 7; __asm__ ("ldmxcsr %0" : : "m" (*&new)); diff --git a/sysdeps/x86_64/fpu/feenablxcpt.c b/sysdeps/x86_64/fpu/feenablxcpt.c index 43259d0cfb..7bbc368d27 100644 --- a/sysdeps/x86_64/fpu/feenablxcpt.c +++ b/sysdeps/x86_64/fpu/feenablxcpt.c @@ -1,5 +1,5 @@ /* Enable floating-point exceptions. - Copyright (C) 2001 Free Software Foundation, Inc. + Copyright (C) 2001, 2007 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Andreas Jaeger <aj@suse.de>, 2001. @@ -24,7 +24,7 @@ int feenableexcept (int excepts) { unsigned short int new_exc, old_exc; - unsigned int new, old; + unsigned int new; excepts &= FE_ALL_EXCEPT; @@ -40,8 +40,6 @@ feenableexcept (int excepts) __asm__ ("stmxcsr %0" : "=m" (*&new)); /* The SSE exception masks are shifted by 7 bits. */ - old = (~new) & (FE_ALL_EXCEPT << 7); - new &= ~(excepts << 7); __asm__ ("ldmxcsr %0" : : "m" (*&new)); diff --git a/sysdeps/x86_64/fpu/feholdexcpt.c b/sysdeps/x86_64/fpu/feholdexcpt.c index a9b21a3c25..d56ab163ca 100644 --- a/sysdeps/x86_64/fpu/feholdexcpt.c +++ b/sysdeps/x86_64/fpu/feholdexcpt.c @@ -1,5 +1,5 @@ /* Store current floating-point environment and clear exceptions. - Copyright (C) 2001, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2005, 2007 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 @@ -22,19 +22,24 @@ int feholdexcept (fenv_t *envp) { - unsigned short int work; unsigned int mxcsr; + fenv_t temp; /* Store the environment. */ __asm__ ("fnstenv %0\n" - "stmxcsr %1" : "=m" (*envp), "=m" (envp->__mxcsr)); + "stmxcsr %1" : "=m" (temp), "=m" (temp.__mxcsr)); + *envp = temp; /* Now set all exceptions to non-stop, first the x87 FPU. */ - work = envp->__control_word | 0x3f; - __asm__ ("fldcw %0" : : "m" (*&work)); + temp.__control_word |= 0x3f; + + /* And clear all exceptions. */ + temp.__status_word &= ~0x3f; + + __asm__ ("fldenv %0" : : "m" (temp)); /* Set the SSE MXCSR register. */ - mxcsr = envp->__mxcsr | 0x1f80; + mxcsr = (envp->__mxcsr | 0x1f80) & ~0x3f; __asm__ ("ldmxcsr %0" : : "m" (*&mxcsr)); return 0; diff --git a/sysdeps/x86_64/fpu/feupdateenv.c b/sysdeps/x86_64/fpu/feupdateenv.c new file mode 100644 index 0000000000..e23f1affa6 --- /dev/null +++ b/sysdeps/x86_64/fpu/feupdateenv.c @@ -0,0 +1,51 @@ +/* Install given floating-point environment and raise exceptions. + Copyright (C) 1997,99,2000,01,07 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include <fenv.h> + +int +__feupdateenv (const fenv_t *envp) +{ + fexcept_t temp; + unsigned int xtemp; + + /* Save current exceptions. */ + __asm__ ("fnstsw %0\n\tstmxcsr %1" : "=m" (*&temp), "=m" (xtemp)); + temp = (temp | xtemp) & FE_ALL_EXCEPT; + + /* Install new environment. */ + fesetenv (envp); + + /* Raise the saved exception. Incidently for us the implementation + defined format of the values in objects of type fexcept_t is the + same as the ones specified using the FE_* constants. */ + feraiseexcept ((int) temp); + + /* Success. */ + return 0; +} + +#include <shlib-compat.h> +#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2) +strong_alias (__feupdateenv, __old_feupdateenv) +compat_symbol (libm, __old_feupdateenv, feupdateenv, GLIBC_2_1); +#endif + +versioned_symbol (libm, __feupdateenv, feupdateenv, GLIBC_2_2); diff --git a/sysdeps/x86_64/fpu/math_private.h b/sysdeps/x86_64/fpu/math_private.h new file mode 100644 index 0000000000..4febcbb5ec --- /dev/null +++ b/sysdeps/x86_64/fpu/math_private.h @@ -0,0 +1,21 @@ +#ifndef _MATH_PRIVATE_H + +#define math_opt_barrier(x) \ +({ __typeof(x) __x; \ + if (sizeof (x) <= sizeof (double)) \ + __asm ("" : "=x" (__x) : "0" (x)); \ + else \ + __asm ("" : "=t" (__x) : "0" (x)); \ + __x; }) +#define math_force_eval(x) \ +do \ + { \ + if (sizeof (x) <= sizeof (double)) \ + __asm __volatile ("" : : "x" (x)); \ + else \ + __asm __volatile ("" : : "f" (x)); \ + } \ +while (0) + +#include <math/math_private.h> +#endif |