diff options
author | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2014-12-25 22:48:20 +0100 |
---|---|---|
committer | Waldemar Brodkorb <wbx@uclibc-ng.org> | 2014-12-25 22:48:20 +0100 |
commit | da932d59161a2d833596be5443c81ff244d2db58 (patch) | |
tree | f0be076d5698256344227fb8c63f5da29ff57939 /libc | |
parent | 88842f7126daccf205204be05d3143c73fa0624d (diff) | |
parent | 638a23483b40c5b606ee323e6612e7e454e5154b (diff) |
merge upstream changes
Diffstat (limited to 'libc')
-rw-r--r-- | libc/stdio/_fpmaxtostr.c | 13 | ||||
-rw-r--r-- | libc/sysdeps/linux/common/bits/getopt.h | 2 | ||||
-rw-r--r-- | libc/unistd/Makefile.in | 14 | ||||
-rw-r--r-- | libc/unistd/getopt.c | 2 |
4 files changed, 20 insertions, 11 deletions
diff --git a/libc/stdio/_fpmaxtostr.c b/libc/stdio/_fpmaxtostr.c index f7ea792c4..35805844a 100644 --- a/libc/stdio/_fpmaxtostr.c +++ b/libc/stdio/_fpmaxtostr.c @@ -45,11 +45,6 @@ */ #define isnan(x) ((x) != (x)) -/* Without seminumerical functions to examine the sign bit, this is - * about the best we can do to test for '-0'. - */ -#define zeroisnegative(x) ((1./(x)) < 0) - /*****************************************************************************/ /* Don't change anything that follows peroid!!! ;-) */ /*****************************************************************************/ @@ -262,7 +257,13 @@ ssize_t _fpmaxtostr(FILE * fp, __fpmax_t x, struct printf_info *info, if (x == 0) { /* Handle 0 now to avoid false positive. */ #ifdef __UCLIBC_HAVE_SIGNED_ZERO__ - if (zeroisnegative(x)) { /* Handle 'signed' zero. */ + union { + double x; + struct { + unsigned int l1, l2; + } i; + } u = {x}; + if (u.i.l1 ^ u.i.l2) { /* Handle 'signed' zero. */ *sign_str = '-'; } #endif /* __UCLIBC_HAVE_SIGNED_ZERO__ */ diff --git a/libc/sysdeps/linux/common/bits/getopt.h b/libc/sysdeps/linux/common/bits/getopt.h index a49f023ce..dababe07d 100644 --- a/libc/sysdeps/linux/common/bits/getopt.h +++ b/libc/sysdeps/linux/common/bits/getopt.h @@ -126,7 +126,7 @@ extern int getopt (int ___argc, char *const *___argv, const char *__shortopts) __THROW; libc_hidden_proto(getopt) -#if defined __UCLIBC_HAS_GNU_GETOPT__ || defined __UCLIBC_HAS_GETOPT_LONG__ +#if defined __UCLIBC_HAS_GETOPT_LONG__ #ifndef __need_getopt extern int getopt_long (int ___argc, char *const *___argv, const char *__shortopts, diff --git a/libc/unistd/Makefile.in b/libc/unistd/Makefile.in index b15d60a16..659008d4d 100644 --- a/libc/unistd/Makefile.in +++ b/libc/unistd/Makefile.in @@ -16,10 +16,16 @@ OMIT-$(ARCH_USE_MMU) += __exec_alloc.c OMIT-$(if $(UCLIBC_SUSV3_LEGACY),,y) += ualarm.c usleep.c #OMIT-$(UCLIBC_HAS_THREADS_NATIVE) += sleep.c -# XXX: GNU_GETOPT comes with getopt_long unconditionally, which is wrong -GO_LONG := $(if $(UCLIBC_HAS_GNU_GETOPT),getopt_long-simple.c) -OMIT-y += $(if $(UCLIBC_HAS_GNU_GETOPT),getopt-susv3.c $(GO_LONG),getopt.c) -OMIT-y += $(if $(UCLIBC_HAS_GNU_GETSUBOPT),getsubopt-susv3.c,getsubopt.c) +ifeq ($(UCLIBC_HAS_GNU_GETOPT),y) +# GNU getopt family +OMIT-y += getopt-susv3.c getopt_long-simple.c getsubopt-susv3.c +OMIT-y += $(if $(UCLIBC_HAS_GNU_GETSUBOPT),,getsubopt.c) +else +# SuS getopt family +OMIT-y += getopt.c getsubopt.c +OMIT-y += $(if $(UCLIBC_HAS_GETOPT_LONG),,getopt_long-simple.c) +OMIT-y += $(if $(UCLIBC_HAS_GNU_GETSUBOPT),,getsubopt-susv3.c) +endif CSRC-y := $(filter-out $(OMIT-y),$(CSRC-y)) diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 3944c7c1f..f63482bc8 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -1162,6 +1162,7 @@ getopt (int argc, char *const *argv, const char *optstring) } libc_hidden_def(getopt) +#if defined __UCLIBC_HAS_GETOPT_LONG__ int getopt_long (int argc, char *const *argv, const char *options, const struct option *long_options, int *opt_index) @@ -1180,5 +1181,6 @@ getopt_long_only (int argc, char *const *argv, const char *options, { return _getopt_internal (argc, argv, options, long_options, opt_index, 1); } +#endif /* __UCLIBC_HAS_GETOPT_LONG__ */ #endif /* Not ELIDE_CODE. */ |