Commit Graph

641 Commits

Author SHA1 Message Date
Leonhard Holz f13c2a8dff Improve strcoll with strdiff.
This patch improves strcoll hot case by finding first byte that
mismatches. That is in likely case enough to determine comparison
result.
2015-05-12 11:37:52 +02:00
Stefan Liebler 920a0395ba Use correct signedness in wcsncmp
[BZ #18206]
	* wcsmbs/wcsncmp.c (wcsncmp): Compare as wchar_t, not wint_t.
	  Use signed comparision instead of substraction to avoid
	  overflow bug.
	* localedata/tests-mbwc/tst_wcsncmp.c (tst_wcsncmp):
	  Take the sign of ret.
	* localedata/tests-mbwc/dat_wcsncmp.c (tst_wcsncmp_loc):
	  Do not expect precise return values. Only the sign matters.
	* wcsmbs/Makefile (strop-tests): Add wcsncmp.
	* wcsmbs/test-wcsncmp.c: New File.
	* string/test-strncmp.c: Add wcsncmp support.
2015-04-13 21:25:04 +02:00
Andreas Schwab 8e2e833ac4 Don't define __CORRECT_ISO_CPP_STRING_H_PROTO for non-GCC compilers (bug 17631)
The implementation of __CORRECT_ISO_CPP_STRING_H_PROTO requires
support for asm aliases.
2015-03-04 11:52:55 +01:00
Wilco Dijkstra af96be3482 Rather than using a C implementation of memmove, directly call memmove, which
typically has a much faster optimized implementation.
2015-02-27 14:44:41 +00:00
Wilco Dijkstra ddcf6798d3 Rather than using a C implementation of memset, directly call memset, which
typically has a much faster optimized implementation.
2015-02-27 14:41:46 +00:00
Leonhard Holz d35273f274 Remove unused definitions 2015-02-11 12:50:53 +01:00
Leonhard Holz 0f9e585480 Fix memory handling in strxfrm_l [BZ #16009]
[Modified from the original email by Siddhesh Poyarekar]

This patch solves bug #16009 by implementing an additional path in
strxfrm that does not depend on caching the weight and rule indices.

In detail the following changed:

* The old main loop was factored out of strxfrm_l into the function
do_xfrm_cached to be able to alternativly use the non-caching version
do_xfrm.

* strxfrm_l allocates a a fixed size array on the stack. If this is not
sufficiant to store the weight and rule indices, the non-caching path is
taken. As the cache size is not dependent on the input there can be no
problems with integer overflows or stack allocations greater than
__MAX_ALLOCA_CUTOFF. Note that malloc-ing is not possible because the
definition of strxfrm does not allow an oom errorhandling.

* The uncached path determines the weight and rule index for every char
and for every pass again.

* Passing all the locale data array by array resulted in very long
parameter lists, so I introduced a structure that holds them.

* Checking for zero src string has been moved a bit upwards, it is
before the locale data initialization now.

* To verify that the non-caching path works correct I added a test run
to localedata/sort-test.sh & localedata/xfrm-test.c where all strings
are patched up with spaces so that they are too large for the caching path.
2015-01-13 11:33:56 +05:30
Ondřej Bílka 500bfbd492 Revert "Suppress warning in string/tester.c for gcc 4.9"
This reverts commit 9300797ee9.
2015-01-06 18:43:28 +01:00
Ondřej Bílka 9300797ee9 Suppress warning in string/tester.c for gcc 4.9 2015-01-06 17:43:09 +01:00
Joseph Myers b168057aaa Update copyright dates with scripts/update-copyrights. 2015-01-02 16:29:47 +00:00
Richard Earnshaw f559d8cf29 * string/stpcpy.c (__stpcpy): Rewrite using strlen and memcpy. 2014-12-23 08:58:18 -08:00
Ondřej Bílka 3eb38795db Simplify strncat.
We rewrite strncat to use strnlen and malloc calls which simplifies code
an is faster as these functions are better optimized than original code.
2014-12-19 23:09:40 +01:00
Torvald Riegel 4f646bce1c Ignore warning in string/tester.c. 2014-12-16 10:32:07 +01:00
Siddhesh Poyarekar 1721f0a406 Don't use __warn_memset_zero_len for gcc-5.0 or newer
gcc now warns when the arguments to memset may have been accidentally
transposed (i.e. length set to zero instead of the byte), so we don't
need that bit of the code in glibc headers anymore.

Tested on x86_64.  Coe generated by gcc 4.8 is identical with or
without the patch.  I also tested gcc master, which does not result in
any new failures.  It does fail quite a few FORTIFY_SOURCE tests, but
those failures are not due to this patch.
2014-11-27 11:15:45 +05:30
Joseph Myers bd5dadac87 Remove TEST_IFUNC, tests-ifunc and *-ifunc.c tests.
TEST_IFUNC is only tested in two headers, bench-string.h and
test-string.h, after it gets defined by those headers, and it never
gets undefined.

Thus no defines of TEST_IFUNC are needed, and the *-ifunc.c tests that
just define TEST_IFUNC and include other tests are also redundant, as
is the code to remove $(tests-ifunc) and $(xtests-ifunc) conditionally
from tests and xtests.  This patch removes the useless defines and
tests of TEST_IFUNC and the associated useless tests and makefile
code.  It thereby fixes a series of warnings
"../string/test-string.h:21:0: warning: "TEST_IFUNC" redefined" where
test-string.h defines TEST_IFUNC to empty, other files define it to 1
and this produces warnings.

Tested for x86_64.

	* debug/test-stpcpy_chk-ifunc.c: Remove file.
	* debug/test-strcpy_chk-ifunc.c: Likewise.
	* wcsmbs/test-wcschr-ifunc.c: Likewise.
	* wcsmbs/test-wcscmp-ifunc.c: Likewise.
	* wcsmbs/test-wcscpy-ifunc.c: Likewise.
	* wcsmbs/test-wcslen-ifunc.c: Likewise.
	* wcsmbs/test-wcsrchr-ifunc.c: Likewise.
	* wcsmbs/test-wmemcmp-ifunc.c: Likewise.
	* Rules [$(multi-arch) = no] (tests): Do not filter out
	$(tests-ifunc).
	[$(multi-arch) = no] (xtests): Do not filter out $(xtests-ifunc).
	* debug/Makefile (tests-ifunc): Remove variable.
	(tests): Do not add $(tests-ifunc).
	* wcsmbs/Makefile (tests-ifunc): Remove variable.
	(tests): Do not add $(tests-ifunc).
	* benchtests/bench-string.h (TEST_IFUNC): Remove macro.
	[TEST_IFUNC]: Remove conditionals.
	* string/test-string.h (TEST_IFUNC): Remove macro.
	[TEST_IFUNC]: Remove conditionals.
2014-11-26 12:53:36 +00:00
Joseph Myers 3b20fd5c0d Fix test-strchr.c warnings for wide string testing.
string/test-strchr.c is used for both wide and narrow string testing,
but produces a series of warnings for wide string testing because of
hardcoded use of narrow characters in the function check1.  This patch
fixes that function to use macros abstracting away the wide / narrow
string choice, adding a new such macro to handle the string and
character constants.

Tested for x86_64.

	* string/test-strchr.c [!WIDE] (L): New macro.
	[WIDE] (L): Likewise.
	(check1): Use CHAR instead of char.  Use L on string and character
	constants.
2014-11-26 12:52:08 +00:00
Wilco Dijkstra 6933c27e9c Fix typo. 2014-11-24 20:39:38 +00:00
Wilco Dijkstra 6423d4754c Improve performance of strncpy. 2014-11-24 15:15:10 +00:00
Wilco Dijkstra b863d2bc4d Improve strcpy performance. 2014-11-24 15:09:07 +00:00
Leonhard Holz 5d178c37a0 Speed up strcoll by inlining
This patch improves the performance of strcoll_l by inlining the two
helper functions get_next_seq and do_compare.

measurement     old             new             diff
glibc files     202,393,000     138,597,000     -31.52%
vi_VN.UTF-8     2,772,150       2,055,920       -25.84%
en_US.UTF-8     2,741,380       1,952,770       -28.77%
ar_SA.UTF-8     3,062,180       2,484,940       -18.85%
zh_CN.UTF-8     917,198         875,756         -4.52%
cs_CZ.UTF-8     3,455,670       2,465,530       -28.65%
en_GB.UTF-8     3,334,790       2,420,540       -27.42%
da_DK.UTF-8     2,805,660       2,023,430       -27.88%
pl_PL.UTF-8     2,640,710       2,014,960       -23.70%
fr_FR.UTF-8     3,504,700       2,642,280       -24.61%
pt_PT.UTF-8     3,542,390       2,599,250       -26.62%
el_GR.UTF-8     4,529,580       3,881,700       -14.30%
ru_RU.UTF-8     3,527,070       2,806,480       -20.43%
iw_IL.UTF-8     3,047,060       2,530,360       -16.96%
es_ES.UTF-8     3,089,990       2,376,410       -23.09%
hi_IN.UTF-8     222,487,000     223,397,000     0.41%
sv_SE.UTF-8     2,724,630       2,019,420       -25.88%
hu_HU.UTF-8     4,446,990       3,658,830       -17.72%
tr_TR.UTF-8     2,966,180       2,200,790       -25.80%
is_IS.UTF-8     2,559,480       2,012,190       -21.38%
it_IT.UTF-8     3,301,190       2,527,230       -23.44%
sr_RS.UTF-8     2,973,150       2,322,010       -21.90%
ja_JP.UTF-8     985,042         1,044,980       6.08%
2014-11-24 17:18:51 +05:30
Joseph Myers c1b0aadcdf Fix build of C mempcpy and stpcpy.
This patch fixes the build of C mempcpy and stpcpy by disabling the
redirection to __mempcpy and __stpcpy asm names if
NO_MEMPCPY_STPCPY_REDIRECT is defined, and defining that macro in the
relevant source files.

Tested for powerpc32 that the build is fixed.

	* include/string.h [NO_MEMPCPY_STPCPY_REDIRECT] (mempcpy): Do not
	redeclare with asm name.
	[NO_MEMPCPY_STPCPY_REDIRECT] (stpcpy): Likewise.
	* string/mempcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Define before
	including <string.h>.
	* string/stpcpy.c (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc32/power4/multiarch/mempcpy.c
	[!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/mempcpy.c
	[!NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
	* sysdeps/powerpc/powerpc64/multiarch/stpcpy.c
	[SHARED && !NOT_IN_libc] (NO_MEMPCPY_STPCPY_REDIRECT): Likewise.
2014-11-14 13:48:39 +00:00
Joseph Myers 9975e3d37d Fix locale memmem namespace (bug 17585).
Locale code, brought in by ISO C functions, calls memmem, which is not
an ISO C function.  This isn't an ISO C conformance bug, because all
mem* names are reserved, but glibc practice is not to rely on that
reservation (thus, memmem is only declared in string.h if __USE_GNU
even though ISO C would allow it to be declared unconditionally, for
example).  This patch changes that code to use __memmem.

Note: there are uses of memmem elsewhere in glibc that I didn't
change, although it may turn out some of those also need to use
__memmem.

Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).

	[BZ #17585]
	* string/memmem.c [!_LIBC] (__memmem): Define to memmem.
	(memmem): Rename to __memmem and define as weak alias of
	__memmem.  Use libc_hidden_weak.
	(__memmem): Use libc_hidden_def.
	* include/string.h (__memmem): Declare.  Use libc_hidden_proto.
	* locale/findlocale.c (valid_locale_name): Use __memmem instead of
	memmem.
2014-11-12 22:41:03 +00:00
Leonhard Holz fffa1cf8a7 Fix tst-strcoll-overflow returning before timeout (BZ #17506)
Modifies the test examination in test-skeleton.c so that a test can be
successful if it is interrupted or it returns uninterrupted with the
expected status. For this both EXPECTED_SIGNAL and EXPECTED_STATUS
have to be set, as is done in tst-strcoll-overflow.c.
2014-11-12 17:10:21 +05:30
Arjun Shankar 29955b5d96 Modify several tests to use test-skeleton.c
This patch modifies several test cases to use test-skeleton.c.
It was generated by a bash script written for this purpose and
thus excludes several other tests which I deemed worth a visual
inspection before making the change.

I intend to follow up with individual patches to the tests
skipped by the script.

The script itself resides at http://git.io/WODAmg and should
reproduce this very patch when run against master.

ChangeLog:

2014-10-30  Arjun Shankar  <arjun.is@lostca.se>

	* catgets/test-gencat.c: Use test-skeleton.c.
	* catgets/tst-catgets.c: Likewise.
	* csu/tst-empty.c: Likewise.
	* elf/tst-audit2.c: Likewise.
	* elf/tst-global1.c: Likewise.
	* elf/tst-pathopt.c: Likewise.
	* elf/tst-piemod1.c: Likewise.
	* elf/tst-tls10.c: Likewise.
	* elf/tst-tls11.c: Likewise.
	* elf/tst-tls12.c: Likewise.
	* gnulib/tst-gcc.c: Likewise.
	* iconvdata/tst-e2big.c: Likewise.
	* iconvdata/tst-loading.c: Likewise.
	* iconv/tst-iconv1.c: Likewise.
	* iconv/tst-iconv2.c: Likewise.
	* inet/test-inet6_opt.c: Likewise.
	* inet/tst-gethnm.c: Likewise.
	* inet/tst-network.c: Likewise.
	* inet/tst-ntoa.c: Likewise.
	* intl/tst-codeset.c: Likewise.
	* intl/tst-gettext2.c: Likewise.
	* intl/tst-gettext3.c: Likewise.
	* intl/tst-ngettext.c: Likewise.
	* intl/tst-translit.c: Likewise.
	* io/test-stat.c: Likewise.
	* libio/test-fmemopen.c: Likewise.
	* libio/tst-freopen.c: Likewise.
	* libio/tst-sscanf.c: Likewise.
	* libio/tst-ungetwc1.c: Likewise.
	* libio/tst-ungetwc2.c: Likewise.
	* libio/tst-widetext.c: Likewise.
	* localedata/tst-ctype.c: Likewise.
	* localedata/tst-digits.c: Likewise.
	* localedata/tst-leaks.c: Likewise.
	* localedata/tst-mbswcs1.c: Likewise.
	* localedata/tst-mbswcs2.c: Likewise.
	* localedata/tst-mbswcs3.c: Likewise.
	* localedata/tst-mbswcs4.c: Likewise.
	* localedata/tst-mbswcs5.c: Likewise.
	* localedata/tst-setlocale.c: Likewise.
	* localedata/tst-trans.c: Likewise.
	* localedata/tst-wctype.c: Likewise.
	* localedata/tst-xlocale1.c: Likewise.
	* login/tst-grantpt.c: Likewise.
	* malloc/tst-calloc.c: Likewise.
	* malloc/tst-malloc.c: Likewise.
	* malloc/tst-mallocstate.c: Likewise.
	* malloc/tst-mcheck.c: Likewise.
	* malloc/tst-mtrace.c: Likewise.
	* malloc/tst-obstack.c: Likewise.
	* math/atest-exp2.c: Likewise.
	* math/atest-exp.c: Likewise.
	* math/atest-sincos.c: Likewise.
	* math/test-matherr.c: Likewise.
	* math/test-misc.c: Likewise.
	* math/test-powl.c: Likewise.
	* math/tst-definitions.c: Likewise.
	* misc/tst-dirname.c: Likewise.
	* misc/tst-efgcvt.c: Likewise.
	* misc/tst-fdset.c: Likewise.
	* misc/tst-hsearch.c: Likewise.
	* misc/tst-mntent2.c: Likewise.
	* nptl/tst-sem7.c: Likewise.
	* nptl/tst-sem8.c: Likewise.
	* nptl/tst-sem9.c: Likewise.
	* nss/test-netdb.c: Likewise.
	* posix/tst-fnmatch.c: Likewise.
	* posix/tst-getlogin.c: Likewise.
	* posix/tst-gnuglob.c: Likewise.
	* posix/tst-mmap.c: Likewise.
	* pwd/tst-getpw.c: Likewise.
	* resolv/tst-inet_ntop.c: Likewise.
	* rt/tst-timer.c: Likewise.
	* stdio-common/test-fseek.c: Likewise.
	* stdio-common/test-popen.c: Likewise.
	* stdio-common/test-vfprintf.c: Likewise.
	* stdio-common/tst-cookie.c: Likewise.
	* stdio-common/tst-fileno.c: Likewise.
	* stdio-common/tst-gets.c: Likewise.
	* stdio-common/tst-obprintf.c: Likewise.
	* stdio-common/tst-perror.c: Likewise.
	* stdio-common/tst-sprintf2.c: Likewise.
	* stdio-common/tst-sprintf3.c: Likewise.
	* stdio-common/tst-sprintf.c: Likewise.
	* stdio-common/tst-swprintf.c: Likewise.
	* stdio-common/tst-tmpnam.c: Likewise.
	* stdio-common/tst-unbputc.c: Likewise.
	* stdio-common/tst-wc-printf.c: Likewise.
	* stdlib/tst-environ.c: Likewise.
	* stdlib/tst-fmtmsg.c: Likewise.
	* stdlib/tst-limits.c: Likewise.
	* stdlib/tst-rand48-2.c: Likewise.
	* stdlib/tst-rand48.c: Likewise.
	* stdlib/tst-random2.c: Likewise.
	* stdlib/tst-random.c: Likewise.
	* stdlib/tst-strtol.c: Likewise.
	* stdlib/tst-strtoll.c: Likewise.
	* stdlib/tst-tls-atexit.c: Likewise.
	* stdlib/tst-xpg-basename.c: Likewise.
	* string/test-ffs.c: Likewise.
	* string/tst-bswap.c: Likewise.
	* string/tst-inlcall.c: Likewise.
	* string/tst-strtok.c: Likewise.
	* string/tst-strxfrm.c: Likewise.
	* sysdeps/x86_64/tst-audit10.c: Likewise.
	* sysdeps/x86_64/tst-audit3.c: Likewise.
	* sysdeps/x86_64/tst-audit4.c: Likewise.
	* sysdeps/x86_64/tst-audit5.c: Likewise.
	* time/tst-ftime_l.c: Likewise.
	* time/tst-getdate.c: Likewise.
	* time/tst-mktime3.c: Likewise.
	* time/tst-mktime.c: Likewise.
	* time/tst-posixtz.c: Likewise.
	* time/tst-strptime2.c: Likewise.
	* time/tst-strptime3.c: Likewise.
	* wcsmbs/tst-btowc.c: Likewise.
	* wcsmbs/tst-mbrtowc.c: Likewise.
	* wcsmbs/tst-mbsrtowcs.c: Likewise.
	* wcsmbs/tst-wchar-h.c: Likewise.
	* wcsmbs/tst-wcpncpy.c: Likewise.
	* wcsmbs/tst-wcrtomb.c: Likewise.
	* wcsmbs/tst-wcsnlen.c: Likewise.
	* wcsmbs/tst-wcstof.c: Likewise.
2014-11-05 15:24:08 +05:30
Wilco Dijkstra e80514b5a8 This patch improves strncat performance by using strlen. Strlen has a fast C implementation, so
this
will improve performance even on targets which don't have an optimized strlen. It is about twice
as
fast as the original strncat in bench-strncat.
2014-10-24 16:12:12 +00:00
Wilco Dijkstra 6e46de42fe This patch improves strcat performance by using strlen and strcpy. Strlen has a fast C
implementation, so this improves performance even on targets which don't have an optimized
strlen and strcpy - it is 25% faster in bench-strcat. On targets which don't provide an
optimized strcat but which do have an optimized strlen and strcpy, performance gain is > 2x.
2014-10-24 16:08:42 +00:00
Siddhesh Poyarekar 33cc770b98 Fix up incorrect formatting in last commit 2014-10-17 15:52:46 +05:30
Leonhard Holz 0742aef6e5 strcoll: improve performance by removing the cache (#15884)
this is a path that should solve bug 15884. It complains about the performance
of strcoll(). It was found out that the runtime of strcoll() is actually bound
to strlen which is needed for calculating the size of a cache that was
installed to improve the comparison performance.

The idea for this patch was that the cache is only useful in rare cases
(strings of same length and same first-level-chars) and that it would be
better to avoid memory allocation at all. To prove this I wrote a performance
test bench-strcoll.c with test data in benchtests-strcoll.tar.gz. Also
modifications in benchtests/Makefile and localedata/Makefile are necessary to
make it work.

After removing the cache the strcoll method showed the predicted behavior
(getting slightly faster) in all but the test case for hindi word sorting.
This was due the hindi text having much more equal words than the other ones.
For equal strings the performance was worse since all comparison levels were
run through and from the second level on the cache improved the comparison
performance of the original version.

Therefore I added a bytewise test via strcmp iff the first level comparison
found that both strings did match because in this case it is very likely that
equal strings are compared. This solved the problem with the hindi test case
and improved the performance of the others.

Performance comparison:

glibc files     -33.77%
vi_VN.UTF-8     -34.12%
en_US.UTF-8     -42.42%
ar_SA.UTF-8     -27.49%
zh_CN.UTF-8     +07.90%
cs_CZ.UTF-8     -29.67%
en_GB.UTF-8     -28.50%
da_DK.UTF-8     -36.57%
pl_PL.UTF-8     -39.31%
fr_FR.UTF-8     -28.57%
pt_PT.UTF-8     -22.82%
el_GR.UTF-8     -26.77%
ru_RU.UTF-8     -35.81%
iw_IL.UTF-8     -35.34%
es_ES.UTF-8     -34.46%
hi_IN.UTF-8     -00.38%
sv_SE.UTF-8     -36.99%
hu_HU.UTF-8     -16.35%
tr_TR.UTF-8     -27.80%
is_IS.UTF-8     -33.24%
it_IT.UTF-8     -24.39%
sr_RS.UTF-8     -37.55%
ja_JP.UTF-8     +02.84%
2014-10-17 15:47:23 +05:30
Roland McGrath 8c0ab919f6 Move findidx nested functions to top-level. 2014-09-11 16:02:17 -07:00
Adhemerval Zanella 17762f6625 PowerPC: optimized memmove for POWER7/PPC64
This patch adds an optimized memmove optimization for POWER7/powerpc64.
Basically the idea is to use the memcpy for POWER7 on non-overlapped
memory regions and a optimized backward memcpy for memory regions
that overlap (similar to the idea of string/memmove.c).

The backward memcpy algorithm used is similar the one use for memcpy for
POWER7, with adjustments done for alignment.  The difference is memory
is always aligned to 16 bytes before using VSX/altivec instructions.
2014-07-07 15:41:21 -05:00
Will Newton 1570a72bb8 string/memchr.c: Merge from gnulib
Merge most of the gnulib implementation of memchr. The changes that
remain are:

 - copyright header
 - bp-sym.h removed
 - reg_char removed
 - allow MEMCHR to be redefined
 - non-conforming whitespace changes

The merged code fixes a number of -Wundef warnings and also introduces
an optimized algorithm. I haven't detected any performance difference
in the new code which I believe is down to the quite specific
circumstances required to hit it. However the new code is approximately
half the size of the old code on AArch64 (which uses generic memchr).

ChangeLog:

2014-07-04  Will Newton  <will.newton@linaro.org>

	* string/memchr.c: Merge from gnulib.
	[_LIBC]: Remove conditionals.
	(__ptr_t): Remove define.
	(LONG_MAX_32_BITS): Likewise.
	(LONG_MAX): Likewise.
	(MEMCHR): Use ANSI prototype and optimize algorithm.
2014-07-04 09:23:21 +01:00
Siddhesh Poyarekar 99f8dc9220 Fix -Wundef warning on PAGE_COPY_THRESHOLD
The PAGE_COPY_THRESHOLD macro is meant to be overridden by
architecture-specific pagecopy.h, but it is currently done only by
mach; all other architectures use the default.  Check to see if the
macro is defined in addition to whether it is set to a non-zero value.
2014-07-03 01:49:43 +05:30
Andreas Schwab 3d7c00e3a9 Update feature guard for strdup/strndup in <bits/string2.h> 2014-06-16 10:21:31 +02:00
Joseph Myers 686554bff6 Remove redundant C locale settings.
Various glibc build / install / test code has C locale settings that
are redundant with LC_ALL=C.

LC_ALL takes precedence over LANG, so anywhere that sets LC_ALL=C
(explicitly, or through it being in the default environment for
running tests) does not need to set LANG=C.  LC_ALL=C also takes
precedence over LANGUAGE, since

2001-01-02  Ulrich Drepper  <drepper@redhat.com>

	* intl/dcigettext.c (guess_category_value): Rewrite so that LANGUAGE
	value is ignored if the selected locale is the C locale.
	* intl/tst-gettext.c: Set locale for above change.
	* intl/tst-translit.c: Likewise.

and so settings of LANGUAGE=C are also redundant when LC_ALL=C is
set.  One test also had LC_ALL=C in its -ENV setting, although it's
part of the default environment used for tests.

This patch removes the redundant settings.  It removes a suggestion in
install.texi of setting LANGUAGE=C LC_ALL=C for "make install"; the
Makefile.in target "install" already sets LC_ALL_C so there's no need
for the user to set it (and nor should there be any need for the user
to set it).

If some build machine tool used by "make install" uses a version of
libintl predating that 2001 change, and the user has LANGUAGE set, the
removal of LANGUAGE=C from the Makefile.in "install" rule could in
principle affect the user's installation.  However, I don't think we
need to be concerned about pre-2001 build tools.

Tested x86_64.

	* Makefile (install): Don't set LANGUAGE.
	* Makefile.in (install): Likewise.
	* assert/Makefile (test-assert-ENV): Remove variable.
	(test-assert-perr-ENV): Likewise.
	* elf/Makefile (neededtest4-ENV): Likewise.
	* iconvdata/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Don't set LANGUAGE.
	* io/ftwtest-sh (LANG): Remove variable.
	* libio/Makefile (tst-widetext-ENV): Likewise.
	* manual/install.texi (Running make install): Don't refer to
	environment settings for make install.
	* INSTALL: Regenerated.
	* nptl/tst-tls6.sh: Don't set LANG.
	* posix/globtest.sh (LANG): Remove variable.
	* string/Makefile (tester-ENV): Likewise.
	(inl-tester-ENV): Likewise.
	(noinl-tester-ENV): Likewise.
	* sysdeps/s390/s390-64/Makefile ($(inst_gconvdir)/gconv-modules)
	[$(cross-compiling) = no]: Don't set LANGUAGE.
	* timezone/Makefile (build-testdata): Use $(built-program-cmd)
	without explicit environment settings.

localedata/ChangeLog:
	* tst-fmon.sh: Don't set LANGUAGE.
	* tst-locale.sh: Likewise.
2014-06-07 19:58:36 +00:00
Joseph Myers 2bf1804182 Include LOCPATH in default test environment.
Tests run using the default $(make-test-out) automatically get
GCONV_PATH and LC_ALL set, whether or not those environment variables
are actually needed for the individual test.  However, they do not get
LOCPATH set, meaning that a large number of tests have -ENV settings
just to set LOCPATH.

This patch moves LOCPATH into the default environment used for all
tests, on the principle that like GCONV_PATH any settings needed to
use files associated with the newly built library, rather than any old
installed files, are appropriate to use by default.

A further motivation is that various tests using .sh files also set
some combination of LC_ALL, GCONV_PATH and LOCPATH.  Preferably .sh
files should also use the default environment with any additions
required for the individual test.  Now, it was suggested in
<https://sourceware.org/ml/libc-alpha/2014-05/msg00715.html> that
various Makefile variables used in testing should be derived by
composing the -before-env and -after-env variables used when explicit
environment settings are required.  With such a change, it's also
natural for those variables to include the default settings (via some
intermediate makefile variable also used in make-test-out).

Because some .sh files only set variables that correspond to the
default settings, or a subset thereof, and this applies to more of the
.sh files once LOCPATH is in the default settings, doing so reduces
the size of a revised version of
<https://sourceware.org/ml/libc-alpha/2014-05/msg00596.html>: scripts
only needing the (expanded) default settings will not need to receive
the separate -before-env and -after-env variables, only the single
variable they do at present.  So moving LOCPATH into the default
settings can reduce churn caused by subsequent patches.

Tested x86_64 and x86.

	* Rules (make-test-out): Include
	LOCPATH=$(common-objpfx)localedata in default environment.
	* debug/Makefile (tst-chk1-ENV): Remove variable.
	(tst-chk2-ENV): Likewise.
	(tst-chk3-ENV): Likewise.
	(tst-chk4-ENV): Likewise.
	(tst-chk5-ENV): Likewise.
	(tst-chk6-ENV): Likewise.
	(tst-lfschk1-ENV): Likewise.
	(tst-lfschk2-ENV): Likewise.
	(tst-lfschk3-ENV): Likewise.
	(tst-lfschk4-ENV): Likewise.
	(tst-lfschk5-ENV): Likewise.
	(tst-lfschk6-ENV): Likewise.
	* iconvdata/Makefile (bug-iconv6-ENV): Likewise.
	(tst-iconv7-ENV): Likewise.
	* intl/Makefile (LOCPATH-ENV): Likewise.
	(tst-codeset-ENV): Likewise.
	(tst-gettext3-ENV): Likewise.
	(tst-gettext5-ENV): Likewise.
	* libio/Makefile (tst-widetext-ENV): Don't set LOCPATH.
	(tst-fopenloc-ENV): Likewise.
	(tst-fgetws-ENV): Remove variable.
	(tst-ungetwc1-ENV): Likewise.
	(tst-ungetwc2-ENV): Likewise.
	(bug-ungetwc2-ENV): Likewise.
	(tst-swscanf-ENV): Likewise.
	(bug-ftell-ENV): Likewise.
	(tst-fgetwc-ENV): Likewise.
	(tst-fseek-ENV): Likewise.
	(tst-ftell-partial-wide-ENV): Likewise.
	(tst-ftell-active-handler-ENV): Likewise.
	(tst-ftell-append-ENV): Likewise.
	* posix/Makefile (tst-fnmatch-ENV): Likewise.
	(tst-regexloc-ENV): Likewise.
	(bug-regex1-ENV): Likewise.
	(tst-regex-ENV): Likewise.
	(tst-regex2-ENV): Likewise.
	(bug-regex5-ENV): Likewise.
	(bug-regex6-ENV): Likewise.
	(bug-regex17-ENV): Likewise.
	(bug-regex18-ENV): Likewise.
	(bug-regex19-ENV): Likewise.
	(bug-regex20-ENV): Likewise.
	(bug-regex22-ENV): Likewise.
	(bug-regex23-ENV): Likewise.
	(bug-regex25-ENV): Likewise.
	(bug-regex26-ENV): Likewise.
	(bug-regex30-ENV): Likewise.
	(bug-regex32-ENV): Likewise.
	(bug-regex33-ENV): Likewise.
	(bug-regex34-ENV): Likewise.
	(bug-regex35-ENV): Likewise.
	(tst-rxspencer-ENV): Likewise.
	(tst-rxspencer-no-utf8-ENV): Likewise.
	* stdio-common/Makefile (tst-sprintf-ENV): Likewise.
	(tst-sscanf-ENV): Likewise.
	(tst-swprintf-ENV): Likewise.
	(tst-swscanf-ENV): Likewise.
	(test-vfprintf-ENV): Likewise.
	(scanf13-ENV): Likewise.
	(bug14-ENV): Likewise.
	(tst-grouping-ENV): Likewise.
	* stdlib/Makefile (tst-strtod-ENV): Likewise.
	(tst-strtod3-ENV): Likewise.
	(tst-strtod4-ENV): Likewise.
	(tst-strtod5-ENV): Likewise.
	(testmb2-ENV): Likewise./
	* string/Makefile (tst-strxfrm-ENV): Likewise.
	(tst-strxfrm2-ENV): Likewise.
	(bug-strcoll1-ENV): Likewise.
	(test-strcasecmp-ENV): Likewise.
	(test-strncasecmp-ENV): Likewise.
	* time/Makefile (tst-strptime-ENV): Likewise.
	(tst-ftime_l-ENV): Likewise.
	* wcsmbs/Makefile (tst-btowc-ENV): Likewise.
	(tst-mbrtowc-ENV): Likewise.
	(tst-wcrtomb-ENV): Likewise.
	(tst-mbrtowc2-ENV): Likewise.
	(tst-c16c32-1-ENV): Likewise.
	(tst-mbsnrtowcs-ENV): Likewise.

localedata/ChangeLog:
	* Makefile (TEST_MBWC_ENV): Remove variable.
	(tst_iswalnum-ENV): Likewise.
	(tst_iswalpha-ENV): Likewise.
	(tst_iswcntrl-ENV): Likewise.
	(tst_iswctype-ENV): Likewise.
	(tst_iswdigit-ENV): Likewise.
	(tst_iswgraph-ENV): Likewise.
	(tst_iswlower-ENV): Likewise.
	(tst_iswprint-ENV): Likewise.
	(tst_iswpunct-ENV): Likewise.
	(tst_iswspace-ENV): Likewise.
	(tst_iswupper-ENV): Likewise.
	(tst_iswxdigit-ENV): Likewise.
	(tst_mblen-ENV): Likewise.
	(tst_mbrlen-ENV): Likewise.
	(tst_mbrtowc-ENV): Likewise.
	(tst_mbsrtowcs-ENV): Likewise.
	(tst_mbstowcs-ENV): Likewise.
	(tst_mbtowc-ENV): Likewise.
	(tst_strcoll-ENV): Likewise.
	(tst_strfmon-ENV): Likewise.
	(tst_strxfrm-ENV): Likewise.
	(tst_swscanf-ENV): Likewise.
	(tst_towctrans-ENV): Likewise.
	(tst_towlower-ENV): Likewise.
	(tst_towupper-ENV): Likewise.
	(tst_wcrtomb-ENV): Likewise.
	(tst_wcscat-ENV): Likewise.
	(tst_wcschr-ENV): Likewise.
	(tst_wcscmp-ENV): Likewise.
	(tst_wcscoll-ENV): Likewise.
	(tst_wcscpy-ENV): Likewise.
	(tst_wcscspn-ENV): Likewise.
	(tst_wcslen-ENV): Likewise.
	(tst_wcsncat-ENV): Likewise.
	(tst_wcsncmp-ENV): Likewise.
	(tst_wcsncpy-ENV): Likewise.
	(tst_wcspbrk-ENV): Likewise.
	(tst_wcsrtombs-ENV): Likewise.
	(tst_wcsspn-ENV): Likewise.
	(tst_wcsstr-ENV): Likewise.
	(tst_wcstod-ENV): Likewise.
	(tst_wcstok-ENV): Likewise.
	(tst_wcstombs-ENV): Likewise.
	(tst_wcswidth-ENV): Likewise.
	(tst_wcsxfrm-ENV): Likewise.
	(tst_wctob-ENV): Likewise.
	(tst_wctomb-ENV): Likewise.
	(tst_wctrans-ENV): Likewise.
	(tst_wctype-ENV): Likewise.
	(tst_wcwidth-ENV): Likewise.
	(tst-digits-ENV): Likewise.
	(tst-mbswcs6-ENV): Likewise.
	(tst-xlocale1-ENV): Likewise.
	(tst-xlocale2-ENV): Likewise.
	(tst-strfmon1-ENV): Likewise.
	(tst-strptime-ENV): Likewise.
	(tst-setlocale-ENV): Don't set LOCPATH.
	(bug-iconv-trans-ENV): Remove variable.
	(tst-sscanf-ENV): Likewise.
	(tst-leaks-ENV): Don't set LOCPATH.
	(bug-setlocale1-ENV): Remove variable.
	(bug-setlocale1-static-ENV): Likewise.
	(tst-setlocale2-ENV): Likewise.
2014-06-04 23:37:25 +00:00
David S. Miller 5331255b6e Fix v9/64-bit strcmp when string ends in multiple zero bytes.
[BZ #16885]
	* sysdeps/sparc/sparc64/strcmp.S: Fix end comparison handling when
	multiple zero bytes exist at the end of a string.
	Reported by Aurelien Jarno <aurelien@aurel32.net>

	* string/test-strcmp.c (check): Add explicit test for situations where
	there are multiple zero bytes after the first.
2014-05-01 12:15:06 -07:00
Will Newton 8667f90ec5 string: Cosmetic cleanup of string functions
Clean up string functions that do not have a version in gnulib on
the assumption that glibc is the canonical upstream copy of this
code. basename has a copy in gnulib but it is largely written to
handle Windows paths so merging it is not really viable. The changes
mostly consist of switching to ANSI function prototypes and removing
unused includes.

As many of these functions do not get built in a typical build due
to architecture optimized versions being used instead I built these
by hand to verify there were no build warnings and the code was
identical.

2014-04-07  Will Newton  <will.newton@linaro.org>

	* string/basename.c [HAVE_CONFIG_H]: Remove #ifdef and
	and contents.  [!_LIBC] Remove #ifndef and contents.
	(basename): Use ANSI prototype.  [_LIBC] Remove #idef.
	* string/memccpy.c (__memccpy): Use ANSI prototype.
	* string/memfrob.c (memfrob): Likewise.
	* string/strcoll.c (STRCOLL): Likewise.
	* string/strlen.c (strlen): Likewise.
	* string/strtok.c (STRTOK): Likewise.
	* string/strcat.c: Remove unused #include of memcopy.h.
	(strcat): Use ANSI prototype.
	* string/strchr.c: Remove unused #include of memcopy.h.
	(strchr): Use ANSI prototype.
	* string/strcmp.c: Remove unused #include of memcopy.h.
	(strcmp): Use ANSI prototype.
	* string/strcpy.c: Remove unused #include of memcopy.h.
	(strcpy): Use ANSI prototype.
2014-04-07 09:44:02 +01:00
Adhemerval Zanella 6f23d0939e PowerPC: optimized strpbrk for POWER7
This patch add an optimized strpbrk for POWER7 by using a different
algorithm than default implementation: it constructs a table based on
the 'accept' argument and use this table to check for any occurance on
the input string. The idea is similar as x86_64 uses.
For PowerPC some tunings were added, such as unroll loops and memory
clear using VSX instructions.
2014-03-20 19:46:13 -05:00
Adhemerval Zanella 6eaf95cbfa PowerPC: optimized strcspn for PPC64/POWER7
This patch add a optimized strcspn for POWER7 by using a different
algorithm than default implementation: it constructs a table based on
the 'accept' argument and use this table to check for any occurance
on the input string. The idea is similar as x86_64 uses.
For PowerPC some tunings were added, such as unroll loops and align
stack memory to table to 16 bytes (so VSX clean can ran without
alignment issues).
2014-03-20 11:24:52 -05:00
Vidya Ranganathan e65caf1f1d PowerPC: strspn optimization for PPC64/POWER7
The optimization is achieved by following techniques:
  > hashing of needle.
  > hashing avoids scanning of duplicate entries in needle across the string.
  > initializing the hash table with Vector instructions (VSX) by quadword access.
  > unrolling when scanning for character in string across hash table.
2014-03-11 08:54:33 -05:00
Joseph Myers f214606a0e Enumerate tests with special rules in tests-special variable.
This patch is a revised and updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html>.

In order to generate overall summaries of the results of all tests in
the glibc testsuite, we need to identify and concatenate the files
with the results of individual tests.

Tomas Dohnalek's patch used $(common-objpfx)*/*.test-result for this.
However, the normal glibc approach is explicit enumeration of the
expected set of files with a given property, rather than all files
matching some pattern like that.  Furthermore, we would like to be
able to mark tests as UNRESOLVED if the file with their results is for
some reason missing, and in future we would like to be able to mark
tests as UNSUPPORTED if they are disabled for a particular
configuration (rather than simply having them missing from the list of
tests as at present).  Such handling of tests that were not run or did
not record results requires an explicit enumeration of tests.

For the tests following the default makefile rules, $(tests) (and
$(xtests)) provides such an enumeration.  Others, however, are added
directly as dependencies of the "tests" and "xtests" makefile
targets.  This patch changes the makefiles to put them in variables
tests-special and xtests-special, with appropriate dependencies on the
tests listed there then being added centrally.

Those variables are used in Rules and so need to be set before Rules
is included in a subdirectory makefile, which is often earlier in the
makefile than the dependencies were present before.  We previously
discussed the question of where to include Rules; see the question at
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, and a
discussion in
<https://sourceware.org/ml/libc-alpha/2013-01/msg00337.html> of why
Rules is included early rather than late in subdirectory makefiles.

It was necessary to avoid an indirection through the check-abi target
and get the check-abi-* targets for individual libraries into the
tests-special variable.  The intl/ test $(objpfx)tst-gettext.out,
previously built only because of dependencies from other tests, was
also added to tests-special for the same reason.

The entries in tests-special are the full makefile targets, complete
with $(objpfx) and .out.  If a future change causes tests to be named
consistently with a .out suffix, this can be changed to include just
the path relative to $(objpfx), without .out.

Tested x86_64, including that the same set of files is generated in
the build directory by a build and testsuite run both before and after
the patch (except for changes to the
elf/tst-null-argv.debug.out.<number> file name), and a build with
run-built-tests=no to verify there aren't any more obvious instances
of the issue Marcus Shawcroft reported with a previous version in
<https://sourceware.org/ml/libc-alpha/2014-01/msg00462.html>.

	* Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(tests): Depend on $(tests-special).
	* Makerules (check-abi-list): New variable.
	(check-abi): Depend on $(check-abi-list).
	[$(subdir) = elf] (tests-special): Add
	$(objpfx)check-abi-libc.out.
	[$(build-shared) = yes && subdir] (tests-special): Add
	$(check-abi-list).
	[$(build-shared) = yes && subdir] (tests): Do not depend on
	check-abi.
	* Rules (tests): Depend on $(tests-special).
	(xtests): Depend on $(xtests-special).
	* catgets/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* conform/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* elf/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* grp/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* iconv/Makefile (xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* iconvdata/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* intl/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.  Also add
	$(objpfx)tst-gettext.out.
	* io/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* libio/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* malloc/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* misc/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* nptl/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* nptl_db/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* posix/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* resolv/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(xtests): Change dependencies to ....
	(xtests-special): ... additions to this variable.
	* stdio-common/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	(do-tst-unbputc): Remove target.
	(do-tst-printf): Likewise.
	* stdlib/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* string/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
	* sysdeps/x86/Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.

localedata:
	* Makefile (tests): Change dependencies to ....
	(tests-special): ... additions to this variable.
2014-03-06 22:35:33 +00:00
Rajalakshmi Srinivasaraghavan c7debbdfac PowerPC: strrchr optimization for POWER7/PPC64
This patch optimizes strrchr() for ppc64. It uses aligned memory
access along with cmpb instruction and CPU prefetch to avoid
cache misses for speed improvement.
2014-03-03 08:06:41 -06:00
Ondřej Bílka 7b3551e3a8 Make strtok benchmark competive.
We include a generic version of strtok to result which could be faster
when underlying primitives are better optimized than current version.
2014-02-28 22:45:33 +01:00
Joseph Myers a5f891ac8d Consistently include Makeconfig after defining subdir.
In <https://sourceware.org/ml/libc-alpha/2014-01/msg00196.html> I
noted it was necessary to add includes of Makeconfig early in various
subdirectory makefiles for the tests-special variable settings added
by that patch to be conditional on configuration information.  No-one
commented on the general question there of whether Makeconfig should
always be included immediately after the definition of subdir.

This patch implements that early inclusion of Makeconfig in each
directory (which is a lot easier than consistent placement of includes
of Rules).  Includes are added if needed, or moved up if already
present.  Subdirectory "all:" targets are removed, since Makeconfig
provides one.

There is potential for further cleanups I haven't done.  Rules and
Makerules have code such as

ifneq   "$(findstring env,$(origin headers))" ""
headers :=
endif

to override to empty any value of various variables that came from the
environment.  I think there is a case for Makeconfig setting all the
subdirectory variables (other than subdir) to empty to ensure no
outside value is going to take effect if a subdirectory fails to
define a variable.  (A list of such variables, possibly out of date
and incomplete, is in manual/maint.texi.)  Rules and Makerules would
give errors if Makeconfig hadn't already been included, instead of
including it themselves.  The special code to override values coming
from the environment would then be obsolete and could be removed.

Tested x86_64, including that installed binaries are identical before
and after the patch.

	* argp/Makefile: Include Makeconfig immediately after defining
	subdir.
	* assert/Makefile: Likewise.
	* benchtests/Makefile: Likewise.
	* catgets/Makefile: Likewise.
	* conform/Makefile: Likewise.
	* crypt/Makefile: Likewise.
	* csu/Makefile: Likewise.
	(all): Remove target.
	* ctype/Makefile: Include Makeconfig immediately after defining
	subdir.
	* debug/Makefile: Likewise.
	* dirent/Makefile: Likewise.
	* dlfcn/Makefile: Likewise.
	* gmon/Makefile: Likewise.
	* gnulib/Makefile: Likewise.
	* grp/Makefile: Likewise.
	* gshadow/Makefile: Likewise.
	* hesiod/Makefile: Likewise.
	* hurd/Makefile: Likewise.
	(all): Remove target.
	* iconvdata/Makefile: Include Makeconfig immediately after
	defining subdir.
	* inet/Makefile: Likewise.
	* intl/Makefile: Likewise.
	* io/Makefile: Likewise.
	* libio/Makefile: Likewise.
	(all): Remove target.
	* locale/Makefile: Include Makeconfig immediately after defining
	subdir.
	* login/Makefile: Likewise.
	* mach/Makefile: Likewise.
	(all): Remove target.
	* malloc/Makefile: Include Makeconfig immediately after defining
	subdir.
	(all): Remove target.
	* manual/Makefile: Include Makeconfig immediately after defining
	subdir.
	* math/Makefile: Likewise.
	* misc/Makefile: Likewise.
	* nis/Makefile: Likewise.
	* nss/Makefile: Likewise.
	* po/Makefile: Likewise.
	(all): Remove target.
	* posix/Makefile: Include Makeconfig immediately after defining
	subdir.
	* pwd/Makefile: Likewise.
	* resolv/Makefile: Likewise.
	* resource/Makefile: Likewise.
	* rt/Makefile: Likewise.
	* setjmp/Makefile: Likewise.
	* shadow/Makefile: Likewise.
	* signal/Makefile: Likewise.
	* socket/Makefile: Likewise.
	* soft-fp/Makefile: Likewise.
	* stdio-common/Makefile: Likewise.
	* stdlib/Makefile: Likewise.
	* streams/Makefile: Likewise.
	* string/Makefile: Likewise.
	* sunrpc/Makefile: Likewise.
	(all): Remove target.
	* sysvipc/Makefile: Include Makeconfig immediately after defining
	subdir.
	* termios/Makefile: Likewise.
	* time/Makefile: Likewise.
	* timezone/Makefile: Likewise.
	(all): Remove target.
	* wcsmbs/Makefile: Include Makeconfig immediately after defining
	subdir.
	* wctype/Makefile: Likewise.

libidn/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

localedata/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
	(all): Remove target.

nptl/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.

nptl_db/ChangeLog:
	* Makefile: Include Makeconfig immediately after defining subdir.
2014-02-26 23:12:03 +00:00
Joseph Myers f0881698bf Generate .test-result files for tests with special rules.
This patch, an updated version of
<https://sourceware.org/ml/libc-alpha/2014-01/msg00194.html> now
proposed for inclusion in glibc, extends the generation of PASS and
FAIL status in .test-result files for individual tests to cover tests
with their own custom makefile rules.  This is just adding
$(evaluate-test) calls to all such rules, since tests with multiple
commands were previously split into separate tests.

Note that the tests the makefiles expect to fail (posix/annexc and
conformtest) currently get FAIL listed in the .test-result file,
rather than XFAIL; a subsequent patch will introduce a better XFAIL
mechanism.

Tested x86_64.

	* Makefile ($(objpfx)c++-types-check.out): Use $(evaluate-test).
	($(objpfx)check-local-headers.out): Likewise.
	($(objpfx)begin-end-check.out): Likewise.
	* Makerules (check-abi-%.out): Likewise.
	* catgets/Makefile ($(objpfx)test1.cat): Likewise.
	($(objpfx)test2.cat): Likewise.
	($(objpfx)de/libc.cat): Likewise.
	($(objpfx)test-gencat.out): Likewise.
	* conform/Makefile ($(objpfx)run-conformtest.out): Likewise.
	* elf/Makefile ($(objpfx)order-cmp.out): Likewise.
	($(objpfx)noload-mem): Likewise.
	($(objpfx)tst-pathopt.out): Likewise.
	($(objpfx)tst-rtld-load-self.out): Likewise.
	($(objpfx)tst-array1-cmp.out): Likewise.
	($(objpfx)tst-array1-static-cmp.out): Likewise.
	($(objpfx)tst-array2-cmp.out): Likewise.
	($(objpfx)tst-array3-cmp.out): Likewise.
	($(objpfx)tst-array4-cmp.out): Likewise.
	($(objpfx)tst-array5-cmp.out): Likewise.
	($(objpfx)tst-array5-static-cmp.out): Likewise.
	($(objpfx)check-textrel.out): Likewise.
	($(objpfx)check-execstack.out): Likewise.
	($(objpfx)check-localplt.out): Likewise.
	($(objpfx)order2-cmp.out): Likewise.
	($(objpfx)tst-leaks1-mem): Likewise.
	($(objpfx)tst-leaks1-static-mem): Likewise.
	($(objpfx)tst-initorder-cmp.out): Likewise.
	($(objpfx)tst-initorder2-cmp.out): Likewise.
	($(objpfx)tst-unused-dep.out): Likewise.
	($(objpfx)tst-unused-dep-cmp.out): Likewise.
	* grp/Makefile ($(objpfx)tst_fgetgrent.out): Likewise.
	* iconv/Makefile (test-iconvconfig): Likewise.
	* iconvdata/Makefile ($(objpfx)mtrace-tst-loading): Likewise.
	($(objpfx)iconv-test.out): Likewise.
	($(objpfx)tst-tables.out): Likewise.
	* intl/Makefile ($(objpfx)mtrace-tst-gettext): Likewise.
	($(objpfx)tst-gettext.out): Likewise.
	($(objpfx)tst-translit.out): Likewise.
	($(objpfx)tst-gettext2.out): Likewise.
	($(objpfx)tst-gettext4.out): Likewise.
	($(objpfx)tst-gettext6.out): Likewise.
	* io/Makefile ($(objpfx)ftwtest.out): Likewise.
	* libio/Makefile ($(objpfx)test-freopen.out): Likewise.
	($(objpfx)tst-fopenloc-cmp.out): Likewise.
	($(objpfx)tst-fopenloc-mem.out): Likewise.
	* malloc/Makefile ($(objpfx)tst-mtrace.out): Likewise.
	* misc/Makefile ($(objpfx)tst-error1-mem): Likewise.
	* posix/Makefile ($(objpfx)globtest.out): Likewise.
	($(objpfx)wordexp-tst.out): Likewise.
	($(objpfx)annexc.out): Likewise.
	($(objpfx)tst-fnmatch-mem): Likewise.
	($(objpfx)bug-regex2-mem): Likewise.
	($(objpfx)bug-regex14-mem): Likewise.
	($(objpfx)bug-regex21-mem): Likewise.
	($(objpfx)bug-regex31-mem): Likewise.
	($(objpfx)tst-vfork3-mem): Likewise.
	($(objpfx)tst-rxspencer-no-utf8-mem): Likewise.
	($(objpfx)tst-pcre-mem): Likewise.
	($(objpfx)tst-boost-mem): Likewise.
	($(objpfx)tst-getconf.out): Likewise.
	($(objpfx)bug-ga2-mem): Likewise.
	($(objpfx)bug-glob2-mem): Likewise.
	* resolv/Makefile ($(objpfx)mtrace-tst-leaks): Likewise.
	($(objpfx)mtrace-tst-leaks2): Likewise.
	* stdio-common/Makefile ($(objpfx)tst-unbputc.out): Likewise.
	($(objpfx)tst-printf.out): Likewise.
	($(objpfx)tst-setvbuf1.out): Likewise.
	($(objpfx)tst-setvbuf1-cmp.out): Likewise.
	* stdlib/Makefile ($(objpfx)isomac.out): Likewise.
	($(objpfx)tst-fmtmsg.out): Likewise.
	* string/Makefile ($(objpfx)tst-svc-cmp.out): Likewise.
	* sysdeps/x86/Makefile ($(objpfx)tst-xmmymm.out): Likewise.

localedata:
	* Makefile ($(objpfx)sort-test.out): Use $(evaluate-test).
	($(objpfx)tst-fmon.out): Likewise.
	($(objpfx)tst-numeric.out): Likewise.
	($(objpfx)tst-locale.out): Likewise.
	($(objpfx)tst-rpmatch.out): Likewise.
	($(objpfx)tst-trans.out): Likewise.
	($(objpfx)tst-mbswcs.out): Likewise.
	($(objpfx)tst-ctype.out): Likewise.
	($(objpfx)tst-wctype.out): Likewise.
	($(objpfx)tst-langinfo.out): Likewise.
	($(objpfx)mtrace-tst-leaks): Likewise.

nptl:
	* Makefile ($(objpfx)tst-stack3-mem): Use $(evaluate-test).
	($(objpfx)tst-tls6.out): Likewise.
	($(objpfx)tst-cleanup0.out): Likewise.
	($(objpfx)tst-cleanup0-cmp.out): Likewise.
	($(objpfx)tst-cancel-wrappers.out): Likewise.
	($(objpfx)tst-oddstacklimit.out): Likewise.

nptl_db:
	* Makefile ($(objpfx)db-symbols.out): Use
	$(evaluate-test).
2014-02-21 21:48:08 +00:00
Joseph Myers acd7f096d7 Complete _BSD_SOURCE / _SVID_source followup cleanup.
This patch completes the headers cleanup consequent on removal of
_BSD_SOURCE and _SVID_SOURCE (apart from any subsequent deprecations):

* #endif conditionals that referred to BSD or SVID are updated.

* Redundant __USE_* tests in cases involving __USE_MISC are removed.
  This includes cases such as __USE_MISC || __USE_ISOC99, where
  __USE_MISC is redundant (because __USE_MISC is only ever defined in
  the default / _DEFAULT_SOURCE / _GNU_SOURCE case, when __USE_ISOC99
  is also defined; the same applies to the non-XSI-extended POSIX
  versions), and cases involving __USE_GNU, where __USE_GNU is
  redundant (because if __USE_GNU is defined, so are the other __USE_*
  macros).  There may well be other cases of __USE_FOO || __USE_BAR
  tests that could be simplified because one macro implies the other;
  this patch only addresses cases involving __USE_MISC.

Tested x86_64.

	* bits/fcntl.h [__USE_MISC]: Remove redundant conditionals.
	* bits/sigaction.h [__USE_MISC]: Likewise.
	* bits/waitstatus.h: Update #endif comments.
	* ctype/ctype.h: Likewise.
	* dirent/dirent.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
	* grp/grp.h: Update #endif comments.
	[__USE_GNU]: Remove redundant conditionals.
	[__USE_MISC]: Likewise.
	* inet/netinet/in.h [__USE_GNU]: Likewise.
	* io/sys/stat.h [__USE_MISC]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_MISC]: Likewise.
	* libio/bits/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* libio/bits/stdio2.h [__USE_MISC]: Likewise.
	* libio/stdio.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* math/bits/math-finite.h [__USE_MISC]: Likewise.
	* math/bits/mathcalls.h [__USE_MISC]: Likewise.
	* math/math.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* misc/sys/uio.h: Update #endif comments.
	* posix/bits/unistd.h [__USE_MISC]: Remove redundant conditionals.
	* posix/glob.h [__USE_MISC]: Likewise.
	* posix/sys/types.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/sys/wait.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* posix/unistd.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* pwd/pwd.h [__USE_GNU]: Likewise.
	[__USE_MISC]: Likewise.
	* resolv/netdb.h [__USE_GNU]: Likewise.
	* signal/signal.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* stdlib/stdlib.h: Update #else and #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	[__USE_GNU]: Likewise.
	* string/bits/string2.h [__USE_MISC]: Likewise.
	* string/string.h: Update #endif comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/m68k/m680x0/fpu/bits/mathinline.h [__USE_MISC]:
	Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_MISC]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h: Update #endif
	comments.
	[__USE_MISC]: Remove redundant conditionals.
	* sysdeps/unix/sysv/linux/bits/in.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sigaction.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/bits/socket.h [__USE_GNU]: Likewise.
	* sysdeps/unix/sysv/linux/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/ia64/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/m68k/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/sigaction.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/stat.h [__USE_MISC]:
	Likewise.
	* sysdeps/unix/sysv/linux/x86/bits/stat.h [__USE_MISC]: Likewise.
	* sysdeps/x86/bits/string.h: Update #endif comments.
	* sysdeps/x86/fpu/bits/mathinline.h [__USE_MISC]: Remove redundant
	conditionals.
	* time/sys/time.h: Update #endif comments.
	* time/time.h: Likewise.
	[__USE_MISC]: Remove redundant conditionals.
2014-02-21 21:45:26 +00:00
Joseph Myers 6e89caf118 Split up rules for tests that compare output with baselines.
This patch splits makefile rules that generate a file then run cmp to
check the contents of that file into separate rules to generate and
compare the file.  This simplifies making those tests generate PASS /
FAIL results, by removing the need to insert && between commands in
the test so that a $(evaluate-test) call is reached.  It also avoids
the oddity of the .out file being an intermediate file rather than the
final result generated, as noted for some of these tests in
<https://sourceware.org/ml/libc-alpha/2012-10/msg00894.html>.

In many cases, the rule to run the program was no longer needed
because the default rules for running test programs on the host to
generate a .out file sufficed.  (I'm not asserting the commands run
after this patch are *exactly* the same as before, simply that the
rules did nothing special that appeared deliberate or relevant to
anything about what the tests were testing.  In cases where the rules
redirected stderr as well as stdout, I left the existing rule's
redirection in place to avoid changing what gets compared with the
expected results.)

It's clear there is a lot in common between the various -cmp.out rules
and it might be possible in future to refactor them into more generic
support for the case of comparing test output against a baseline.
(Some baselines are *.exp, some *.expect, some directly embedded in
the makefiles, and nptl/tst-cleanupx0.expect appears unused.)

Tested x86_64.

	* elf/Makefile ($(objpfx)order.out): Remove rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)order-cmp.out.
	($(objpfx)order-cmp.out): New rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)tst-array1-cmp.out, $(objpfx)tst-array1-static-cmp.out,
	$(objpfx)tst-array2-cmp.out, $(objpfx)tst-array3-cmp.out,
	$(objpfx)tst-array4-cmp.out, $(objpfx)tst-array5-cmp.out and
	$(objpfx)tst-array5-static-cmp.out.
	($(objpfx)tst-array1.out): Remove rule.
	($(objpfx)tst-array1-cmp.out): New rule.
	($(objpfx)tst-array1-static.out): Remove rule.
	($(objpfx)tst-array1-static-cmp.out): New rule.
	($(objpfx)tst-array2.out): Remove rule.
	($(objpfx)tst-array2-cmp.out): New rule.
	($(objpfx)tst-array3.out): Remove rule.
	($(objpfx)tst-array3-cmp.out): New rule.
	($(objpfx)tst-array4.out): Remove rule.
	($(objpfx)tst-array4-cmp.out): New rule.
	($(objpfx)tst-array5.out): Remove rule.
	($(objpfx)tst-array5-cmp.out): New rule.
	($(objpfx)tst-array5-static.out): Remove rule.
	($(objpfx)tst-array5-static-cmp.out): New rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)order2-cmp.out.
	($(objpfx)order2.out): Remove rule.
	($(objpfx)order2-cmp.out): New rule.
	($(objpfx)tst-initorder.out): Remove rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)tst-initorder-cmp.out.
	($(objpfx)tst-initorder-cmp.out): New rule.
	($(objpfx)tst-initorder2.out): Remove rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)tst-initorder2-cmp.out.
	($(objpfx)tst-initorder2-cmp.out): New rule.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)tst-unused-dep-cmp.out.
	($(objpfx)tst-unused-dep-cmp.out): Do not run cmp.
	($(objpfx)tst-unused-dep-cmp.out): New rule.
	* stdio-common/Makefile [$(run-built-tests) = yes] (tests): Depend
	on $(objpfx)tst-setvbuf1-cmp.out.
	($(objpfx)tst-setvbuf1.out): Do not run cmp.
	($(objpfx)tst-setvbuf1-cmp.out): New rule.
	* string/Makefile [$(run-built-tests) = yes] (tests): Depend
	$(objpfx)tst-svc-cmp.out instead of $(objpfx)tst-svc.out.
	($(objpfx)tst-svc.out): Remove rule.
	($(objpfx)tst-svc-cmp.out): New rule.

nptl:
	* Makefile ($(objpfx)tst-cleanup0.out): Do not run cmp.
	[$(run-built-tests) = yes] (tests): Depend on
	$(objpfx)tst-cleanup0-cmp.out.
	($(objpfx)tst-cleanup0-cmp.out): New rule.
2014-02-14 13:42:44 +00:00
Joseph Myers ed9a38e21b Clean up trivially redundant __USE_MISC conditionals.
This patch cleans up cases of __USE_MISC that are trivially redundant
after the recent substitution of __USE_MISC for __USE_BSD and
__USE_SVID: either in constructs such as "defined __USE_MISC ||
defined __USE_MISC", or else (in the bits/mman.h case) a conditional
on __USE_MISC nested inside another __USE_MISC conditional.  (The
cleanups remaining after this patch are still quite large, but it
seems a reasonable piece to separate out.)

Tested x86_64.

	* bits/mman.h [__USE_MISC]: Remove redundant conditionals.
	* ctype/ctype.h [__USE_MISC]: Likewise.
	* dirent/dirent.h [__USE_MISC]: Likewise.
	* grp/grp.h [__USE_MISC]: Likewise.
	* io/fcntl.h [__USE_MISC]: Likewise.
	* io/sys/stat.h [__USE_MISC]: Likewise.
	* libio/stdio.h [__USE_MISC]: Likewise.
	* posix/unistd.h [__USE_MISC]: Likewise.
	* pwd/pwd.h [__USE_MISC]: Likewise.
	* stdlib.h [__USE_MISC]: Likewise.
	* string/bits/string2.h [__USE_MISC]: Likewise.
	* string/string.h [__USE_MISC]: Likewise.
	* time/time.h [__USE_MISC]: Likewise.
2014-02-13 22:07:53 +00:00
Joseph Myers 498afc54df Combine __USE_BSD and __USE_SVID into __USE_MISC.
This patch cleans up following the obsoletion of _BSD_SOURCE and
_SVID_SOURCE by combining __USE_BSD and __USE_SVID into __USE_MISC.

The only non-mechanical part of this patch is the changes to
features.h; everything else is simple substitution of __USE_MISC for
the old macros.  Thus, this patch leaves obviously redundant
conditionals such as "defined __USE_MISC || defined __USE_MISC", and
does not update #endif comments where they referred to BSD or SVID in
words instead of the literal macro name.  This is intended to
facilitate patch review by separating the less mechanical changes from
these purely mechanical changes into a separate patch.  (I do intend
to integrate all the changes from
<https://sourceware.org/ml/libc-alpha/2013-12/msg00226.html>, which I
believe includes all the trailing comment updates, in subsequent
patches.)

Tested x86_64.

	* include/features.h (__USE_BSD): Remove macro definitions.
	(__USE_SVID): Likewise.
	(_BSD_SOURCE): Likewise.
	(_SVID_SOURCE): Likewise.
	[!defined _BSD_SOURCE && !defined _SVID_SOURCE]: Remove condition
	from definition of _DEFAULT_SOURCE.
	[_BSD_SOURCE || _SVID_SOURCE]: Change condition to
	[_DEFAULT_SOURCE].
	* bits/fcntl.h [__USE_BSD]: Change condition to [__USE_MISC].
	* bits/mman.h [__USE_BSD]: Likewise.
	* bits/termios.h [__USE_BSD]: Likewise.
	* bits/waitstatus.h [__USE_BSD]: Likewise.
	* ctype/ctype.h [__USE_SVID]: Likewise.
	* dirent/dirent.h [__USE_BSD]: Likewise.
	* grp/grp.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* inet/netinet/igmp.h [__USE_BSD]: Likewise.
	* io/fcntl.h [__USE_BSD]: Likewise.
	* io/ftw.h [__USE_BSD]: Likewise.
	* io/sys/stat.h [__USE_BSD]: Likewise.
	* libio/bits/stdio-ldbl.h [__USE_BSD]: Likewise.
	* libio/bits/stdio2.h [__USE_BSD]: Likewise.
	* libio/stdio.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* math/math.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* misc/bits/syslog-ldbl.h [__USE_BSD]: Likewise.
	* misc/bits/syslog.h [__USE_BSD]: Likewise.
	* misc/search.h [__USE_SVID]: Likewise.
	* misc/sys/mman.h [__USE_BSD]: Likewise.
	* misc/sys/syslog.h [__USE_BSD]: Likewise.
	* misc/sys/uio.h [__USE_BSD]: Likewise.
	* posix/bits/unistd.h [__USE_BSD]: Likewise.
	* posix/glob.h [__USE_BSD]: Likewise.
	* posix/regex.h [__USE_BSD]: Likewise.
	* posix/sys/types.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/sys/utsname.h [__USE_SVID]: Likewise.
	* posix/sys/wait.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* posix/unistd.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* pwd/pwd.h [__USE_SVID]: Likewise.
	* resolv/netdb.h [__USE_BSD]: Likewise.
	* setjmp/setjmp.h [__USE_BSD]: Likewise.
	* signal/signal.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* socket/sys/socket.h [__USE_BSD]: Likewise.
	* stdlib/fmtmsg.h [__USE_SVID]: Likewise.
	* stdlib/stdlib.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string2.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.
	* string/bits/string3.h [__USE_BSD]: Likewise.
	* string/endian.h [__USE_BSD]: Likewise.
	* string/string.h [__USE_SVID]: Likewise.
	[__USE_BSD]: Likewise.
	* string/strings.h [__USE_BSD]: Likewise.
	* sysdeps/generic/netinet/ip.h [__USE_BSD]: Likewise.
	* sysdeps/gnu/netinet/ip_icmp.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/fcntl.h [__USE_BSD]: Likewise.
	* sysdeps/mach/hurd/bits/stat.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/mman.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/fcntl-linux.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/mman-linux.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/bits/sys_errlist.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/bits/termios.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/mips/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_ether.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_fddi.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/netinet/if_tr.h [__USE_BSD]: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/termios.h [__USE_BSD]:
	Likewise.
	* sysdeps/x86/bits/string.h [__USE_BSD]: Likewise.
	* sysvipc/sys/ipc.h [__USE_SVID]: Likewise.
	* termios/termios.h [__USE_BSD]: Likewise.
	* time/sys/time.h [__USE_BSD]: Likewise.
	* time/time.h [__USE_BSD]: Likewise.
	[__USE_SVID]: Likewise.

	* sysdeps/unix/sysv/linux/hppa/bits/mman.h [__USE_BSD]: Change
	condition to [__USE_MISC].
2014-02-12 23:41:01 +00:00
Ondřej Bílka a1ffb40e32 Use glibc_likely instead __builtin_expect. 2014-02-10 15:07:12 +01:00
Allan McRae d4697bc93d Update copyright notices with scripts/update-copyrights 2014-01-01 22:00:23 +10:00
Brooks Moses 3f637079f5 Define __CORRECT_ISO_CPP_STRING_H_PROTO correctly for Clang.
In the string/string.h and string/strings.h headers, we have a couple
of macros that "tell the caller that we provide correct C++
prototypes" according to the comment; they are used to determine
whether to wrap some prototypes in "extern "C++"" (and provide
multiple overloads of them, and some other magic) when __cplusplus is
defined.

The macros are set to check for sufficiently-recent GCC versions (4.4
and later), but this is not the right check for non-GCC compilers.  In
particular, these macros should also be set when using Clang -- if
they are not set, then Clang will be unable to correctly diagnose a
number of subtle bugs that will be errors in GCC compilations.

As per discussion on earlier versions of this patch, rather than
restrict the fix to Clang per se, we assume that all C++ compilers that
claim to fully support C++98 are using a standard-conforming C++
standard library, which seems pretty reasonable.  Clang has been
providing an appropriate value of __cplusplus since May 2012.
2013-12-23 15:50:54 -08:00
Adhemerval Zanella e28bcd427b PowerPC: multiarch wordcopy for PowerPC64 2013-12-13 14:54:08 -05:00
Adhemerval Zanella 07253fcf7b PowerPC: multirach memcmp for PowerPC64 2013-12-13 14:32:31 -05:00
Adhemerval Zanella 31c81aaa01 PowerPC: multiarch strchrnul for PowerPC32 2013-12-06 05:47:01 -06:00
Adhemerval Zanella 7af8b94625 PowerPC: multiarch rawmemchr for PowerPC32 2013-12-06 05:47:00 -06:00
Adhemerval Zanella 1c62e6d960 PowerPC: multiarch memchr for PowerPC32 2013-12-06 05:47:00 -06:00
Adhemerval Zanella 87da8bdbe1 PowerPC: multiarch mempcpy for PowerPC32 2013-12-06 05:46:59 -06:00
Ondřej Bílka 52bb65431f Remove duplicate ifunc tests. 2013-11-26 12:58:28 +01:00
Samuel Thibault 43d5c02c72 Fix build on hurd
* string/strcoll_l.c: Include <sys/param.h> for MIN/MAX macros.
2013-11-10 11:22:32 +01:00
Alan Modra 0edf96c28f string/tester memrchr test
http://sourceware.org/ml/libc-alpha/2013-08/msg00095.html

I found this useful at one stage when I was seeing a huge number of
memrchr failures all of test number 10.

	* string/tester.c (test_memrchr): Increment reported test cycle.
2013-10-04 10:42:15 +09:30
Alan Modra e0f7a38046 string/test-memcpy error reporting
http://sourceware.org/ml/libc-alpha/2013-08/msg00094.html

Using plain %s here runs the risk of segfaulting when displaying the
string.  src and dst aren't zero terminated strings.

	* string/test-memcpy.c (do_one_test): When reporting errors, print
	string address and don't overrun end of string.
2013-10-04 10:42:02 +09:30
Siddhesh Poyarekar 303e567a80 Check for integer overflow in cache size computation in strcoll
strcoll is implemented using a cache for indices and weights of
collation sequences in the strings so that subsequent passes do not
have to search through collation data again.  For very large string
inputs, the cache size computation could overflow.  In such a case,
use the fallback function that does not cache indices and weights of
collation sequences.

Fixes CVE-2012-4412.
2013-09-23 11:29:53 +05:30
Siddhesh Poyarekar 141f3a77fe Fall back to non-cached sequence traversal and comparison on malloc fail
strcoll currently falls back to alloca if malloc fails, resulting in a
possible stack overflow.  This patch implements sequence traversal and
comparison without caching indices and rules.

Fixes CVE-2012-4424.
2013-09-23 11:29:53 +05:30
Andreas Schwab 5bb43a4319 Make __ffs hidden 2013-09-20 21:25:31 +02:00
Adhemerval Zanella 4660856c6f Add memrchr testcase 2013-09-05 09:52:08 -03:00
Andreas Schwab 45b8acccaf Fix missing declaration of LC_CTYPE nonascii-case element 2013-08-27 12:21:12 +02:00
Siddhesh Poyarekar 1326ba1af2 Simplify strcoll implementation
Break up strcoll into simpler functions so that the logic is easier to
follow and maintain.
2013-08-20 08:40:06 +05:30
H.J. Lu bb5bb87cd2 Add a test for BZ #15674 2013-06-26 15:23:08 -07:00
Adhemerval Zanella 85c2e6110c Fix loop construction to functions calls
Check wheter the compiler has the option -fno-tree-loop-distribute-patterns
to inhibit loop transformation to library calls and uses it on memset
and memmove default implementation to avoid recursive calls.
2013-06-20 19:42:05 -05:00
Siddhesh Poyarekar fec799f823 Remove performance-related bits from string tests 2013-06-11 15:08:13 +05:30
Joseph Myers 2e09a79ada Avoid use of "register" as optimization hint. 2013-06-07 22:24:35 +00:00
Siddhesh Poyarekar 96df079a42 Add copyright header to test-strchrnul.c 2013-06-04 16:40:55 +05:30
Ryan S. Arnold e054f49430 Add #include <stdint.h> for uint[32|64]_t usage (except installed headers). 2013-05-16 11:32:54 -05:00
Ondrej Bilka a07c5731d6 Remove duplicate __strcmp_cg
The __strcmp_cg code was duplicate of of __strcmp_gc. This patch unifies
these two cases into one.
2013-05-01 20:55:06 +02:00
Andreas Jaeger f238fd190b Sort Versions files 2013-02-17 16:34:04 +01:00
Joseph Myers daaa7713e9 Remove bounded-pointers build system support. 2013-02-15 15:07:54 +00:00
Joseph Myers 2bdd4ca6b6 Remove miscellaneous bounded-pointers relics in C code. 2013-02-15 00:51:53 +00:00
Joseph Myers e97ed6ddbe Remove bp-sym.h and BP_SYM uses from C code. 2013-02-14 13:12:02 +00:00
Joseph Myers 70d9946a44 Remove __ptrvalue, __bounded and __unbounded. 2013-02-13 23:30:40 +00:00
Ondrej Bilka 170704c9ec Call memcpy in generic mempcpy 2013-02-13 12:57:41 +01:00
Tom de Vries a175b684e2 Fix typo, improve comment, remove superfluous #undefs, add missing #undef. 2013-02-12 00:00:49 +01:00
Tom de Vries fe77fe6d51 Remove dead CFLAGS lines from string/Makefile 2013-02-11 23:10:26 +01:00
Roland McGrath 7f3e75f87a Remove dead variable in generic strcpy. 2013-02-08 10:46:32 -08:00
Joseph Myers b2c9eff43c Remove CHECK_BOUNDS_LOW and CHECK_BOUNDS_HIGH for C code. 2013-02-08 01:10:40 +00:00
Roland McGrath f1d70dad53 Remove lots of inline keywords. 2013-02-07 14:44:18 -08:00
Joseph Myers 6a57d93130 Remove __GLIBC_HAVE_LONG_LONG. 2013-01-11 21:13:25 +00:00
H.J. Lu 740b3dbee8 Add --enable-hardcoded-path-in-tests configure option 2013-01-11 07:14:18 -08:00
Joseph Myers fed0faa1c6 Remove __GNUC__ conditions for "long long" from string.h and wchar.h. 2013-01-10 16:44:59 +00:00
Joseph Myers 568035b787 Update copyright notices with scripts/update-copyrights. 2013-01-02 19:05:09 +00:00
2012-12-27 Bruno Haible 7fffbdfff7 BZ#14317: Optimze __xpg_strerror_r
[BZ #14317]
* string/xpg-strerror.c (__xpg_strerror_r): Optimize, call
strlen only if needed.
2012-12-27 22:37:39 +01:00
Maxim Kuvyrkov 19218757e6 Use memcpy in memmove when possible 2012-11-06 17:47:55 -08:00
Joseph Myers 03ac099f6b Define and use $(run-built-tests). 2012-10-24 00:08:46 +00:00
H.J. Lu 69f07e5fd1 Add string IFUNC tests 2012-10-19 22:10:16 -07:00
H.J. Lu 38c7829650 Add a testcase for BZ #14716 2012-10-19 01:20:12 -07:00
Maxim Kuvyrkov e9f3725206 Fix BZ #14716: memmem crash 2012-10-15 17:22:41 -07:00
Andreas Schwab ca38dc17d8 Avoid PLT references from __get_clockfreq on powerpc 2012-10-12 16:54:06 +02:00
H.J. Lu 11dd4af68c Framework to test IFUNC implementations on target 2012-10-11 16:40:01 -07:00
H.J. Lu 9a387d1f78 Use IFUNC memmove/memset in x86-64 bcopy/bzero
Also add separate tests for bcopy and bzero.
2012-10-11 13:58:16 -07:00
Maxim Kuvyrkov 57e605ba50 Fix BZ #14602: strstr and strcasestr return wrong result. 2012-10-08 20:52:53 -07:00