From 8ba7d5cebbd4acf40dc8d22982baa50c2e1fd194 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 24 May 2008 22:22:20 +0000 Subject: Updated to fedora-glibc-20080524T2218 --- ChangeLog | 72 ++++++++++ Makeconfig | 1 + Makefile | 11 +- bits/termios.h | 4 +- elf/Makefile | 12 +- fedora/branch.mk | 4 +- fedora/glibc.spec.in | 5 +- iconvdata/Depend | 1 + include/inline-hashtab.h | 2 +- libio/stdio.h | 2 +- localedata/ChangeLog | 5 + localedata/locales/iso14651_t1_common | 3 - math/libm-test.inc | 4 +- nptl/ChangeLog | 5 +- resolv/res_send.c | 30 ++++- scripts/data/localplt-sparc-linux-gnu.data | 18 +++ scripts/data/localplt-sparc64-linux-gnu.data | 20 +++ scripts/soversions.awk | 13 ++ shlib-versions | 5 + stdio-common/Makefile | 7 +- stdio-common/scanf14.c | 53 ++++++++ stdio-common/scanf15.c | 43 ++++++ stdio-common/scanf16.c | 147 +++++++++++++++++++++ stdio-common/scanf17.c | 128 ++++++++++++++++++ string/endian.h | 66 ++++----- sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S | 2 +- sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h | 16 ++- sysdeps/unix/sysv/linux/sparc/sparc64/brk.S | 6 +- sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h | 15 ++- 29 files changed, 630 insertions(+), 70 deletions(-) create mode 100644 scripts/data/localplt-sparc-linux-gnu.data create mode 100644 scripts/data/localplt-sparc64-linux-gnu.data create mode 100644 stdio-common/scanf16.c create mode 100644 stdio-common/scanf17.c diff --git a/ChangeLog b/ChangeLog index 9ffb261908..03cffb9713 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,75 @@ +2008-05-24 Jakub Jelinek + + * libio/stdio.h (vscanf): Fix -std=c99 redirect. + * stdio-common/Makefile (tests): Add scanf16 and scanf17. + (CFLAGS-scanf17.c): New. + * stdio-common/scanf14.c (main): Add fscanf and scanf tests. + * stdio-common/scanf15.c (main): Likewise. + * stdio-common/scanf16.c: New test. + * stdio-common/scanf17.c: New test. + +2008-05-24 Ulrich Drepper + + * resolv/res_send.c (send_dg): If we already have one of two + answers and the server reports SERVFAIL, NOTIMP, or REFUSED, then + use the one answer insted of failing. + +2008-02-20 Ryan S. Arnold + + * math/libm-test.inc (exp_test): Exclude expl(1000.0L) from + being executed on PowerPC as the expected result exceeds IBM + long double 128 __LDBL_MAX__. + +2008-05-21 Roland McGrath + + * shlib-versions (sparc.*-.*-.*, sparc64.*-.*-.*): Add ABI lines. + + * Makefile (check-data): Use $(abi-name) before other guesses. + Look in $(add-ons) dirs before scripts/data/. + * elf/Makefile (check-data): Likewise. + + * scripts/soversions.awk: Grok ABI line. + * Makeconfig ($(common-objpfx)soversions.mk): Likewise. + Emit definition for abi-name variable. + +2008-05-21 Ulrich Drepper + + * string/endian.h: Define new fixed-size hto* and *toh macros only + if [__USE_BSD]. + + * iconvdata/Depend: Add localedata. + +2008-05-21 Samuel Thibault + + * bits/termios.h (ONLCR): Define under [__USE_XOPEN] too. + +2008-05-08 David S. Miller + + * sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S: Use + HIDDEN_JUMPTARGET. + * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h + (__SYSCALL_CLOBBERS): Remove %g* registers. + * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h + (__SYSCALL_CLOBBERS): Likewise. + * scripts/data/localplt-sparc-linux-gnu.data: New file. + * scripts/data/localplt-sparc64-linux-gnu.data: Likewise. + +2008-05-21 Jakub Jelinek + + * sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h + (CALL_ERRNO_LOCATION): Define. + (__SYSCALL_STRING, __CLONE_SYSCALL_STRING): Use it. + * sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h + (CALL_ERRNO_LOCATION): Define. + (__SYSCALL_STRING, __CLONE_SYSCALL_STRING): Use it. + * sysdeps/unix/sysv/linux/sparc/sparc64/brk.S (__brk): Use + HIDDEN_JUMPTARGET for __errno_location call in libc.so. + +2008-05-20 Ulrich Drepper + + * include/inline-hashtab.h (higher_prime_number): Fix type of mid + variable. + 2008-05-20 Jakub Jelinek * sysdeps/unix/sysv/linux/sparc/sparc32/sigcontextinfo.h diff --git a/Makeconfig b/Makeconfig index d269936f32..7de7621f56 100644 --- a/Makeconfig +++ b/Makeconfig @@ -826,6 +826,7 @@ $(common-objpfx)soversions.mk: $(common-objpfx)soversions.i $(..)Makeconfig (seen_DEFAULT=0; seen_WORDSIZE32=0; seen_WORDSIZE64=0; \ while read which lib number setname; do \ eval seen_$$which=1; \ + test x"$$which" != xABI || echo abi-name = "$$lib"; \ test x"$$which" = xDEFAULT || continue; \ case $$number in \ [0-9]*) echo "$$lib.so-version=.$$number"; \ diff --git a/Makefile b/Makefile index 43c4f4d4b5..437854ed33 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -# Copyright (C) 1991-2002,2003,2004,2005,2006 Free Software Foundation, Inc. +# Copyright (C) 1991-2002,2003,2004,2005,2006,2008 +# 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 @@ -246,8 +247,12 @@ tests-clean: tests: $(objpfx)c++-types-check.out $(objpfx)check-local-headers.out ifneq ($(CXX),no) check-data := $(firstword $(wildcard \ - $(foreach M,$(config-machine) $(base-machine),\ - scripts/data/c++-types-$M-$(config-os).data))) + $(foreach D,$(add-ons) scripts/data,\ + $(patsubst %,$D/c++-types-%.data,\ + $(abi-name) \ + $(addsuffix -$(config-os),\ + $(config-machine) \ + $(base-machine)))))) ifneq (,$(check-data)) $(objpfx)c++-types-check.out: $(check-data) scripts/check-c++-types.sh scripts/check-c++-types.sh $< $(CXX) $(filter-out -std=gnu99 -Wstrict-prototypes,$(CFLAGS)) $(CPPFLAGS) > $@ diff --git a/bits/termios.h b/bits/termios.h index 4dc0fab911..293d0a6061 100644 --- a/bits/termios.h +++ b/bits/termios.h @@ -135,8 +135,10 @@ struct termios /* Output modes. */ tcflag_t c_oflag; #define OPOST (1 << 0) /* Perform output processing. */ -#ifdef __USE_BSD +#if defined __USE_BSD || defined __USE_XOPEN # define ONLCR (1 << 1) /* Map NL to CR-NL on output. */ +#endif +#ifdef __USE_BSD # define OXTABS TAB3 /* Expand tabs to spaces. */ # define ONOEOT (1 << 3) /* Discard EOT (^D) on output. */ #endif diff --git a/elf/Makefile b/elf/Makefile index 861485dcd1..e509153547 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -841,10 +841,14 @@ $(objpfx)tst-dlmodcount: $(libdl) $(objpfx)tst-dlmodcount.out: $(test-modules) check-data := $(firstword $(wildcard \ - $(patsubst %,../scripts/data/localplt-%.data,\ - $(addsuffix -$(config-os),\ - $(config-machine) $(base-machine))\ - generic))) + $(foreach D,$(add-ons) scripts/data,\ + $(patsubst %,$(..)$D/localplt-%.data,\ + $(abi-name) \ + $(addsuffix -$(config-os),\ + $(config-machine) \ + $(base-machine)) \ + generic)))) + tests: $(objpfx)check-localplt.out ifeq ($(have-thread-library),yes) diff --git a/fedora/branch.mk b/fedora/branch.mk index a040576330..6e7d3e4540 100644 --- a/fedora/branch.mk +++ b/fedora/branch.mk @@ -3,5 +3,5 @@ glibc-branch := fedora glibc-base := HEAD DIST_BRANCH := devel COLLECTION := dist-f8 -fedora-sync-date := 2008-05-20 19:24 UTC -fedora-sync-tag := fedora-glibc-20080520T1924 +fedora-sync-date := 2008-05-24 22:18 UTC +fedora-sync-tag := fedora-glibc-20080524T2218 diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in index 3b06768f62..44aa01c1b2 100644 --- a/fedora/glibc.spec.in +++ b/fedora/glibc.spec.in @@ -19,7 +19,7 @@ Summary: The GNU libc libraries Name: glibc Version: @glibcversion@ -Release: 4 +Release: 5 # GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries. # Things that are linked directly into dynamically linked programs # and shared libraries (e.g. crt files, lib*_nonshared.a) have an additional @@ -976,6 +976,9 @@ rm -f *.filelist* %endif %changelog +* Sun May 25 2008 Jakub Jelinek 2.8.90-5 +- update from trunk + * Tue May 20 2008 Jakub Jelinek 2.8.90-4 - further getaddrinfo and nscd fixes diff --git a/iconvdata/Depend b/iconvdata/Depend index 401deb536c..38c28d0c90 100644 --- a/iconvdata/Depend +++ b/iconvdata/Depend @@ -1 +1,2 @@ iconv +localedata diff --git a/include/inline-hashtab.h b/include/inline-hashtab.h index 1c36bd7fce..ad361cd1ed 100644 --- a/include/inline-hashtab.h +++ b/include/inline-hashtab.h @@ -74,7 +74,7 @@ higher_prime_number (unsigned long n) while (low != high) { - const unsigned long *mid = low + (high - low) / 2; + const uint32_t *mid = low + (high - low) / 2; if (n > *mid) low = mid + 1; else diff --git a/libio/stdio.h b/libio/stdio.h index c14351a5d5..e794da2e12 100644 --- a/libio/stdio.h +++ b/libio/stdio.h @@ -477,7 +477,7 @@ extern int __REDIRECT (vfscanf, __isoc99_vfscanf) __attribute__ ((__format__ (__scanf__, 2, 0))) __wur; extern int __REDIRECT (vscanf, (__const char *__restrict __format, - _G_va_list __arg), __isoc99_vfscanf) + _G_va_list __arg), __isoc99_vscanf) __attribute__ ((__format__ (__scanf__, 1, 0))) __wur; extern int __REDIRECT (vsscanf, (__const char *__restrict __s, diff --git a/localedata/ChangeLog b/localedata/ChangeLog index 86f9d763d0..b446ad4361 100644 --- a/localedata/ChangeLog +++ b/localedata/ChangeLog @@ -1,3 +1,8 @@ +2008-05-21 Ulrich Drepper + + * locales/iso14651_t1_common: Remove U0C0D entry added for Telugu. + Reported by Pravin Satpute. + 2008-05-16 Ulrich Drepper * locales/iso14651_t1_common: Remove duplicate U0C7B definition. diff --git a/localedata/locales/iso14651_t1_common b/localedata/locales/iso14651_t1_common index e9721fd078..fcbd897f0e 100644 --- a/localedata/locales/iso14651_t1_common +++ b/localedata/locales/iso14651_t1_common @@ -3406,7 +3406,6 @@ order_start ;forward;forward;forward;forward,position ;;;IGNORE ;;;IGNORE ;;;IGNORE - ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE @@ -3416,8 +3415,6 @@ order_start ;forward;forward;forward;forward,position ;;;IGNORE ;;;IGNORE ;;;IGNORE -#XXX This is wrong since there is already a definition for U0C7B. -# ;;;IGNORE ;;;IGNORE ;;;IGNORE ;;;IGNORE diff --git a/math/libm-test.inc b/math/libm-test.inc index 267d6077e1..6d9a3ec6cb 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -2511,8 +2511,8 @@ exp_test (void) TEST_f_f (exp, 0.75L, 2.11700001661267466854536981983709561L); TEST_f_f (exp, 50.0L, 5184705528587072464087.45332293348538L); TEST_f_f (exp, 88.72269439697265625L, 3.40233126623160774937554134772290447915e38L); -#ifdef TEST_LDOUBLE - /* The result can only be represented in long double. */ +#if defined TEST_LDOUBLE && __LDBL_MAX_EXP__ > 1024 + /* The result can only be represented in sane long double. */ TEST_f_f (exp, 1000.0L, 0.197007111401704699388887935224332313e435L); #endif diff --git a/nptl/ChangeLog b/nptl/ChangeLog index ac01c3e5bb..95e478af2e 100644 --- a/nptl/ChangeLog +++ b/nptl/ChangeLog @@ -1,6 +1,7 @@ -2008-05-19 Jakub Jelinek +2008-05-20 Jakub Jelinek + David S. Miller - * elf/soinit.c (__EH_FRAME_BEGIN__): Remove. + * sysdeps/unix/sysv/linux/sparc/sparc64/Makefile: New file. 2008-05-10 Ulrich Drepper diff --git a/resolv/res_send.c b/resolv/res_send.c index e67ef1c676..e78ff967aa 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -1001,12 +1001,12 @@ send_dg(res_state statp, need_recompute = 1; } if (n == 0) { - Dprint(statp->options & RES_DEBUG, (stdout, - ";; timeout sending\n")); - if (recvresp1) - return resplen; - if (buf2 != NULL && recvresp2) - return 1; + Dprint(statp->options & RES_DEBUG, (stdout, ";; timeout\n")); + if (recvresp1 || (buf2 != NULL && recvresp2)) + { + *resplen2 = 1; + return resplen; + } *gotsomewhere = 1; return (0); @@ -1184,6 +1184,24 @@ send_dg(res_state statp, thisansp, (*thisresplen > *thisanssiz) ? *thisanssiz : *thisresplen); + + if (recvresp1 || (buf2 != NULL && recvresp2)) + { + *resplen2 = 1; + return resplen; + } + if (buf2 != NULL) + { + /* We are waiting for a possible second reply. */ + resplen = 1; + if (hp->id == anhp->id) + recvresp1 = 1; + else + recvresp2 = 1; + + goto wait; + } + next_ns: __res_iclose(statp, false); /* don't retry if called from dig */ diff --git a/scripts/data/localplt-sparc-linux-gnu.data b/scripts/data/localplt-sparc-linux-gnu.data new file mode 100644 index 0000000000..5ceed16c9b --- /dev/null +++ b/scripts/data/localplt-sparc-linux-gnu.data @@ -0,0 +1,18 @@ +libc.so: _Q_add +libc.so: _Q_div +libc.so: _Q_feq +libc.so: _Q_fge +libc.so: _Q_fle +libc.so: _Q_flt +libc.so: _Q_fne +libc.so: _Q_itoq +libc.so: _Q_mul +libc.so: _Q_sub +libc.so: _Unwind_Find_FDE +libc.so: calloc +libc.so: ffs +libc.so: free +libc.so: malloc +libc.so: memalign +libc.so: realloc +libm.so: matherr diff --git a/scripts/data/localplt-sparc64-linux-gnu.data b/scripts/data/localplt-sparc64-linux-gnu.data new file mode 100644 index 0000000000..5e6e42d672 --- /dev/null +++ b/scripts/data/localplt-sparc64-linux-gnu.data @@ -0,0 +1,20 @@ +libc.so: _Qp_add +libc.so: _Qp_div +libc.so: _Qp_feq +libc.so: _Qp_fge +libc.so: _Qp_fle +libc.so: _Qp_flt +libc.so: _Qp_fne +libc.so: _Qp_itoq +libc.so: _Qp_mul +libc.so: _Qp_qtod +libc.so: _Qp_sub +libc.so: _Qp_xtoq +libc.so: _Unwind_Find_FDE +libc.so: calloc +libc.so: ffs +libc.so: free +libc.so: malloc +libc.so: memalign +libc.so: realloc +libm.so: matherr diff --git a/scripts/soversions.awk b/scripts/soversions.awk index 32ce076ba9..55577ccc7e 100644 --- a/scripts/soversions.awk +++ b/scripts/soversions.awk @@ -18,6 +18,16 @@ $2 ~ /WORDSIZE[3264]/ { next; } +$2 == "ABI" { + if ((config ~ thiscf) && !abiname) { + abiname = $3; + sub(/@CPU@/, cpu, abiname); + sub(/@VENDOR@/, vendor, abiname); + sub(/@OS@/, os, abiname); + } + next; +} + # Obey the first matching DEFAULT line. $2 == "DEFAULT" { $1 = $2 = ""; @@ -66,6 +76,9 @@ END { } } } + if (abiname) { + print "ABI", abiname + } for (c in lines) { print lines[c] } diff --git a/shlib-versions b/shlib-versions index 9a10fc0566..65e772bbb5 100644 --- a/shlib-versions +++ b/shlib-versions @@ -43,6 +43,11 @@ powerpc.*-.*-.* WORDSIZE64 powerpc64-@VENDOR@-@OS@ sparc64.*-.*-.* WORDSIZE32 sparc-@VENDOR@-@OS@ sparc.*-.*-.* WORDSIZE64 sparc64-@VENDOR@-@OS@ +# Configuration ABI Identifier for ABI data files +# ------------- ---------- ----------------------------- +sparc64.*-.*-.* ABI sparc64-@OS@ +sparc.*-.*-.* ABI sparc-@OS@ + # Configuration Library=version Earliest symbol set (optional) # ------------- --------------- ------------------------------ diff --git a/stdio-common/Makefile b/stdio-common/Makefile index f9fc9da306..f8ae6f25d9 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -57,7 +57,8 @@ tests := tstscanf test_rdwr test-popen tstgetln test-fseek \ tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 bug15 \ tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \ tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \ - bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 + bug19 bug19a tst-popen2 scanf13 scanf14 scanf15 bug20 bug21 bug22 \ + scanf16 scanf17 test-srcs = tst-unbputc tst-printf @@ -109,11 +110,13 @@ CFLAGS-isoc99_scanf.c += $(exceptions) CFLAGS-errlist.c = $(fno-unit-at-a-time) CFLAGS-siglist.c = $(fno-unit-at-a-time) -# The following is a hack since we must compile scanf15.c without any +# The following is a hack since we must compile scanf1{5,7}.c without any # GNU extension. The latter are needed, though, when internal headers # are used. So made sure we see the installed headers first. CFLAGS-scanf15.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \ -I../wctype +CFLAGS-scanf17.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \ + -I../wctype # We know the test has a format string problem. CFLAGS-tst-sprintf.c = -Wno-format diff --git a/stdio-common/scanf14.c b/stdio-common/scanf14.c index 387ceba4bb..6ca5c7c567 100644 --- a/stdio-common/scanf14.c +++ b/stdio-common/scanf14.c @@ -59,5 +59,58 @@ main (void) else if (d != 5.25 || memcmp (c, " x", 2) != 0) FAIL (); + const char *tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL || tmpdir[0] == '\0') + tmpdir = "/tmp"; + + char fname[strlen (tmpdir) + sizeof "/tst-scanf14.XXXXXX"]; + sprintf (fname, "%s/tst-scanf14.XXXXXX", tmpdir); + if (fname == NULL) + FAIL (); + + /* Create a temporary file. */ + int fd = mkstemp (fname); + if (fd == -1) + FAIL (); + + FILE *fp = fdopen (fd, "w+"); + if (fp == NULL) + FAIL (); + else + { + if (fputs (" 1.25s x", fp) == EOF) + FAIL (); + if (fseek (fp, 0, SEEK_SET) != 0) + FAIL (); + if (fscanf (fp, "%as%2c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0) + FAIL (); + memset (sp, 'x', sizeof "1.25s"); + free (sp); + } + + if (freopen (fname, "r", stdin) == NULL) + FAIL (); + else + { + if (scanf ("%as%2c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0) + FAIL (); + memset (sp, 'x', sizeof "1.25s"); + free (sp); + } + } + + fclose (fp); + } + + remove (fname); + return result; } diff --git a/stdio-common/scanf15.c b/stdio-common/scanf15.c index cc8aa2e6a6..c56715c486 100644 --- a/stdio-common/scanf15.c +++ b/stdio-common/scanf15.c @@ -50,5 +50,48 @@ main (void) else if (d != 5.25 || memcmp (c, " x", 2) != 0) FAIL (); + const char *tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL || tmpdir[0] == '\0') + tmpdir = "/tmp"; + + char fname[strlen (tmpdir) + sizeof "/tst-scanf15.XXXXXX"]; + sprintf (fname, "%s/tst-scanf15.XXXXXX", tmpdir); + if (fname == NULL) + FAIL (); + + /* Create a temporary file. */ + int fd = mkstemp (fname); + if (fd == -1) + FAIL (); + + FILE *fp = fdopen (fd, "w+"); + if (fp == NULL) + FAIL (); + else + { + if (fputs (" 1.25s x", fp) == EOF) + FAIL (); + if (fseek (fp, 0, SEEK_SET) != 0) + FAIL (); + if (fscanf (fp, "%as%2c", &f, c) != 2) + FAIL (); + else if (f != 1.25 || memcmp (c, " x", 2) != 0) + FAIL (); + + if (freopen (fname, "r", stdin) == NULL) + FAIL (); + else + { + if (scanf ("%as%2c", &f, c) != 2) + FAIL (); + else if (f != 1.25 || memcmp (c, " x", 2) != 0) + FAIL (); + } + + fclose (fp); + } + + remove (fname); + return result; } diff --git a/stdio-common/scanf16.c b/stdio-common/scanf16.c new file mode 100644 index 0000000000..3e3cb417f2 --- /dev/null +++ b/stdio-common/scanf16.c @@ -0,0 +1,147 @@ +#include +#include +#include +#include +#include + +#define FAIL() \ + do { \ + result = 1; \ + printf ("test at line %d failed\n", __LINE__); \ + } while (0) + +static int +xsscanf (const char *str, const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vsscanf (str, fmt, ap); + va_end (ap); + return ret; +} + +static int +xscanf (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vscanf (fmt, ap); + va_end (ap); + return ret; +} + +static int +xfscanf (FILE *f, const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vfscanf (f, fmt, ap); + va_end (ap); + return ret; +} + +int +main (void) +{ + wchar_t *lsp; + char *sp; + float f; + double d; + char c[8]; + int result = 0; + + if (xsscanf (" 0.25s x", "%e%3c", &f, c) != 2) + FAIL (); + else if (f != 0.25 || memcmp (c, "s x", 3) != 0) + FAIL (); + if (xsscanf (" 1.25s x", "%as%2c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0) + FAIL (); + memset (sp, 'x', sizeof "1.25s"); + free (sp); + } + if (xsscanf (" 2.25s x", "%las%2c", &d, c) != 2) + FAIL (); + else if (d != 2.25 || memcmp (c, " x", 2) != 0) + FAIL (); + if (xsscanf (" 3.25S x", "%4aS%3c", &lsp, c) != 2) + FAIL (); + else + { + if (wcscmp (lsp, L"3.25") != 0 || memcmp (c, "S x", 3) != 0) + FAIL (); + memset (lsp, 'x', sizeof L"3.25"); + free (lsp); + } + if (xsscanf ("4.25[0-9.] x", "%a[0-9.]%8c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "4.25") != 0 || memcmp (c, "[0-9.] x", 8) != 0) + FAIL (); + memset (sp, 'x', sizeof "4.25"); + free (sp); + } + if (xsscanf ("5.25[0-9.] x", "%la[0-9.]%2c", &d, c) != 2) + FAIL (); + else if (d != 5.25 || memcmp (c, " x", 2) != 0) + FAIL (); + + const char *tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL || tmpdir[0] == '\0') + tmpdir = "/tmp"; + + char fname[strlen (tmpdir) + sizeof "/tst-scanf16.XXXXXX"]; + sprintf (fname, "%s/tst-scanf16.XXXXXX", tmpdir); + if (fname == NULL) + FAIL (); + + /* Create a temporary file. */ + int fd = mkstemp (fname); + if (fd == -1) + FAIL (); + + FILE *fp = fdopen (fd, "w+"); + if (fp == NULL) + FAIL (); + else + { + if (fputs (" 1.25s x", fp) == EOF) + FAIL (); + if (fseek (fp, 0, SEEK_SET) != 0) + FAIL (); + if (xfscanf (fp, "%as%2c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0) + FAIL (); + memset (sp, 'x', sizeof "1.25s"); + free (sp); + } + + if (freopen (fname, "r", stdin) == NULL) + FAIL (); + else + { + if (xscanf ("%as%2c", &sp, c) != 2) + FAIL (); + else + { + if (strcmp (sp, "1.25s") != 0 || memcmp (c, " x", 2) != 0) + FAIL (); + memset (sp, 'x', sizeof "1.25s"); + free (sp); + } + } + + fclose (fp); + } + + remove (fname); + + return result; +} diff --git a/stdio-common/scanf17.c b/stdio-common/scanf17.c new file mode 100644 index 0000000000..ee9024f9b7 --- /dev/null +++ b/stdio-common/scanf17.c @@ -0,0 +1,128 @@ +#undef _GNU_SOURCE +#define _XOPEN_SOURCE 600 +/* The following macro definitions are a hack. They word around disabling + the GNU extension while still using a few internal headers. */ +#define u_char unsigned char +#define u_short unsigned short +#define u_int unsigned int +#define u_long unsigned long +#include +#include +#include +#include +#include + +#define FAIL() \ + do { \ + result = 1; \ + printf ("test at line %d failed\n", __LINE__); \ + } while (0) + +static int +xsscanf (const char *str, const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vsscanf (str, fmt, ap); + va_end (ap); + return ret; +} + +static int +xscanf (const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vscanf (fmt, ap); + va_end (ap); + return ret; +} + +static int +xfscanf (FILE *f, const char *fmt, ...) +{ + va_list ap; + va_start (ap, fmt); + int ret = vfscanf (f, fmt, ap); + va_end (ap); + return ret; +} + +int +main (void) +{ + float f; + double d; + char c[8]; + int result = 0; + + if (xsscanf (" 0.25s x", "%e%3c", &f, c) != 2) + FAIL (); + else if (f != 0.25 || memcmp (c, "s x", 3) != 0) + FAIL (); + if (xsscanf (" 1.25s x", "%as%2c", &f, c) != 2) + FAIL (); + else if (f != 1.25 || memcmp (c, " x", 2) != 0) + FAIL (); + if (xsscanf (" 2.25s x", "%las%2c", &d, c) != 2) + FAIL (); + else if (d != 2.25 || memcmp (c, " x", 2) != 0) + FAIL (); + if (xsscanf (" 3.25S x", "%4aS%2c", &f, c) != 2) + FAIL (); + else if (f != 3.25 || memcmp (c, " x", 2) != 0) + FAIL (); + if (xsscanf (" 4.25[0-9.] x", "%a[0-9.]%2c", &f, c) != 2) + FAIL (); + else if (f != 4.25 || memcmp (c, " x", 2) != 0) + FAIL (); + if (xsscanf (" 5.25[0-9.] x", "%la[0-9.]%2c", &d, c) != 2) + FAIL (); + else if (d != 5.25 || memcmp (c, " x", 2) != 0) + FAIL (); + + const char *tmpdir = getenv ("TMPDIR"); + if (tmpdir == NULL || tmpdir[0] == '\0') + tmpdir = "/tmp"; + + char fname[strlen (tmpdir) + sizeof "/tst-scanf17.XXXXXX"]; + sprintf (fname, "%s/tst-scanf17.XXXXXX", tmpdir); + if (fname == NULL) + FAIL (); + + /* Create a temporary file. */ + int fd = mkstemp (fname); + if (fd == -1) + FAIL (); + + FILE *fp = fdopen (fd, "w+"); + if (fp == NULL) + FAIL (); + else + { + if (fputs (" 1.25s x", fp) == EOF) + FAIL (); + if (fseek (fp, 0, SEEK_SET) != 0) + FAIL (); + if (xfscanf (fp, "%as%2c", &f, c) != 2) + FAIL (); + else if (f != 1.25 || memcmp (c, " x", 2) != 0) + FAIL (); + + if (freopen (fname, "r", stdin) == NULL) + FAIL (); + else + { + if (xscanf ("%as%2c", &f, c) != 2) + FAIL (); + else if (f != 1.25 || memcmp (c, " x", 2) != 0) + FAIL (); + } + + fclose (fp); + } + + remove (fname); + + return result; +} diff --git a/string/endian.h b/string/endian.h index 430fb3a5c4..37d030a252 100644 --- a/string/endian.h +++ b/string/endian.h @@ -56,39 +56,41 @@ #endif +#ifdef __USE_BSD /* Conversion interfaces. */ -#include - -#if __BYTE_ORDER == __LITTLE_ENDIAN -# define htobe16(x) __bswap_16 (x) -# define htole16(x) (x) -# define be16toh(x) __bswap_16 (x) -# define le16toh(x) (x) - -# define htobe32(x) __bswap_32 (x) -# define htole32(x) (x) -# define be32toh(x) __bswap_32 (x) -# define le32toh(x) (x) - -# define htobe64(x) __bswap_64 (x) -# define htole64(x) (x) -# define be64toh(x) __bswap_64 (x) -# define le64toh(x) (x) -#else -# define htobe16(x) (x) -# define htole16(x) __bswap_16 (x) -# define be16toh(x) (x) -# define le16toh(x) __bswap_16 (x) - -# define htobe32(x) (x) -# define htole32(x) __bswap_32 (x) -# define be32toh(x) (x) -# define le32toh(x) __bswap_32 (x) - -# define htobe64(x) (x) -# define htole64(x) __bswap_64 (x) -# define be64toh(x) (x) -# define le64toh(x) __bswap_64 (x) +# include + +# if __BYTE_ORDER == __LITTLE_ENDIAN +# define htobe16(x) __bswap_16 (x) +# define htole16(x) (x) +# define be16toh(x) __bswap_16 (x) +# define le16toh(x) (x) + +# define htobe32(x) __bswap_32 (x) +# define htole32(x) (x) +# define be32toh(x) __bswap_32 (x) +# define le32toh(x) (x) + +# define htobe64(x) __bswap_64 (x) +# define htole64(x) (x) +# define be64toh(x) __bswap_64 (x) +# define le64toh(x) (x) +# else +# define htobe16(x) (x) +# define htole16(x) __bswap_16 (x) +# define be16toh(x) (x) +# define le16toh(x) __bswap_16 (x) + +# define htobe32(x) (x) +# define htole32(x) __bswap_32 (x) +# define be32toh(x) (x) +# define le32toh(x) __bswap_32 (x) + +# define htobe64(x) (x) +# define htole64(x) __bswap_64 (x) +# define be64toh(x) (x) +# define le64toh(x) __bswap_64 (x) +# endif #endif #endif /* endian.h */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S b/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S index 33e40ac65a..a38cd30c02 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/setcontext.S @@ -111,7 +111,7 @@ ENTRY(__start_context) mov %g1, %o0 /* If this returns (which can happen if the syscall fails) we'll exit the program with the return error value (-1). */ -1: call exit +1: call HIDDEN_JUMPTARGET(exit) nop /* The 'exit' call should never return. In case it does cause the process to terminate. */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h index c808a97fc5..3cb0a48c95 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/sysdep.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1997, 2002, 2003, 2004, 2006 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2002, 2003, 2004, 2006, 2008 + Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Miguel de Icaza , January 1997. @@ -89,6 +90,13 @@ ENTRY(name); \ #else /* __ASSEMBLER__ */ +#if defined SHARED && defined DO_VERSIONING && defined PIC \ + && !defined NO_HIDDEN && !defined NOT_IN_libc +# define CALL_ERRNO_LOCATION "call __GI___errno_location;" +#else +# define CALL_ERRNO_LOCATION "call __errno_location;" +#endif + #define __SYSCALL_STRING \ "ta 0x10;" \ "bcs 2f;" \ @@ -97,7 +105,7 @@ ENTRY(name); \ ".subsection 2;" \ "2:" \ "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ + CALL_ERRNO_LOCATION \ " nop;" \ "st %%i0,[%%o0];" \ "ba 1b;" \ @@ -113,7 +121,7 @@ ENTRY(name); \ ".subsection 2;" \ "2:" \ "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ + CALL_ERRNO_LOCATION \ " nop;" \ "st %%i0, [%%o0];" \ "ba 1b;" \ @@ -126,7 +134,7 @@ ENTRY(name); \ " sub %%g0, %%o0, %%o0;" \ "1:" -#define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \ +#define __SYSCALL_CLOBBERS \ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S index 134ce789f7..ccc5589927 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/brk.S @@ -1,4 +1,4 @@ -/* Copyright (C) 1997 Free Software Foundation, Inc. +/* Copyright (C) 1997, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson , 1997. @@ -85,8 +85,12 @@ ENTRY (__brk) ldx [%l7+%g1], %g1 #endif st %o0, [%g1] +#else +#ifndef NOT_IN_libc + call HIDDEN_JUMPTARGET(__errno_location) #else call __errno_location +#endif mov %o0,%l1 st %l1, [%o0] #endif diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h index f156f9241a..79fa13de75 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/sysdep.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006 +/* Copyright (C) 1997, 2000, 2002, 2003, 2004, 2006, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Richard Henderson , 1997. @@ -106,12 +106,19 @@ ENTRY(name); \ #else /* __ASSEMBLER__ */ +#if defined SHARED && defined DO_VERSIONING && defined PIC \ + && !defined NO_HIDDEN && !defined NOT_IN_libc +# define CALL_ERRNO_LOCATION "call __GI___errno_location;" +#else +# define CALL_ERRNO_LOCATION "call __errno_location;" +#endif + #define __SYSCALL_STRING \ "ta 0x6d;" \ "bcc,pt %%xcc, 1f;" \ " nop;" \ "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ + CALL_ERRNO_LOCATION \ " nop;" \ "st %%i0,[%%o0];" \ "restore %%g0, -1, %%o0;" \ @@ -122,7 +129,7 @@ ENTRY(name); \ "bcc,pt %%xcc, 1f;" \ " sub %%o1, 1, %%o1;" \ "save %%sp, -192, %%sp;" \ - "call __errno_location;" \ + CALL_ERRNO_LOCATION \ " mov -1, %%i1;" \ "st %%i0,[%%o0];" \ "restore %%g0, -1, %%o0;" \ @@ -135,7 +142,7 @@ ENTRY(name); \ " sub %%g0, %%o0, %%o0;" \ "1:" -#define __SYSCALL_CLOBBERS "g2", "g3", "g4", "g5", "g6", \ +#define __SYSCALL_CLOBBERS \ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", \ "f8", "f9", "f10", "f11", "f12", "f13", "f14", "f15", \ "f16", "f17", "f18", "f19", "f20", "f21", "f22", "f23", \ -- cgit v1.2.3