From cd6ede759fadcf8cd1f8c069928611d18cef5c1a Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Mon, 14 Jul 1997 21:49:20 +0000 Subject: Update. 1997-07-14 23:37 Ulrich Drepper * inet/getnameinfo.c: Pretty print. Correctly enlarge buffers. * login/programs/utmpd.c: Use _() instead of gettext(). * nis/nss_nisplus/nisplus-hosts.c: Optimize some uses of stpcpy away. * nis/nss_nisplus/nisplus-network.c: Likewise. * nis/nss_nisplus/nisplus-proto.c: Likewise. * nis/nss_nisplus/nisplus-rpc.c: Likewise. * nis/nss_nisplus/nisplus-service.c: Likewise. * sysdeps/alpha/fpu/bits/mathinline.h: Only define functions if __OPTIMIZE__. * sysdeps/powerpc/bits/mathinline.h: Likewise. * sysdeps/i386/fpu/bits/mathinline.h: Define ISO C9x comparison function always. * sysdeps/m68k/fpu/bits/mathinline.h: Likewise. * sysdeps/stub/bits/mathinline.h: Add conditionals to show how it should look like in real files. * sysdeps/generic/bits/select.h (__FD_ZERO): Don't use memset to prevent prototype trouble, use simple loop. * sysdeps/i386/bits/select.h [!__GNUC__] (__FD_ZERO): Likewise. * sysdeps/mips/mips64/Implies: Imply ieee754. * sysdeps/unix/sysv/linux/Makefile: Make sure bits/syscall.h is installed. * sysdeps/unix/sysv/linux/sys/syscal.h: Pretty print. 1997-07-14 00:25 Ulrich Drepper * sysdeps/stub/bits/stdio_lim.h: Unify with standalone version. * sysdeps/standalone/bits/stdio_lim.h: Removed. Patch by Zack Weinberg . 1997-06-22 Paul Eggert * time/strftime.c (strftime): Use tm_zone if available, even if _LIBC. * time/tzfile.c (__tzstring): New decl. (__tzfile_read, __tzfile_default): Set __tzname to permanent strings. (__tzfile_default): First two args are now const char *. * time/tzset.c (__tzstring): New function. (tz_rule): Name is now const char *. (struct tzstring_head): New type. (tzstring_list, tzstring_last_buffer_size): New static vars. (__tzset_internal): Time zone names are now permanent, not temporary. --- sysdeps/alpha/fpu/bits/mathinline.h | 4 +- sysdeps/generic/bits/select.h | 13 +++- sysdeps/i386/bits/select.h | 8 ++- sysdeps/i386/fpu/bits/mathinline.h | 112 ++++++++++++++++----------------- sysdeps/m68k/fpu/bits/mathinline.h | 113 +++++++++++++++++----------------- sysdeps/mips/mips64/Implies | 2 + sysdeps/powerpc/bits/mathinline.h | 13 ++-- sysdeps/standalone/bits/stdio_lim.h | 26 -------- sysdeps/stub/bits/mathinline.h | 6 ++ sysdeps/stub/bits/stdio_lim.h | 35 ++++++++++- sysdeps/unix/sysv/linux/Makefile | 9 +++ sysdeps/unix/sysv/linux/sys/syscall.h | 4 +- 12 files changed, 192 insertions(+), 153 deletions(-) delete mode 100644 sysdeps/standalone/bits/stdio_lim.h (limited to 'sysdeps') diff --git a/sysdeps/alpha/fpu/bits/mathinline.h b/sysdeps/alpha/fpu/bits/mathinline.h index 0f76027317..22703120b1 100644 --- a/sysdeps/alpha/fpu/bits/mathinline.h +++ b/sysdeps/alpha/fpu/bits/mathinline.h @@ -18,7 +18,8 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#if defined (__GNUC__) && !defined (__NO_MATH_INLINES) +#ifdef __GNUC__ +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ extern __inline double __copysign (double __x, double __y) @@ -42,3 +43,4 @@ atan (double __x) } #endif +#endif diff --git a/sysdeps/generic/bits/select.h b/sysdeps/generic/bits/select.h index 613919577c..7803335499 100644 --- a/sysdeps/generic/bits/select.h +++ b/sysdeps/generic/bits/select.h @@ -21,9 +21,16 @@ #endif -/* This line MUST be split! Otherwise m4 will not change it. */ -#define __FD_ZERO(set) \ - ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) +/* This line MUST be split! Otherwise m4 will not change it. + + We don't use `memset' because this would require a prototype and + the array isn't too big. */ +#define __FD_ZERO(set) \ + do { \ + unsigned int __i; \ + for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ + ((__fd_mask *) set)[__i] = '\0'; \ + } while (0) #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) diff --git a/sysdeps/i386/bits/select.h b/sysdeps/i386/bits/select.h index 3912515a7f..e72b6f0a84 100644 --- a/sysdeps/i386/bits/select.h +++ b/sysdeps/i386/bits/select.h @@ -48,8 +48,14 @@ #else /* ! GNU CC */ +/* We don't use `memset' because this would require a prototype and + the array isn't too big. */ #define __FD_ZERO(set) \ - ((void) memset ((__ptr_t) (set), 0, sizeof (fd_set))) + do { \ + unsigned int __i; \ + for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \ + ((__fd_mask *) set)[__i] = '\0'; \ + } while (0) #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) diff --git a/sysdeps/i386/fpu/bits/mathinline.h b/sysdeps/i386/fpu/bits/mathinline.h index dab5494ac5..42dae92a2a 100644 --- a/sysdeps/i386/fpu/bits/mathinline.h +++ b/sysdeps/i386/fpu/bits/mathinline.h @@ -21,7 +21,56 @@ #ifndef _BITS_MATHINLINE_H #define _BITS_MATHINLINE_H 1 -#if defined __GNUG__ && \ + +#if defined __USE_ISOC9X && defined __GNUC__ && __GNUC__ >= 2 +/* ISO C 9X defines some macros to perform unordered comparisons. The + ix87 FPU supports this with special opcodes and we should use them. + These must not be inline functions since we have to be able to handle + all floating-point types. */ +# define isgreater(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;" \ + "andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) + +# define isgreaterequal(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;" \ + "andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) + +# define isless(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;" \ + "setz %%al; andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) + +# define islessequal(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;" \ + "setz %%al; andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) + +# define islessgreater(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;" \ + "andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) + +# define isunordered(x, y) \ + ({ int result; \ + __asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0xff, %0" \ + : "=a" (result) : "t" (x), "u" (y) : "cc"); \ + result; }) +#endif + + +#if defined __GNUC__ && \ (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7)) /* gcc 2.7.2 and 2.7.2.1 have problems with inlining `long double' functions so we disable this now. */ @@ -29,8 +78,9 @@ # define __NO_MATH_INLINES #endif + #ifdef __GNUC__ -#ifndef __NO_MATH_INLINES +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ #ifdef __cplusplus # define __MATH_INLINE __inline @@ -258,10 +308,8 @@ __log2 (double __x) { register double __value; __asm __volatile__ - ("fld1\n\t" - "fxch\n\t" - "fyl2x" - : "=t" (__value) : "0" (__x)); + ("fyl2x" + : "=t" (__value) : "0" (__x), "u" (1.0)); return __value; } @@ -441,7 +489,10 @@ logb (double __x) return __value; } +#endif + +#ifdef __USE_MISC __MATH_INLINE double drem (double __x, double __y); __MATH_INLINE double drem (double __x, double __y) @@ -471,55 +522,6 @@ __finite (double __x) return __result; } - -/* ISO C 9X defines some macros to perform unordered comparisons. The - ix87 FPU supports this with special opcodes and we should use them. - These must not be inline functions since we have to be able to handle - all floating-point types. */ -# define isgreater(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;" \ - "andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) - -# define isgreaterequal(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;" \ - "andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) - -# define isless(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;" \ - "setz %%al; andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) - -# define islessequal(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;" \ - "setz %%al; andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) - -# define islessgreater(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;" \ - "andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) - -# define isunordered(x, y) \ - ({ int result; \ - __asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0xff, %0" \ - : "=a" (result) : "t" (x), "u" (y) : "cc"); \ - result; }) -#endif - - -#ifdef __USE_MISC __MATH_INLINE double coshm1 (double __x); __MATH_INLINE double coshm1 (double __x) diff --git a/sysdeps/m68k/fpu/bits/mathinline.h b/sysdeps/m68k/fpu/bits/mathinline.h index 79245c07a1..2ab570fba5 100644 --- a/sysdeps/m68k/fpu/bits/mathinline.h +++ b/sysdeps/m68k/fpu/bits/mathinline.h @@ -19,18 +19,69 @@ #ifdef __GNUC__ -#include +#ifdef __USE_ISOC9X + +/* ISO C 9X defines some macros to perform unordered comparisons. The + m68k FPU supports this with special opcodes and we should use them. + These must not be inline functions since we have to be able to handle + all floating-point types. */ +# define isgreater(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsogt %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +# define isgreaterequal(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsoge %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +# define isless(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsolt %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +# define islessequal(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsole %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +# define islessgreater(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsogl %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) + +# define isunordered(x, y) \ + __extension__ \ + ({ char __result; \ + __asm__ ("fcmp%.x %2,%1; fsun %0" \ + : "=dm" (__result) : "f" (x), "f" (y)); \ + (int) __result; }) +#endif + + +#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \ + || defined __LIBC_M81_MATH_INLINES #ifdef __LIBC_M81_MATH_INLINES /* This is used when defining the functions themselves. Define them with __ names, and with `static inline' instead of `extern inline' so the bodies will always be used, never an external function call. */ -#define __m81_u(x) __CONCAT(__,x) -#define __m81_inline static __inline +# define __m81_u(x) __CONCAT(__,x) +# define __m81_inline static __inline #else -#define __m81_u(x) x -#define __m81_inline extern __inline -#define __M81_MATH_INLINES 1 +# define __m81_u(x) x +# define __m81_inline extern __inline +# define __M81_MATH_INLINES 1 #endif /* Define a const math function. */ @@ -385,55 +436,7 @@ __inline_forward(void,sincosl, #undef __inline_forward #undef __inline_forward_c -#ifdef __USE_ISOC9X - -/* ISO C 9X defines some macros to perform unordered comparisons. The - m68k FPU supports this with special opcodes and we should use them. - These must not be inline functions since we have to be able to handle - all floating-point types. */ -# define isgreater(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsogt %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) - -# define isgreaterequal(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsoge %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) - -# define isless(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsolt %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) - -# define islessequal(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsole %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) - -# define islessgreater(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsogl %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) - -# define isunordered(x, y) \ - __extension__ \ - ({ char __result; \ - __asm__ ("fcmp%.x %2,%1; fsun %0" \ - : "=dm" (__result) : "f" (x), "f" (y)); \ - (int) __result; }) -#endif - #endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */ +#endif #endif /* GCC. */ diff --git a/sysdeps/mips/mips64/Implies b/sysdeps/mips/mips64/Implies index a8cae95f9d..06b9091f3b 100644 --- a/sysdeps/mips/mips64/Implies +++ b/sysdeps/mips/mips64/Implies @@ -1 +1,3 @@ wordsize-64 +# MIPS uses IEEE 754 floating point. +ieee754 diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h index db9688cfc5..d7f2a3ac0d 100644 --- a/sysdeps/powerpc/bits/mathinline.h +++ b/sysdeps/powerpc/bits/mathinline.h @@ -17,16 +17,13 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#ifndef __MATH_H -#define __MATH_H - #ifdef __GNUC__ -#ifndef __NO_MATH_INLINES +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ #ifdef __cplusplus -#define __MATH_INLINE __inline +# define __MATH_INLINE __inline #else -#define __MATH_INLINE extern __inline +# define __MATH_INLINE extern __inline #endif __MATH_INLINE double __sgn1 (double __x); @@ -64,7 +61,5 @@ fabs (double __x) return __value; } -#endif /* __NO_MATH_INLINES */ +#endif /* __NO_MATH_INLINES && __OPTIMZE__ */ #endif /* __GNUC__ */ - -#endif /* __MATH_H */ diff --git a/sysdeps/standalone/bits/stdio_lim.h b/sysdeps/standalone/bits/stdio_lim.h deleted file mode 100644 index f5a503471c..0000000000 --- a/sysdeps/standalone/bits/stdio_lim.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright (C) 1994, 1997 Free Software Foundation, Inc. - Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil, - On-Line Applications Research Corporation. - 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 Library General Public License as - published by the Free Software Foundation; either version 2 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 - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with the GNU C Library; see the file COPYING.LIB. If not, - write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, - Boston, MA 02111-1307, USA. */ - -#define L_tmpnam 1 -#define TMPMAX 0 -#define L_ctermid 1 -#define L_cuserid 1 -#define FOPEN_MAX 16 -#define FILENAME_MAX 14 diff --git a/sysdeps/stub/bits/mathinline.h b/sysdeps/stub/bits/mathinline.h index 8159c89b94..5498af6b63 100644 --- a/sysdeps/stub/bits/mathinline.h +++ b/sysdeps/stub/bits/mathinline.h @@ -4,3 +4,9 @@ This file should define __MATH_INLINES if functions are actually defined as inlines. */ + +#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__ + +/* Here goes the real code. */ + +#endif diff --git a/sysdeps/stub/bits/stdio_lim.h b/sysdeps/stub/bits/stdio_lim.h index 59b6a40ebe..ef873777c9 100644 --- a/sysdeps/stub/bits/stdio_lim.h +++ b/sysdeps/stub/bits/stdio_lim.h @@ -1,4 +1,37 @@ +/* Copyright (C) 1994, 1997 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 Library General Public License as + published by the Free Software Foundation; either version 2 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 + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU C Library; see the file COPYING.LIB. If not, + write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +/* : stdio limits for non-POSIX systems. + * Never include this file directly; use instead. + */ + +#ifndef _BITS_STDIO_LIM_H +#define _BITS_STDIO_LIM_H + #define L_tmpnam 1 -#define TMPMAX 0 +#define TMP_MAX 0 + +#ifdef __USE_POSIX +#define L_ctermid 1 +#define L_cuserid 1 +#endif + #define FOPEN_MAX 16 #define FILENAME_MAX 14 + +#endif diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 4ab97b2e92..2004a48b42 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -13,6 +13,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \ sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \ sys/quota.h +install-others += $(inst_includedir)/bits/syscall.h + # Generate the list of SYS_* macros for the system calls (__NR_* macros). $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h rm -f $(@:.h=.d) @@ -24,6 +26,13 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal sed -n >> $(@:.d=.h).new \ 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' mv -f $(@:.d=.h).new $(@:.d=.h) + +$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h + $(make-target-directory) + if test -r $@ && cmp -s $< $@; \ + then echo 'bits/syscall.h unchanged'; \ + else $(INSTALL_DATA) $< $@; fi + ifndef no_deps # Get the generated list of dependencies (probably /usr/include/asm/unistd.h). -include $(objpfx)syscall-list.d diff --git a/sysdeps/unix/sysv/linux/sys/syscall.h b/sysdeps/unix/sysv/linux/sys/syscall.h index d6b14fcf0a..7eca4f086a 100644 --- a/sysdeps/unix/sysv/linux/sys/syscall.h +++ b/sysdeps/unix/sysv/linux/sys/syscall.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1995, 1996 Free Software Foundation, Inc. +/* Copyright (C) 1995, 1996, 1997 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 @@ -29,7 +29,7 @@ programs expect the traditional form `SYS_'. So in building libc we scan the kernel's list and produce with macros for all the `SYS_' names. */ -#include +# include #endif #endif -- cgit v1.2.3