diff options
65 files changed, 204 insertions, 78 deletions
@@ -1,3 +1,30 @@ +1998-09-06 09:53 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu> + + * Makeconfig (+gccwarn): Remove -Wno-parentheses. + + * elf/dl-open.c: Quiet -Wparentheses warnings. + * iconvdata/johab.c: Likewise. + * iconvdata/uhc.c: Likewise. + * inet/inet_net.c: Likewise. + * io/fts.c: Likewise. + * locale/newlocale.c: Likewise. + * misc/getttyent.c: Likewise. + * misc/mntent_r.c: Likewise. + * misc/ttyslot.c: Likewise. + * nscd/nscd_conf.c: Likewise. + * nss/nsswitch.c: Likewise. + * resolv/gethnamaddr.c: Likewise. + * resolv/nsap_addr.c: Likewise. + * resolv/res_debug.c: Likewise. + * stdio-common/_itoa.c: Likewise. + * stdlib/strtod.c: Likewise. + * string/strverscmp.c: Likewise. + * sunrpc/svc.c: Likewise. + * sysdeps/libm-ieee754/e_cosh.c: Likewise. + * sysdeps/libm-ieee754/e_gamma_r.c: Likewise. + * sysdeps/libm-ieee754/e_sinh.c: Likewise. + * sysdeps/posix/getaddrinfo.c: Likewise. + 1998-09-06 15:13 Ulrich Drepper <drepper@cygnus.com> * elf/dlsym.c (dlsym_doit): Use new RTLD_DEFAULT macro to test @@ -38,6 +65,7 @@ * include/alloca.h: Add multiple-inclusion guard. * include/db.h: Likewise. * include/db_185.h: Likewise. + * include/dlfcn.h: Likewise. * include/fcntl.h: Likewise. * include/grp.h: Likewise. * include/libintl.h: Likewise. @@ -68,9 +96,6 @@ * include/sys/times.h: Likewise. * include/sys/wait.h: Likewise. - * include/dlfcn.h: Declare dladdr only for __USE_GNU. - Define RTLD_DEFAULT. - 1998-09-06 09:00 Ulrich Drepper <drepper@cygnus.com> * version.h (VERSION): Bump to 2.0.96. @@ -95,7 +120,6 @@ * elf/dl-support.c: Likewise. * elf/dl-symbol.c: Likewise. * elf/dl-version.c: Likewise. - * elf/dlfcn.h: Likewise. * elf/dlsym.c: Likewise. * elf/dlvsym.c: Likewise. * elf/ldsodefs.h: Likewise. @@ -105,6 +129,9 @@ * sysdeps/i386/dl-machine.h: Likewise. * sysdeps/unix/sysv/linux/i386/dl-librecon.h: Likewise. + * elf/dlfcn.h: Declare dladdr only for __USE_GNU. + Define RTLD_DEFAULT. + 1998-09-05 Mark Kettenis <kettenis@phys.uva.nl> * sysdeps/mach/hurd/i386/init-first.c (init1): Call diff --git a/Makeconfig b/Makeconfig index b0141d4cb6..1858dd54a9 100644 --- a/Makeconfig +++ b/Makeconfig @@ -489,7 +489,7 @@ RANLIB = ranlib endif # Extra flags to pass to GCC. -+gccwarn := -Wall -Wwrite-strings -Wno-parentheses -Winline -Wstrict-prototypes ++gccwarn := -Wall -Wwrite-strings -Winline -Wstrict-prototypes # This is the program that generates makefile # dependencies from C source files. diff --git a/elf/dl-open.c b/elf/dl-open.c index 6765b6ce08..694b0ebfaa 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -192,7 +192,7 @@ dl_open_worker (void *a) _dl_debug_state (); /* Run the initializer functions of new objects. */ - while (init = _dl_init_next (&new->l_searchlist)) + while ((init = _dl_init_next (&new->l_searchlist))) (*(void (*) (int, char **, char **)) init) (__libc_argc, __libc_argv, __environ); diff --git a/iconvdata/johab.c b/iconvdata/johab.c index 6da169438c..6a5d8be68f 100644 --- a/iconvdata/johab.c +++ b/iconvdata/johab.c @@ -220,11 +220,11 @@ johab_sym_hanja_to_ucs (uint_fast32_t idx, uint_fast32_t c1, uint_fast32_t c2) } \ else if (i > 0 && m > 0) \ ch = ((i - 1) * 21 + (m - 1)) * 28 + f + 0xac00; \ - else if (i > 0 && m == 0 & f == 0) \ + else if (i > 0 && m == 0 && f == 0) \ ch = init_to_ucs[i - 1]; \ - else if (i == 0 && m > 0 & f == 0) \ + else if (i == 0 && m > 0 && f == 0) \ ch = 0x314e + m; /* 0x314f + m - 1 */ \ - else if (i == 0 && m == 0 & f > 0) \ + else if (i == 0 && m == 0 && f > 0) \ ch = final_to_ucs[f - 1]; /* round trip?? */ \ else \ { \ diff --git a/iconvdata/uhc.c b/iconvdata/uhc.c index 0fa6d40f74..5aef36cdd0 100644 --- a/iconvdata/uhc.c +++ b/iconvdata/uhc.c @@ -3170,7 +3170,7 @@ static const char uhc_hangul_from_ucs[11172][2] = *outptr++ = s[0]; \ *outptr++ = s[1]; \ } \ - else if (ch >= 0x4e00 && ch <= 0x9fa5 || ch >= 0xf900 && ch <= 0xfa0b) \ + else if ((ch >= 0x4e00 && ch <= 0x9fa5) || (ch >= 0xf900 && ch <= 0xfa0b))\ { \ size_t written = ucs4_to_ksc5601_hanja (ch, outptr, \ (NEED_LENGTH_TEST \ diff --git a/include/alloca.h b/include/alloca.h index ae41090bd1..4dcddb6ae1 100644 --- a/include/alloca.h +++ b/include/alloca.h @@ -1,3 +1,5 @@ +#ifndef _ALLOCA_H + #include <stdlib/alloca.h> #undef __alloca @@ -8,3 +10,5 @@ extern __ptr_t __alloca __P ((size_t __size)); #ifdef __GNUC__ # define __alloca(size) __builtin_alloca (size) #endif /* GCC. */ + +#endif diff --git a/include/db.h b/include/db.h index 13e9c307eb..64c7348ea6 100644 --- a/include/db.h +++ b/include/db.h @@ -1,5 +1,9 @@ +#ifndef _DB_H_ + #include <db2/db.h> /* Internal interface for NSS. */ int __nss_db_open __P((const char *, DBTYPE, u_int32_t, int, DB_ENV *, DB_INFO *, DB **)); + +#endif diff --git a/include/db_185.h b/include/db_185.h index db78199865..37bb16e99b 100644 --- a/include/db_185.h +++ b/include/db_185.h @@ -1,4 +1,6 @@ +#ifndef _DB_185_H_ #include <db2/db_185.h> /* Now define the internal interfaces. */ DB *__dbopen __P((const char *, int, int, DBTYPE, const void *)); +#endif diff --git a/include/dlfcn.h b/include/dlfcn.h index 766c80a11a..955819739a 100644 --- a/include/dlfcn.h +++ b/include/dlfcn.h @@ -1,5 +1,7 @@ +#ifndef _DLFCN_H #include <elf/dlfcn.h> /* Now define the internal interfaces. */ extern void *__dlvsym __P ((void *__handle, __const char *__name, __const char *__version)); +#endif diff --git a/include/fcntl.h b/include/fcntl.h index cce3d5ee10..949c6621fd 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -1,4 +1,6 @@ +#ifndef _FCNTL_H #include <io/fcntl.h> /* Now define the internal interfaces. */ extern int __open64 __P ((__const char *__file, int __oflag, ...)); +#endif diff --git a/include/grp.h b/include/grp.h index ddde842fe6..14be78cf00 100644 --- a/include/grp.h +++ b/include/grp.h @@ -1,3 +1,4 @@ +#ifndef _GRP_H #include <grp/grp.h> /* Now define the internal interfaces. */ @@ -6,3 +7,4 @@ extern int __getgrent_r __P ((struct group *__resultbuf, char *buffer, extern int __fgetgrent_r __P ((FILE * __stream, struct group *__resultbuf, char *buffer, size_t __buflen, struct group **__result)); +#endif diff --git a/include/libintl.h b/include/libintl.h index 582cb05d74..3763b04c5f 100644 --- a/include/libintl.h +++ b/include/libintl.h @@ -1,3 +1,4 @@ +#ifndef _LIBINTL_H #include <intl/libintl.h> /* Now define the internal interfaces. */ @@ -5,3 +6,4 @@ extern char *__gettext __P ((__const char *__msgid)); extern char *__textdomain __P ((__const char *__domainname)); extern char *__bindtextdomain __P ((__const char *__domainname, __const char *__dirname)); +#endif diff --git a/include/mntent.h b/include/mntent.h index d869625607..ca8dfc5069 100644 --- a/include/mntent.h +++ b/include/mntent.h @@ -1,3 +1,4 @@ +#ifndef _MNTENT_H #include <misc/mntent.h> /* Now define the internal interfaces. */ @@ -9,3 +10,4 @@ extern int __addmntent __P ((FILE *__stream, __const struct mntent *__mnt)); extern int __endmntent __P ((FILE *__stream)); extern char *__hasmntopt __P ((__const struct mntent *__mnt, __const char *__opt)); +#endif diff --git a/include/pwd.h b/include/pwd.h index 2c57df938f..18e8ac7e94 100644 --- a/include/pwd.h +++ b/include/pwd.h @@ -1,3 +1,4 @@ +#ifndef _PWD_H #include <pwd/pwd.h> /* Now define the internal interfaces. */ @@ -12,3 +13,4 @@ extern int __getpwnam_r __P ((__const char *__name, struct passwd *__resultbuf, extern int __fgetpwent_r __P ((FILE * __stream, struct passwd *__resultbuf, char *__buffer, size_t __buflen, struct passwd **__result)); +#endif diff --git a/include/sched.h b/include/sched.h index 02dc60a872..d28a0123f9 100644 --- a/include/sched.h +++ b/include/sched.h @@ -1,7 +1,9 @@ -#include "posix/sched.h" +#ifndef _SCHED_H +#include <posix/sched.h> /* Now define the internal interfaces. */ /* This is Linux specific. */ extern int __clone __P ((int (*__fn) (void *__arg), void *__child_stack, int __flags, void *__arg)); +#endif diff --git a/include/search.h b/include/search.h index 05dc75aee9..2b4c63ba53 100644 --- a/include/search.h +++ b/include/search.h @@ -1,3 +1,4 @@ +#ifndef _SEARCH_H #include <misc/search.h> /* Now define the internal interfaces. */ @@ -10,3 +11,4 @@ extern void *__tdelete __PMT ((__const void *__key, void **__rootp, __compar_fn_t compar)); extern void __twalk __PMT ((__const void *__root, __action_fn_t action)); extern void __tdestroy __PMT ((void *__root, __free_fn_t freefct)); +#endif diff --git a/include/setjmp.h b/include/setjmp.h index 34fc9e5f69..97b1c3a46f 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -1,3 +1,4 @@ +#ifndef _SETJMP_H #include <setjmp/setjmp.h> /* Now define the internal interfaces. */ @@ -11,3 +12,4 @@ extern void __longjmp __P ((__jmp_buf __env, int __val)) This is used by the machine-dependent definition of `__sigsetjmp'. Always returns zero, for convenience. */ extern int __sigjmp_save __P ((jmp_buf __env, int __savemask)); +#endif diff --git a/include/shadow.h b/include/shadow.h index 5e7f943bc0..be40eb42fa 100644 --- a/include/shadow.h +++ b/include/shadow.h @@ -1,3 +1,4 @@ +#ifndef _SHADOW_H #include <shadow/shadow.h> /* Now define the internal interfaces. */ @@ -14,3 +15,4 @@ extern int __fgetspent_r __P ((FILE *__stream, struct spwd *__result_buf, struct spwd **__result)); extern int __lckpwdf __P ((void)); extern int __ulckpwdf __P ((void)); +#endif diff --git a/include/signal.h b/include/signal.h index 693aeb807a..1a14ff3dc7 100644 --- a/include/signal.h +++ b/include/signal.h @@ -1,3 +1,4 @@ +#ifndef _SIGNAL_H #if defined __need_sig_atomic_t || defined __need_sigset_t # include <signal/signal.h> #else @@ -23,3 +24,4 @@ extern int __sigreturn __P ((struct sigcontext *__scp)); extern int __sigaltstack __P ((__const struct sigaltstack *__ss, struct sigaltstack *__oss)); #endif +#endif diff --git a/include/stdio.h b/include/stdio.h index d09e29d1c1..a3272fc8e9 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,3 +1,4 @@ +#ifndef _STDIO_H #ifdef USE_IN_LIBIO #ifdef __need_FILE # include <libio/stdio.h> @@ -27,3 +28,4 @@ extern int __vsscanf __P ((__const char *__restrict __s, #else #include <stdio/stdio.h> #endif +#endif diff --git a/include/stdlib.h b/include/stdlib.h index c45730428b..7424243e99 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,3 +1,4 @@ +#ifndef _STDLIB_H #include <stdlib/stdlib.h> /* Now define the internal interfaces. */ @@ -39,3 +40,4 @@ extern char *__canonicalize_file_name __P ((__const char *__name)); extern char *__realpath __P ((__const char *__name, char *__resolved)); extern int __ptsname_r __P ((int __fd, char *__buf, size_t __buflen)); extern int __getpt __P ((void)); +#endif diff --git a/include/string.h b/include/string.h index 1ee7ced249..d83a56e053 100644 --- a/include/string.h +++ b/include/string.h @@ -1,3 +1,4 @@ +#ifndef _STRING_H #include <string/string.h> /* Now define the internal interfaces. */ @@ -6,3 +7,4 @@ extern __ptr_t __memccpy __P ((__ptr_t __dest, __const __ptr_t __src, extern size_t __strnlen __P ((__const char *__string, size_t __maxlen)); extern char *__strsep __P ((char **__stringp, __const char *__delim)); extern int __strverscmp __P ((__const char *__s1, __const char *__s2)); +#endif diff --git a/include/sys/file.h b/include/sys/file.h index ec7f3de73d..c3f0af3710 100644 --- a/include/sys/file.h +++ b/include/sys/file.h @@ -1,4 +1,6 @@ +#ifndef _SYS_FILE_H #include <misc/sys/file.h> /* Now define the internal interfaces. */ extern int __flock __P ((int __fd, int __operation)); +#endif diff --git a/include/sys/gmon.h b/include/sys/gmon.h index 2e56188027..492d853f8e 100644 --- a/include/sys/gmon.h +++ b/include/sys/gmon.h @@ -1,3 +1,4 @@ +#ifndef _SYS_GMON_H #include <gmon/sys/gmon.h> /* Now define the internal interfaces. */ @@ -5,3 +6,4 @@ /* Write current profiling data to file. */ extern void __write_profiling __P ((void)); extern void write_profiling __P ((void)); +#endif diff --git a/include/sys/ioctl.h b/include/sys/ioctl.h index e07b08a64f..4d21030ed9 100644 --- a/include/sys/ioctl.h +++ b/include/sys/ioctl.h @@ -1,4 +1,6 @@ +#ifndef _SYS_IOCTL_H #include <misc/sys/ioctl.h> /* Now define the internal interfaces. */ extern int __ioctl __P ((int __fd, unsigned long int __request, ...)); +#endif diff --git a/include/sys/mman.h b/include/sys/mman.h index 3a6c33a354..32c2084bdd 100644 --- a/include/sys/mman.h +++ b/include/sys/mman.h @@ -1,3 +1,4 @@ +#ifndef _SYS_MMAN_H #include_next <sys/mman.h> /* Now define the internal interfaces. */ @@ -11,3 +12,4 @@ extern int __mprotect __P ((__ptr_t __addr, size_t __len, int __prot)); /* This one is Linux specific. */ extern __ptr_t __mremap __P ((__ptr_t __addr, size_t __old_len, size_t __new_len, int __may_move)); +#endif diff --git a/include/sys/resource.h b/include/sys/resource.h index 36950e2f10..ec53c188f9 100644 --- a/include/sys/resource.h +++ b/include/sys/resource.h @@ -1,6 +1,8 @@ +#ifndef _SYS_RESOURCE_H #include <resource/sys/resource.h> /* Now define the internal interfaces. */ extern int __getrlimit __P ((enum __rlimit_resource __resource, struct rlimit *__rlimits)); extern int __getrusage __P ((enum __rusage_who __who, struct rusage *__usage)); +#endif diff --git a/include/sys/select.h b/include/sys/select.h index 860b01347d..be98aa2eb4 100644 --- a/include/sys/select.h +++ b/include/sys/select.h @@ -1,6 +1,8 @@ +#ifndef _SYS_SELECT_H #include <misc/sys/select.h> /* Now define the internal interfaces. */ extern int __pselect __P ((int __nfds, __fd_set *__readfds, __fd_set *__writefds, __fd_set *__exceptfds, struct timespec *__timeout)); +#endif diff --git a/include/sys/socket.h b/include/sys/socket.h index a319272b55..4766c206d8 100644 --- a/include/sys/socket.h +++ b/include/sys/socket.h @@ -1,4 +1,6 @@ +#ifndef _SYS_SOCKET_H #include <socket/sys/socket.h> /* Now define the internal interfaces. */ extern int __socket __P ((int __domain, int __type, int __protocol)); +#endif diff --git a/include/sys/statfs.h b/include/sys/statfs.h index bb4999e2a3..80c8834be4 100644 --- a/include/sys/statfs.h +++ b/include/sys/statfs.h @@ -1,5 +1,7 @@ +#ifndef _SYS_STATFS_H #include <io/sys/statfs.h> /* Now define the internal interfaces. */ extern int __statfs __P ((__const char *__file, struct statfs *__buf)); extern int __fstatfs __P ((int __fildes, struct statfs *__buf)); +#endif diff --git a/include/sys/time.h b/include/sys/time.h index fd9f46778d..5f53e967f6 100644 --- a/include/sys/time.h +++ b/include/sys/time.h @@ -1,3 +1,4 @@ +#ifndef _SYS_TIME_H #include <time/sys/time.h> /* Now document the internal interfaces. */ @@ -11,3 +12,4 @@ extern int __setitimer __P ((enum __itimer_which __which, __const struct itimerval *__new, struct itimerval *__old)); extern int __utimes __P ((__const char *__file, struct timeval __tvp[2])); +#endif diff --git a/include/sys/times.h b/include/sys/times.h index 95162b8931..611bb2fdc9 100644 --- a/include/sys/times.h +++ b/include/sys/times.h @@ -1,4 +1,6 @@ +#ifndef _SYS_TIMES_H #include <posix/sys/times.h> /* Now define the internal interfaces. */ extern clock_t __times __P ((struct tms *__buffer)); +#endif diff --git a/include/sys/wait.h b/include/sys/wait.h index eefc14d705..5ecce413ef 100644 --- a/include/sys/wait.h +++ b/include/sys/wait.h @@ -1,3 +1,4 @@ +#ifndef _SYS_WAIT_H #include <posix/sys/wait.h> /* Now define the internal interfaces. */ @@ -7,3 +8,4 @@ extern __pid_t __wait3 __P ((__WAIT_STATUS __stat_loc, int __options, struct rusage * __usage)); extern __pid_t __wait4 __P ((__pid_t __pid, __WAIT_STATUS __stat_loc, int __options, struct rusage *__usage)); +#endif diff --git a/include/termios.h b/include/termios.h index 90237a8101..ed3b36525f 100644 --- a/include/termios.h +++ b/include/termios.h @@ -1,4 +1,6 @@ +#ifndef _TERMIOS_H #include <termios/termios.h> /* Now define the internal interfaces. */ extern int __tcgetattr __P ((int __fd, struct termios *__termios_p)); +#endif diff --git a/include/tgmath.h b/include/tgmath.h new file mode 100644 index 0000000000..3a2c4a2b2d --- /dev/null +++ b/include/tgmath.h @@ -0,0 +1 @@ +#include <math/tgmath.h> diff --git a/include/time.h b/include/time.h index bc8ce0662a..2659e62717 100644 --- a/include/time.h +++ b/include/time.h @@ -1,3 +1,4 @@ +#ifndef _TIME_H #if defined __need_time_t || defined __need_clock_t || defined __need_timespec # include <time/time.h> #else @@ -35,3 +36,4 @@ extern int __nanosleep __P ((__const struct timespec *__requested_time, struct timespec *__remaining)); extern int __getdate_r __P ((__const char *__string, struct tm *__resbufp)); #endif +#endif diff --git a/include/ulimit.h b/include/ulimit.h index c1523a1864..8dc51d5fb7 100644 --- a/include/ulimit.h +++ b/include/ulimit.h @@ -1,4 +1,6 @@ +#ifndef _ULIMIT_H #include <resource/ulimit.h> /* Now define the internal interfaces. */ extern long int __ulimit __P ((int __cmd, ...)); +#endif diff --git a/include/utmp.h b/include/utmp.h index 4535acb6a0..b7f7d5fe2c 100644 --- a/include/utmp.h +++ b/include/utmp.h @@ -1,3 +1,4 @@ +#ifndef _UTMP_H #include <login/utmp.h> /* Now define the internal interfaces. */ @@ -15,3 +16,4 @@ extern int __getutid_r __P ((__const struct utmp *__id, struct utmp *__buffer, struct utmp **__result)); extern int __getutline_r __P ((__const struct utmp *__line, struct utmp *__buffer, struct utmp **__result)); +#endif diff --git a/include/wchar.h b/include/wchar.h index 95a8c431ab..33166edfdd 100644 --- a/include/wchar.h +++ b/include/wchar.h @@ -1,3 +1,4 @@ +#ifndef _WCHAR_H #include <wcsmbs/wchar.h> /* Now define the internal interfaces. */ @@ -28,3 +29,4 @@ extern size_t __wcsnrtombs __P ((char *__restrict __dst, extern wchar_t *__wcpcpy __P ((wchar_t *__dest, __const wchar_t *__src)); extern wchar_t *__wcpncpy __P ((wchar_t *__dest, __const wchar_t *__src, size_t __n)); +#endif diff --git a/inet/inet_net.c b/inet/inet_net.c index 1def607278..54120cb279 100644 --- a/inet/inet_net.c +++ b/inet/inet_net.c @@ -59,7 +59,7 @@ again: base = 8, cp++; if (*cp == 'x' || *cp == 'X') base = 16, cp++; - while (c = *cp) { + while ((c = *cp)) { if (isdigit(c)) { val = (val * base) + (c - '0'); cp++; @@ -74,7 +74,7 @@ static u_short fts_stat __P((FTS *, struct dirent *, FTSENT *, int)) _a > _b ? _a : _b; }) #endif -#define ISDOT(a) (a[0] == '.' && (!a[1] || a[1] == '.' && !a[2])) +#define ISDOT(a) (a[0] == '.' && (!a[1] || (a[1] == '.' && !a[2]))) #define ISSET(opt) (sp->fts_options & opt) #define SET(opt) (sp->fts_options |= opt) @@ -326,7 +326,7 @@ fts_read(sp) if (p->fts_info == FTS_D) { /* If skipped or crossed mount point, do post-order visit. */ if (instr == FTS_SKIP || - ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev) { + (ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) { if (p->fts_flags & FTS_SYMFOLLOW) (void)__close(p->fts_symfd); if (sp->fts_child) { @@ -376,7 +376,7 @@ fts_read(sp) /* Move to the next node on this level. */ next: tmp = p; - if (p = p->fts_link) { + if ((p = p->fts_link)) { free(tmp); /* @@ -674,7 +674,9 @@ fts_build(sp, type) /* Read the directory, attaching each entry to the `link' pointer. */ adjaddr = NULL; - for (head = tail = NULL, nitems = 0; dp = __readdir(dirp);) { + head = tail = NULL; + nitems = 0; + while((dp = __readdir(dirp))) { int namlen; if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name)) @@ -717,8 +719,8 @@ mem1: saved_errno = errno; p->fts_accpath = cur->fts_accpath; } else if (nlinks == 0 #if defined DT_DIR && defined _DIRENT_HAVE_D_TYPE - || nlinks > 0 && - dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN + || (nlinks > 0 && + dp->d_type != DT_DIR && dp->d_type != DT_UNKNOWN) #endif ) { p->fts_accpath = @@ -964,7 +966,7 @@ fts_lfree(head) register FTSENT *p; /* Free a linked list of structures. */ - while (p = head) { + while ((p = head)) { head = head->fts_link; free(p); } diff --git a/libio/stdio.h b/libio/stdio.h index 774003b490..87709976be 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -559,12 +559,12 @@ typedef __off64_t off64_t; #ifndef __USE_FILE_OFFSET64 -# ifndef __USE_UNIX98 +# ifdef __USE_UNIX98 /* Seek to a certain position on STREAM. */ extern int fseeko __P ((FILE *__stream, __off_t __off, int __whence)); /* Return the current position of STREAM. */ extern __off_t ftello __P ((FILE *__stream)); -#endif +# endif /* Get STREAM's position. */ extern int fgetpos __P ((FILE *__restrict __stream, @@ -573,7 +573,7 @@ extern int fgetpos __P ((FILE *__restrict __stream, extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos)); #else # ifdef __REDIRECT -# ifndef __USE_UNIX98 +# ifdef __USE_UNIX98 extern int __REDIRECT (fseeko, __P ((FILE *__stream, __off64_t __off, int __whence)), fseeko64); @@ -584,7 +584,7 @@ extern int __REDIRECT (fgetpos, __P ((FILE *__restrict __stream, extern int __REDIRECT (fsetpos, __P ((FILE *__stream, __const fpos_t *__pos)), fsetpos64); # else -# ifndef __USE_UNIX98 +# ifdef __USE_UNIX98 # define fseeko fseeko64 # define ftello ftello64 # endif @@ -594,7 +594,7 @@ extern int __REDIRECT (fsetpos, __P ((FILE *__stream, __const fpos_t *__pos)), #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_UNIX98 +# ifdef __USE_UNIX98 extern int fseeko64 __P ((FILE *__stream, __off64_t __off, int __whence)); extern __off64_t ftello64 __P ((FILE *__stream)); # endif diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog index d358962f71..39ffba76d2 100644 --- a/linuxthreads/ChangeLog +++ b/linuxthreads/ChangeLog @@ -1,3 +1,7 @@ +1998-09-06 10:56 Ulrich Drepper <drepper@cygnus.com> + + * sysdeps/pthread/semaphore.h: New file. + 1998-09-06 09:08 Ulrich Drepper <drepper@cygnus.com> * sysdeps/pthread/bits/libc-lock.h (enum __libc_tsd_key_t): Add diff --git a/linuxthreads/sysdeps/pthread/semaphore.h b/linuxthreads/sysdeps/pthread/semaphore.h new file mode 100644 index 0000000000..8793768a8e --- /dev/null +++ b/linuxthreads/sysdeps/pthread/semaphore.h @@ -0,0 +1 @@ +#include <linuxthreads/semaphore.h> diff --git a/locale/newlocale.c b/locale/newlocale.c index 33cc7fa09a..c54d1c82c6 100644 --- a/locale/newlocale.c +++ b/locale/newlocale.c @@ -54,7 +54,7 @@ __newlocale (int category_mask, const char *locale, __locale_t base) category_mask = (1 << LC_ALL) - 1; /* Sanity check for CATEGORY argument. */ - if ((category_mask & ~(1 << LC_ALL) - 1) != 0) + if ((category_mask & ~((1 << LC_ALL) - 1)) != 0) ERROR_RETURN; /* `newlocale' does not support asking for the locale name. */ diff --git a/manual/creature.texi b/manual/creature.texi index 00e3aada90..f88a6d9615 100644 --- a/manual/creature.texi +++ b/manual/creature.texi @@ -19,6 +19,20 @@ comments. You could also use the @samp{-D} option to GCC, but it's better if you make the source files indicate their own meaning in a self-contained way. +This system exists to allow the library to conform to multiple standards. +Although the different standards are often described as supersets of each +other, they are usually incompatible because larger standards require +functions with names that smaller ones reserve to the user program. This +is not mere pedantry --- it has been a problem in practice. For instance, +some non-GNU programs define functions named @code{getline} that have +nothing to do with this library's @code{getline}. They would not be +compilable if all features were enabled indescriminantly. + +This should not be used to verify that a program conforms to a limited +standard. It is insufficent for this purpose, as it will not protect you +from including header files outside the standard, or relying on semantics +undefined within the standard. + @comment (none) @comment POSIX.1 @defvr Macro _POSIX_SOURCE diff --git a/misc/getttyent.c b/misc/getttyent.c index dc4b9fadcb..f73cb79cda 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -55,7 +55,7 @@ getttynam(tty) register struct ttyent *t; setttyent(); - while (t = getttyent()) + while ((t = getttyent())) if (!strcmp(tty, t->ty_name)) break; endttyent(); @@ -131,7 +131,7 @@ getttyent() tty.ty_comment = p; if (*p == 0) tty.ty_comment = 0; - if (p = index(p, '\n')) + if ((p = index(p, '\n'))) *p = '\0'; return (&tty); } @@ -193,7 +193,7 @@ setttyent() if (tf) { (void)rewind(tf); return (1); - } else if (tf = fopen(_PATH_TTYS, "r")) + } else if ((tf = fopen(_PATH_TTYS, "r"))) return (1); return (0); } diff --git a/misc/mntent_r.c b/misc/mntent_r.c index 0ee74e5d9b..f6ee1ca64e 100644 --- a/misc/mntent_r.c +++ b/misc/mntent_r.c @@ -137,10 +137,11 @@ __hasmntopt (const struct mntent *mnt, const char *opt) while ((p = strstr (rest, opt)) != NULL) { - if (p == rest || p[-1] == ',' && - (p[optlen] == '\0' || - p[optlen] == '=' || - p[optlen] == ',')) + if (p == rest + || (p[-1] == ',' + && (p[optlen] == '\0' || + p[optlen] == '=' || + p[optlen] == ','))) return p; rest = strchr (rest, ','); diff --git a/misc/ttyslot.c b/misc/ttyslot.c index 430f9c02d0..7dc9b27c0c 100644 --- a/misc/ttyslot.c +++ b/misc/ttyslot.c @@ -60,11 +60,11 @@ ttyslot() setttyent(); for (cnt = 0; cnt < 3; ++cnt) if (__ttyname_r (cnt, name, buflen) == 0) { - if (p = rindex(name, '/')) + if ((p = rindex(name, '/'))) ++p; else p = name; - for (slot = 1; ttyp = getttyent(); ++slot) + for (slot = 1; (ttyp = getttyent()); ++slot) if (!strcmp(ttyp->ty_name, p)) { endttyent(); return(slot); diff --git a/nscd/nscd_conf.c b/nscd/nscd_conf.c index 62a1e6cbd1..917fe022ff 100644 --- a/nscd/nscd_conf.c +++ b/nscd/nscd_conf.c @@ -70,7 +70,7 @@ nscd_parse_file (const char *fname) arg1 = cp; ++arg1; *cp = '\0'; - if (*cp = '\0' || strlen (entry) == 0) + if (strlen (entry) == 0) dbg_log (_("Parse error: %s"), line); while (isspace (*arg1) && *arg1 != '\0') ++arg1; diff --git a/nss/nsswitch.c b/nss/nsswitch.c index e4f475868e..b3b540917e 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -618,7 +618,8 @@ nss_parse_service_list (const char *line) lookup_actions action; /* Grok ! before name to mean all statii but that one. */ - if (not = line[0] == '!') + not = line[0] == '!'; + if (not) ++line; /* Read status name. */ diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c index 82af1666a2..d73021cc2e 100644 --- a/posix/wordexp-test.c +++ b/posix/wordexp-test.c @@ -119,6 +119,11 @@ struct test_case_struct { 0, "foo", "*$var*", 0, 1, { "*foo*", }, IFS }, { 0, "o thr", "*$var*", 0, 2, { "two", "three" }, IFS }, + /* Different IFS values */ + { 0, NULL, "a b\tc\nd ", 0, 4, { "a", "b", "c", "d" }, NULL /* unset */ }, + { 0, NULL, "a b\tc d ", 0, 1, { "a b\tc d " }, "" /* `null' */ }, + { 0, NULL, "a,b c\n, d", 0, 3, { "a", "b c", " d" }, "\t\n," }, + /* Other things that should succeed */ { 0, NULL, "\\*\"|&;<>\"\\(\\)\\{\\}", 0, 1, { "*|&;<>(){}", }, IFS }, { 0, "???", "$var", 0, 1, { "???", }, IFS }, @@ -127,7 +132,7 @@ struct test_case_struct { 0, NULL, "", 0, 0, { NULL, }, IFS }, /* Things that should fail */ - { WRDE_BADCHAR, NULL, "new\nline", 0, 0, { NULL, }, IFS }, + { WRDE_BADCHAR, NULL, "new\nline", 0, 0, { NULL, }, "" /* \n not IFS */ }, { WRDE_BADCHAR, NULL, "pipe|symbol", 0, 0, { NULL, }, IFS }, { WRDE_BADCHAR, NULL, "&ersand", 0, 0, { NULL, }, IFS }, { WRDE_BADCHAR, NULL, "semi;colon", 0, 0, { NULL, }, IFS }, diff --git a/posix/wordexp.c b/posix/wordexp.c index fe3e2b2cea..dff5d30dad 100644 --- a/posix/wordexp.c +++ b/posix/wordexp.c @@ -2049,8 +2049,8 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags) ifs = getenv ("IFS"); if (!ifs) - /* NULL IFS means no field-splitting is to be performed */ - ifs = strcpy (ifs_white, ""); + /* IFS unset - use <space><tab><newline>. */ + ifs = strcpy (ifs_white, " \t\n"); else { char *ifsch = ifs; @@ -2082,22 +2082,6 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags) for (words_offset = 0 ; words[words_offset] ; ++words_offset) switch (words[words_offset]) { - case '\n': - case '|': - case '&': - case ';': - case '<': - case '>': - case '(': - case ')': - case '{': - case '}': - /* Fail */ - wordfree (pwordexp); - pwordexp->we_wordc = 0; - pwordexp->we_wordv = old_wordv; - return WRDE_BADCHAR; - case '\\': error = parse_backslash (&word, &word_length, &max_length, words, &words_offset); @@ -2175,6 +2159,16 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags) /* Is it a field separator? */ if (strchr (ifs, words[words_offset]) == NULL) { + /* Not a field separator -- but is it a valid word char? */ + if (strchr ("\n|&;<>(){}", words[words_offset])) + { + /* Fail */ + wordfree (pwordexp); + pwordexp->we_wordc = 0; + pwordexp->we_wordv = old_wordv; + return WRDE_BADCHAR; + } + /* "Ordinary" character -- add it to word */ word = w_addchar (word, &word_length, &max_length, diff --git a/resolv/gethnamaddr.c b/resolv/gethnamaddr.c index 16d7509f23..9a8efd66d3 100644 --- a/resolv/gethnamaddr.c +++ b/resolv/gethnamaddr.c @@ -815,7 +815,7 @@ _gethtent() cp++; host.h_name = cp; q = host.h_aliases = host_aliases; - if (cp = strpbrk(cp, " \t")) + if ((cp = strpbrk(cp, " \t"))) *cp++ = '\0'; while (cp && *cp) { if (*cp == ' ' || *cp == '\t') { @@ -824,7 +824,7 @@ _gethtent() } if (q < &host_aliases[MAXALIASES - 1]) *q++ = cp; - if (cp = strpbrk(cp, " \t")) + if ((cp = strpbrk(cp, " \t"))) *cp++ = '\0'; } *q = NULL; @@ -856,7 +856,7 @@ _gethtbyname2(name, af) register char **cp; _sethtent(0); - while (p = _gethtent()) { + while ((p = _gethtent())) { if (p->h_addrtype != af) continue; if (strcasecmp(p->h_name, name) == 0) @@ -878,7 +878,7 @@ _gethtbyaddr(addr, len, af) register struct hostent *p; _sethtent(0); - while (p = _gethtent()) + while ((p = _gethtent())) if (p->h_addrtype == af && !bcmp(p->h_addr, addr, len)) break; _endhtent(); diff --git a/resolv/nsap_addr.c b/resolv/nsap_addr.c index 5f41a736d6..5157c37c14 100644 --- a/resolv/nsap_addr.c +++ b/resolv/nsap_addr.c @@ -63,7 +63,7 @@ inet_nsap_addr(ascii, binary, maxlen) c = toupper(c); if (isxdigit(c)) { nib = xtob(c); - if (c = *ascii++) { + if ((c = *ascii++)) { c = toupper(c); if (isxdigit(c)) { *binary++ = (nib << 4) | xtob(c); diff --git a/resolv/res_debug.c b/resolv/res_debug.c index 3afe8c23a8..92b8fa1d1a 100644 --- a/resolv/res_debug.c +++ b/resolv/res_debug.c @@ -203,7 +203,7 @@ do_rrset(msg, len, cp, cnt, pflag, file, hs) * Print answer records. */ sflag = (_res.pfcode & pflag); - if (n = ntohs(cnt)) { + if ((n = ntohs(cnt))) { if ((!_res.pfcode) || ((sflag) && (_res.pfcode & RES_PRF_HEAD1))) fprintf(file, hs); @@ -337,7 +337,7 @@ __fp_nquery(msg, len, file) /* * Print question records. */ - if (n = ntohs(hp->qdcount)) { + if ((n = ntohs(hp->qdcount))) { if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES)) fprintf(file, ";; QUESTIONS:\n"); while (--n >= 0) { @@ -647,7 +647,7 @@ __p_rr(cp, msg, file) cp2 = cp1 + dlen; while (cp < cp2) { putc('"', file); - if (n = (unsigned char) *cp++) { + if ((n = (unsigned char) *cp++)) { for (c = n; c > 0 && cp < cp2; c--) { if (strchr("\n\"\\", *cp)) (void) putc('\\', file); diff --git a/stdio-common/_itoa.c b/stdio-common/_itoa.c index e5705d54b2..845928903c 100644 --- a/stdio-common/_itoa.c +++ b/stdio-common/_itoa.c @@ -196,7 +196,7 @@ _itoa (value, buflim, base, upper_case) if (BITS_PER_MP_LIMB % BITS != 0) \ { \ work_lo |= ((work_hi \ - & ((1 << BITS - BITS_PER_MP_LIMB % BITS) \ + & ((1 << (BITS - BITS_PER_MP_LIMB%BITS)) \ - 1)) \ << BITS_PER_MP_LIMB % BITS); \ *--bp = digits[work_lo]; \ diff --git a/stdlib/strtod.c b/stdlib/strtod.c index 154e2049d9..5b15859066 100644 --- a/stdlib/strtod.c +++ b/stdlib/strtod.c @@ -664,7 +664,7 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM) if ((wchar_t) c == decimal) { c = *++cp; - while (c >= L_('0') && c <= L_('9') || + while ((c >= L_('0') && c <= L_('9')) || (base == 16 && TOLOWER (c) >= L_('a') && TOLOWER (c) <= L_('f'))) { if (c != L_('0') && lead_zero == -1) diff --git a/string/strverscmp.c b/string/strverscmp.c index 39dfc61a9b..07095566a4 100644 --- a/string/strverscmp.c +++ b/string/strverscmp.c @@ -81,7 +81,7 @@ __strverscmp (s1, s2) c1 = *p1++; c2 = *p2++; /* Hint: '0' is a digit too. */ - state = S_N | (c1 == '0') + (isdigit (c1) != 0); + state = S_N | ((c1 == '0') + (isdigit (c1) != 0)); while ((diff = c1 - c2) == 0 && c1 != '\0') { @@ -91,7 +91,7 @@ __strverscmp (s1, s2) state |= (c1 == '0') + (isdigit (c1) != 0); } - state = result_type[state << 2 | ((c2 == '0') + (isdigit (c2) != 0))]; + state = result_type[state << 2 | (((c2 == '0') + (isdigit (c2) != 0)))]; switch (state) { diff --git a/sunrpc/svc.c b/sunrpc/svc.c index c4b91aa074..da97098add 100644 --- a/sunrpc/svc.c +++ b/sunrpc/svc.c @@ -422,7 +422,7 @@ svc_getreqset (readfds) maskp = (u_int32_t *) readfds->fds_bits; for (sock = 0; sock < setsize; sock += 32) { - for (mask = *maskp++; bit = ffs (mask); mask ^= (1 << (bit - 1))) + for (mask = *maskp++; (bit = ffs (mask)); mask ^= (1 << (bit - 1))) { /* sock has input waiting */ xprt = xports[sock + bit - 1]; diff --git a/sysdeps/libm-ieee754/e_cosh.c b/sysdeps/libm-ieee754/e_cosh.c index 4f6b52435b..65106b9989 100644 --- a/sysdeps/libm-ieee754/e_cosh.c +++ b/sysdeps/libm-ieee754/e_cosh.c @@ -77,12 +77,11 @@ static double one = 1.0, half=0.5, huge = 1.0e300; } /* |x| in [22, log(maxdouble)] return half*exp(|x|) */ - if (ix < 0x40862E42) return half*__ieee754_exp(fabs(x)); + if (ix < 0x40862e42) return half*__ieee754_exp(fabs(x)); /* |x| in [log(maxdouble), overflowthresold] */ GET_LOW_WORD(lx,x); - if (ix<0x408633CE || - (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) { + if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { w = __ieee754_exp(half*fabs(x)); t = half*w; return t*w; diff --git a/sysdeps/libm-ieee754/e_gamma_r.c b/sysdeps/libm-ieee754/e_gamma_r.c index eb80809843..901f1451d2 100644 --- a/sysdeps/libm-ieee754/e_gamma_r.c +++ b/sysdeps/libm-ieee754/e_gamma_r.c @@ -33,7 +33,7 @@ __ieee754_gamma_r (double x, int *signgamp) EXTRACT_WORDS (hx, lx, x); - if ((hx & 0x7fffffff | lx) == 0) + if (((hx & 0x7fffffff) | lx) == 0) /* Return value for x == 0 is NaN with invalid exception. */ return x / x; if (hx < 0 && (u_int32_t) hx < 0xfff00000 && __rint (x) == x) diff --git a/sysdeps/libm-ieee754/e_sinh.c b/sysdeps/libm-ieee754/e_sinh.c index 1b37256687..1701b9bb67 100644 --- a/sysdeps/libm-ieee754/e_sinh.c +++ b/sysdeps/libm-ieee754/e_sinh.c @@ -71,11 +71,11 @@ static double one = 1.0, shuge = 1.0e307; } /* |x| in [22, log(maxdouble)] return 0.5*exp(|x|) */ - if (ix < 0x40862E42) return h*__ieee754_exp(fabs(x)); + if (ix < 0x40862e42) return h*__ieee754_exp(fabs(x)); /* |x| in [log(maxdouble), overflowthresold] */ GET_LOW_WORD(lx,x); - if (ix<0x408633CE || (ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d)) { + if (ix<0x408633ce || ((ix==0x408633ce)&&(lx<=(u_int32_t)0x8fb9f87d))) { w = __ieee754_exp(0.5*fabs(x)); t = h*w; return t*w; diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index fec30f97d7..30cc6364e7 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -295,7 +295,7 @@ gaih_inet (const char *name, const struct gaih_service *service, { if (tp->name != NULL) { - if (rc = gaih_inet_serv (service->name, tp, &st)) + if ((rc = gaih_inet_serv (service->name, tp, &st))) return rc; } else @@ -303,7 +303,7 @@ gaih_inet (const char *name, const struct gaih_service *service, struct gaih_servtuple **pst = &st; for (tp++; tp->name; tp++) { - if (rc = gaih_inet_serv (service->name, tp, pst)) + if ((rc = gaih_inet_serv (service->name, tp, pst))) { if (rc & GAIH_OKIFUNSPEC) continue; @@ -567,7 +567,7 @@ getaddrinfo (const char *name, const char *service, if ((pg == NULL) || (pg->gaih != g->gaih)) { pg = g; - if (i = g->gaih (name, pservice, hints, end)) + if ((i = g->gaih (name, pservice, hints, end))) { if ((hints->ai_family == AF_UNSPEC) && (i & GAIH_OKIFUNSPEC)) continue; diff --git a/time/strftime.c b/time/strftime.c index f0be6b646d..ed029605d9 100644 --- a/time/strftime.c +++ b/time/strftime.c @@ -542,7 +542,13 @@ my_strftime (s, maxsize, format, tp) if (bytes == 0) break; - if (bytes == (size_t) -2 || bytes == (size_t) -1) + if (bytes == (size_t) -2) + { + len += strlen (f + len); + break; + } + + if (bytes == (size_t) -1) { len++; break; @@ -553,6 +559,7 @@ my_strftime (s, maxsize, format, tp) while (! mbsinit (&mbstate)); cpy (len, f); + f += len - 1; continue; } } |