From 2d5862dee6b6acd965d93f39eed737e67863a34e Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 24 Aug 2000 22:32:38 +0000 Subject: [PATCH] 2000-08-23 Werner Almesberger * libc/stdlib/mprec.c (ulp, b2d, d2b): changed a few expressions like x << y-z to the equivalent x << (y-z). (d2b): changed if statements with assignment to perform the assignment prior to the if check. * libc/reent/reent.c: included stdlib.h for "_free_r" prototype. * libc/unix/getpass.c (getpass): moved "echo" assignment out of if. * libc/unix/ttyname.c: included string.h for "strcpy" prototype. * libc/unix/getcwd.c (ISDOT): added parentheses to clarify && and || precedence. * libc/include/sys/unistd.h: added "vfork" prototype (for popen.c). Added "_execve" prototype (for execl.c, execle.c, execv.c, and execve.c). * libc/posix/popen.c (popen): added parentheses to clarify && and || precedence. * libm/math/e_cosh.c (__ieee754_cosh): changed parentheses to clarify && and || precendence (and to remove pascalism). * libm/math/e_sinh.c (__ieee754_sinh): Ditto. * libm/math/s_infconst.c: added another pair of braces to all initializers for __infinity (need three: for __infinity[1] array, for union __dmath, and for i[2]). --- newlib/ChangeLog | 23 +++++++++++++++++++++++ newlib/libc/include/sys/unistd.h | 5 +++++ newlib/libc/posix/popen.c | 2 +- newlib/libc/reent/reent.c | 1 + newlib/libc/stdlib/mprec.c | 18 +++++++++++------- newlib/libc/unix/getcwd.c | 2 +- newlib/libc/unix/getpass.c | 3 ++- newlib/libc/unix/ttyname.c | 1 + 8 files changed, 45 insertions(+), 10 deletions(-) diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 15e49f1c1..34ebe4861 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,26 @@ +2000-08-23 Werner Almesberger + + * libc/stdlib/mprec.c (ulp, b2d, d2b): changed a few expressions + like x << y-z to the equivalent x << (y-z). + (d2b): changed if statements with assignment to perform the + assignment prior to the if check. + * libc/reent/reent.c: included stdlib.h for "_free_r" prototype. + * libc/unix/getpass.c (getpass): moved "echo" assignment out of if. + * libc/unix/ttyname.c: included string.h for "strcpy" prototype. + * libc/unix/getcwd.c (ISDOT): added parentheses to clarify && and || + precedence. + * libc/include/sys/unistd.h: added "vfork" prototype (for popen.c). + Added "_execve" prototype (for execl.c, execle.c, execv.c, and + execve.c). + * libc/posix/popen.c (popen): added parentheses to clarify && and || + precedence. + * libm/math/e_cosh.c (__ieee754_cosh): changed parentheses to + clarify && and || precendence (and to remove pascalism). + * libm/math/e_sinh.c (__ieee754_sinh): Ditto. + * libm/math/s_infconst.c: added another pair of braces to all + initializers for __infinity (need three: for __infinity[1] array, + for union __dmath, and for i[2]). + 2000-08-23 Werner Almesberger * libc/stdlib/abort.c: changed description: uses "raise" instead of diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 609a64df5..a226a40aa 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -75,6 +75,10 @@ char _EXFUN(*ttyname, (int __fildes )); int _EXFUN(unlink, (const char *__path )); int _EXFUN(write, (int __fildes, const void *__buf, size_t __nbyte )); +#ifndef _POSIX_SOURCE +pid_t _EXFUN(vfork, (void )); +#endif /* _POSIX_SOURCE */ + /* Provide prototypes for most of the _ names that are provided in newlib for some compilers. */ int _EXFUN(_close, (int __fildes )); @@ -86,6 +90,7 @@ int _EXFUN(_read, (int __fildes, void *__buf, size_t __nbyte )); void * _EXFUN(_sbrk, (size_t __incr)); int _EXFUN(_unlink, (const char *__path )); int _EXFUN(_write, (int __fildes, const void *__buf, size_t __nbyte )); +int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); #if defined(__CYGWIN__) || defined(__rtems__) unsigned _EXFUN(usleep, (unsigned int __useconds)); diff --git a/newlib/libc/posix/popen.c b/newlib/libc/posix/popen.c index f6a7421ee..4fd3dd93d 100644 --- a/newlib/libc/posix/popen.c +++ b/newlib/libc/posix/popen.c @@ -71,7 +71,7 @@ popen(program, type) FILE *iop; int pdes[2], pid; - if (*type != 'r' && *type != 'w' || type[1]) { + if ((*type != 'r' && *type != 'w') || type[1]) { errno = EINVAL; return (NULL); } diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c index 93b3e86c8..749a5bf6b 100644 --- a/newlib/libc/reent/reent.c +++ b/newlib/libc/reent/reent.c @@ -10,6 +10,7 @@ DESCRIPTION non-rentrant functions, such as strtok. */ +#include #include /* Interim cleanup code */ diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c index 04ece0713..8a2d404dc 100644 --- a/newlib/libc/stdlib/mprec.c +++ b/newlib/libc/stdlib/mprec.c @@ -663,7 +663,7 @@ _DEFUN (ulp, (_x), double _x) word0 (a) = 0; L -= Exp_shift; #ifndef _DOUBLE_IS_32BITS - word1 (a) = L >= 31 ? 1 : 1 << 31 - L; + word1 (a) = L >= 31 ? 1 : 1 << (31 - L); #endif } } @@ -710,7 +710,7 @@ _DEFUN (b2d, (a, e), d0 = Exp_1 | y << k | z >> (32 - k); y = xa > xa0 ? *--xa : 0; #ifndef _DOUBLE_IS_32BITS - d1 = z << k | y >> 32 - k; + d1 = z << k | y >> (32 - k); #endif } else @@ -794,11 +794,13 @@ _DEFUN (d2b, #endif #ifdef Pack_32 #ifndef _DOUBLE_IS_32BITS - if (y = d1) + if (d1) { - if (k = lo0bits (&y)) + y = d1; + k = lo0bits (&y); + if (k) { - x[0] = y | z << 32 - k; + x[0] = y | z << (32 - k); z >>= k; } else @@ -820,9 +822,11 @@ _DEFUN (d2b, #endif } #else - if (y = d1) + if (d1) { - if (k = lo0bits (&y)) + y = d1; + k = lo0bits (&y); + if (k) if (k >= 16) { x[0] = y | z << 32 - k & 0xffff; diff --git a/newlib/libc/unix/getcwd.c b/newlib/libc/unix/getcwd.c index ee53536ed..826fc789d 100644 --- a/newlib/libc/unix/getcwd.c +++ b/newlib/libc/unix/getcwd.c @@ -49,7 +49,7 @@ static char sccsid[] = "@(#)getcwd.c 5.11 (Berkeley) 2/24/91"; #define ISDOT(dp) \ (dp->d_name[0] == '.' && (dp->d_name[1] == '\0' || \ - dp->d_name[1] == '.' && dp->d_name[2] == '\0')) + (dp->d_name[1] == '.' && dp->d_name[2] == '\0'))) #ifndef _REENT_ONLY diff --git a/newlib/libc/unix/getpass.c b/newlib/libc/unix/getpass.c index ff9e7e67d..b45df074f 100644 --- a/newlib/libc/unix/getpass.c +++ b/newlib/libc/unix/getpass.c @@ -70,7 +70,8 @@ getpass (prompt) */ omask = sigblock (sigmask (SIGINT) | sigmask (SIGTSTP)); (void) tcgetattr (fileno (fp), &term); - if (echo = (term.c_lflag & ECHO)) + echo = (term.c_lflag & ECHO); + if (echo) { term.c_lflag &= ~ECHO; (void) tcsetattr (fileno (fp), TCSAFLUSH, &term); diff --git a/newlib/libc/unix/ttyname.c b/newlib/libc/unix/ttyname.c index 582a7903f..258ba25fe 100644 --- a/newlib/libc/unix/ttyname.c +++ b/newlib/libc/unix/ttyname.c @@ -41,6 +41,7 @@ static char sccsid[] = "@(#)ttyname.c 5.10 (Berkeley) 5/6/91"; #include #include #include +#include #include #include <_syslist.h>