Age | Commit message (Collapse) | Author |
|
tst-printfsz.c.
This patch uses diagnostic control pragmas to disable warnings in
stdio-common/tst-printfsz.c for use of the deprecated
register_printf_function. Because this test is testing printf_size
and printf_size_info, and the latter has the interface expected for
register_printf_function instead of the newer
register_printf_specifier, it seems correct for this test to use the
deprecated interface (wrapping printf_size_info in some way to use
register_printf_specifier would seem an excessive change to what's
tested).
Tested for x86_64.
* stdio-common/tst-printfsz.c: Include <libc-internal.h>.
(main): Disable -Wdeprecated-declarations around calls to
register_printf_function.
|
|
This patch uses diagnostic control pragmas to disable some
division-by-zero warnings in stdio-common/tst-unlockedio.c. This is
another test where disabling warnings using diagnostic pragmas seems
appropriate (the warnings are not wildly inappropriate for what the
test deliberately does; the deliberate use of unusual arguments to the
macros being tested means that changing the arguments in a way that
avoids the warning would also unduly perturb what is being tested).
Tested for x86_64.
* stdio-common/tst-unlockedio.c: Include <libc-internal.h>.
(do_test): Disable -Wdiv-by-zero around some calls to
fwrite_unlocked and fread_unlocked.
|
|
In <https://sourceware.org/ml/libc-alpha/2014-11/msg00326.html>,
Roland requested internal macros for use of "#pragma GCC diagnostic".
This patch adds such macros and uses them to disable -Wformat warnings
for some code testing GNU scanf %as where GCC expects C99 scanf %a
(several other stdio tests currently use -Wno-format to disable
warnings). Limitations in GCC's diagnostic pragmas require separate
macros before and after the code generating the warnings, rather than
a single macro taking that code as an argument.
The macros are named DIAG_*_NEEDS_COMMENT to emphasise to reviewers
the need for a comment accompanying any use of them (such comments may
however just appear once for several uses of the macros for the same
issue in the same file). I put a GCC version in the arguments to
DIAG_IGNORE_NEEDS_COMMENT, as that seems something useful to grep for
when obsoleting support for an old GCC version and needing to decide
if warning-disabling code is still relevant.
These macros should be usable for replacing existing -Wno-* use in
makefiles (as also suggested by Roland), though I have no plans to
work on that (only on use of the macros in cases where warnings are
currently present that need disabling to use -Werror).
Tested for x86_64.
* include/libc-internal.h (DIAG_PUSH_NEEDS_COMMENT): New macro.
(DIAG_POP_NEEDS_COMMENT): Likewise.
(_DIAG_STR1): Likewise.
(_DIAG_STR): Likewise.
(DIAG_IGNORE_NEEDS_COMMENT): Likewise.
* stdio-common/bug21.c: Include <libc-internal.h>.
(do_test): Disable -Wformat around call to sscanf.
* stdio-common/scanf14.c: Include <libc-internal.h>.
(main): Disable -Wformat around some calls to scanf functions.
|
|
|
|
This patch fixes a stack allocated variable to force it to have wchar_t
alignment.
|
|
Some pthreads functions use getrlimit and gettimeofday, but these
functions are XSI, not base POSIX; this is a namespace issue for
dynamic linking as well as static linking. This patch makes them use
__getrlimit and __gettimeofday instead - the former needed to be newly
exported from libc.so at GLIBC_PRIVATE (and so now needs
libc_hidden_proto / libc_hidden_def), the latter was already exported.
Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch).
[BZ #17682]
* resource/Versions (libc): Add __getrlimit at GLIBC_PRIVATE.
* resource/getrlimit.c (__getrlimit): Use libc_hidden_def.
* sysdeps/mach/hurd/getrlimit.c (__getrlimit): Likewise.
* include/sys/resource.h (__getrlimit): Use libc_hidden_proto.
* nptl/nptl-init.c (__pthread_initialize_minimal_internal): Use
__getrlimit instead of getrlimit.
* nptl/pthread_cond_timedwait.c (__pthread_cond_timedwait): Use
__gettimeofday instead of gettimeofday.
* nptl/pthread_rwlock_timedrdlock.c (pthread_rwlock_timedrdlock):
Likewise.
* nptl/pthread_rwlock_timedwrlock.c (pthread_rwlock_timedwrlock):
Likewise.
* sysdeps/pthread/aio_misc.c (handle_fildes_io): Likewise.
* conform/Makefile (test-xfail-POSIX2008/aio.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/pthread.h/linknamespace): Likewise.
(test-xfail-POSIX2008/time.h/linknamespace): Likewise.
|
|
On 'do_ftell_test' the code:
365 if (test_modes[i].fd_mode != O_WRONLY)
366 {
367 char tmpbuf[data_len];
368
369 rewind (fp);
370
371 while (fgets_func (tmpbuf, sizeof (tmpbuf), fp) && !feof (fp));
The 'data_len' is calculated with wsclen and allocated as 'char'. The
subsequent fgetws will then try to write at most 'data_len' wchar_t
in a buffer with just data_len 'char'. This patch fixes it by
allocating the tmpbuf using 'wchar_t' * data_len bytes.
|
|
|
|
Some linknamespace tests were failing because of references to
h_errno. References to this symbol should be allowed for XPG4, UNIX98
and XOPEN2K; this patch adds it to the list of allowed data symbols
for those standards. (h_errno was removed in the 2008 edition of
POSIX, so POSIX2008 and XOPEN2K8 references to it are genuine bugs;
fortunately it's not a public data symbol - __h_errno_location is
public, TLS h_errno is GLIBC_PRIVATE - so the symbol can simply be
renamed to __h_errno to fix those bugs without the ABI complications
normally associated with namespace issues for data symbols.)
Tested for x86_64.
* conform/list-header-symbols.pl (%extra_syms): Add h_errno for
XPG4, UNIX98 and XOPEN2K.
* conform/Makefile (test-xfail-XOPEN2K/grp.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/pwd.h/linknamespace): Likewise.
|
|
|
|
|
|
Don't use K&R style for function definitions.
|
|
POSIX allows applications to switch file handles when a read results
in an end of file. Unset the cached offset at this point so that it
is queried again.
|
|
The test case fails to truncate the file when a file is intended to be
opened in w or w+ mode. Add O_TRUNC to fix this. The test still
succeeds with this change.
|
|
Currently we seek to end of file if there are unflushed writes or the
stream is in write mode, to get the current offset for writing in
append mode, which is the end of file. The latter case (i.e. stream
is in write mode, but no unflushed writes) is unnecessary since it
will only happen when the stream has just been flushed, in which case
the recorded offset ought to be reliable.
Removing that case lets ftell give the correct offset when it follows
an ftruncate. The latter truncates the file, but does not change the
file position, due to which it is permissible to call ftell without an
intervening fseek call.
Tested on x86_64 to verify that the added test case fails without the
patch and succeeds with it, and that there are no additional
regressions due to it.
[BZ #17647]
* libio/fileops.c (do_ftell): Seek only when there are
unflushed writes.
* libio/wfileops.c (do_ftell_wide): Likewise.
* libio/tst-ftell-active-handler.c (do_ftruncate_test): New
test case.
(do_one_test): Call it.
|
|
Some linknamespace tests were failing because of references to
getdate_err. References to this symbol should be allowed for XPG4 and
later XSI standards; it was missing from the whitelist of data
symbols. This patch adds it to that list.
Tested for x86_64.
* conform/list-header-symbols.pl (%extra_syms): Add getdate_err
for XPG4, UNIX98, XOPEN2K and XOPEN2K8.
* conform/Makefile (test-xfail-XOPEN2K/pthread.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K/time.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/pthread.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/time.h/linknamespace): Likewise.
|
|
It seems two of the XFAILed linknamespace tests were completely fixed
by some of my recent namespace fixes in combination (although not by
any individual one of those fixes relative to the sources used for
testing each patch, or that individual fix would also have removed the
XFAIL in question). This patch removes those XFAILs that are no
longer needed.
Tested for x86_64.
* conform/Makefile (test-xfail-XOPEN2K/aio.h/linknamespace):
Remove variable.
(test-xfail-XOPEN2K8/aio.h/linknamespace): Likewise.
|
|
Various objects in glibc bring in ifaddrs.o (via references to
__netlink_*) and thereby getifaddrs and freeifaddrs, which are not
part of any standard supported by glibc. These should be weak aliases
of __getifaddrs and __freeifaddrs; this patch makes them so.
(The path by which these functions are brought in is Linux-specific,
but it seems less confusing to make all versions of these functions
weak aliases rather than only the Linux-specific versions that
definitely need it.)
Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by this patch).
[BZ #17668]
* inet/ifaddrs.c (getifaddrs): Rename to __getifaddrs and define
as weak alias of __getifaddrs. Use libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs. Use libc_hidden_weak.
* sysdeps/gnu/ifaddrs.c (getifaddrs): Rename to __getifaddrs and
define as weak alias of __getifaddrs. Use libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs. Use libc_hidden_weak.
* sysdeps/unix/sysv/linux/ifaddrs.c (getifaddrs): Rename to
__getifaddrs and define as weak alias of __getifaddrs. Use
libc_hidden_weak.
(freeifaddrs): Rename to __freeifaddrs and define as weak alias of
__freeifaddrs. Use libc_hidden_weak.
* conform/Makefile (test-xfail-XOPEN2K/net/if.h/linknamespace):
Remove variable.
(test-xfail-POSIX2008/net/if.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/net/if.h/linknamespace): Likewise.
|
|
Since __libc_start_main may not be in the same 256MB-aligned region as
the function __start, replace use of jal instruction with la/jalr.
This fixes linker issue reported in:
https://sourceware.org/bugzilla/show_bug.cgi?id=17601
[BZ #17601]
* sysdeps/mips/start.S (__start): Use indirect jump to call
__libc_start_main.
|
|
This patch fixes a warning in a test that was added since my recent
warning cleanup:
tst-stack4.c: In function 'dso_process':
tst-stack4.c:64:7: warning: format '%i' expects argument of type 'int', but argument 3 has type 'uintptr_t' [-Wformat=]
The original variable has type int then is cast to uintptr_t, and from
there to void *, to pass it to a thread, so reversing the process by
casting to uintptr_t and then to int is natural; this patch does so.
Tested for x86_64.
* nptl/tst-stack4.c (dso_process): Use int not uintptr_t for t.
|
|
This patch fixes -Waddress warnings in nptl/tst-mutex1.c from
comparing the address of an object with NULL (ATTR may either be NULL,
or the address of an object when included from other tests, and the
warning arises in the latter case). A macro ATTR_NULL is defined
alongside ATTR and used for the tests.
Tested for x86_64.
* nptl/tst-mutex1.c: Include <stdbool.h>.
[!ATTR] (ATTR_NULL): New macro.
(do_test): Test !ATTR_NULL instead of ATTR != NULL.
* nptl/tst-mutexpi1.c (ATTR_NULL): New macro.
* nptl/tst-mutexpp1.c (ATTR_NULL): New macro.
|
|
This patch fixes a "discards qualifiers" warning in
posix/tst-getopt_long1.c. glibc is built with -Wwrite-strings,
meaning a char * cannot be initialized directly with a string
constant; the patch casts the string constants to char *.
Tested for x86_64.
* posix/tst-getopt_long1.c (do_test): Cast elements of argv array
to char *.
|
|
For XPG3/XPG4 (defined __USE_XOPEN && !defined __USE_UNIX98), unistd.h
declares many functions that should only be declared for __USE_MISC
(none of them are in XPG3/XPG4): sethostname sethostid getdomainname
setdomainname vhangup revoke profil acct getusershell endusershell
setusershell daemon. The whole block with the [__USE_MISC ||
(__USE_XOPEN && !__USE_UNIX98)] conditional contains only functions
that are not in XPG3/XPG4, so this patch simply changes the
conditional.
Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by this patch).
[BZ #17665]
* posix/unistd.h [__USE_MISC || (__USE_XOPEN && !__USE_UNIX98)]:
Change conditional to [__USE_MISC].
|
|
Various POSIX functions bring in res_init.o, res_hconf.o or
mntent_r.o, which use fgets_unlocked, which is not a POSIX function.
This patch arranges for them to use __fgets_unlocked instead. (The
IS_IN (libc) conditional in rec_hconf.c is needed because that file is
also used in nscd.)
Tested for x86_64 (testsuite, and that disassembly of installed shared
libraries is unchanged by the patch except for an assertion line
number). Note that most of the linknamespace tests that failed
because of fgets_unlocked from the resolver also fail because of other
symbols brought in by the resolver, so the number of XFAILs this
removes is limited. Also note that fgets_unlocked failures for
unistd.h for XPG3/XPG4 showed up that actually unistd.h is declaring
too much for XPG3/XPG4 (bug 17665) - there is no actual need to make
getusershell.c use __fgets_unlocked (at least as regards formal
standards are concerned; maybe it should still change for
namespace-cleanness of _DEFAULT_SOURCE) because the functions there
aren't actually in any of the supported standards; the correct fix for
those failures will be to stop the *usershell* functions appearing in
unistd.h for XPG3/XPG4.
[BZ #17664]
* misc/mntent_r.c (__getmntent_r): Use __fgets_unlocked instead of
fgets_unlocked.
* resolv/res_hconf.c [IS_IN (libc)] (fgets_unlocked): Define to
__fgets_unlocked.
* resolv/res_init.c (__res_vinit): Use __fgets_unlocked instead of
fgets_unlocked.
* conform/Makefile (test-xfail-XPG4/sys/statvfs.h/linknamespace):
Remove variable.
(test-xfail-POSIX/sys/mman.h/linknamespace): Likewise.
(test-xfail-UNIX98/sys/mman.h/linknamespace): Likewise.
(test-xfail-UNIX98/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/sys/mman.h/linknamespace): Likewise.
(test-xfail-XOPEN2K/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-POSIX2008/sys/mman.h/linknamespace): Likewise.
(test-xfail-POSIX2008/sys/statvfs.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/sys/mman.h/linknamespace): Likewise.
(test-xfail-XOPEN2K8/sys/statvfs.h/linknamespace): Likewise.
|
|
This patch fixes a warning "tst-unique4lib.cc:17:12: warning: 'b'
defined but not used [-Wunused-variable]". I'm not sure exactly what
aspects of the test are or are not significant for the issue it is
testing for; the patch makes the minimal change of marking the
variable with __attribute__ ((used)).
Tested for x86_64.
* elf/tst-unique4lib.cc (b): Mark with __attribute__ ((used)).
|
|
This patch makes the POWER7 optimized strpbrk generic by using
default doubleword stores to zero the hash, instead of VSX
instructions. Performance on POWER7/POWER8 does not change.
|
|
This patch makes the POWER7 optimized strcspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions. Performance on POWER7/POWER8 does not change.
|
|
This patch makes the POWER7 optimized strspn generic by using
default doubleword stores to zero the hash, instead of VSX
instructions. Performance on POWER7/POWER8 machines does not changed.
|
|
[BZ #17581] The checking chain of unused chunks was terminated by a hash of
the block pointer, which was sometimes confused with the chunk length byte.
The chain is now terminated by a NULL byte.
|
|
This patch optimizes strtok and strtok_r for POWERPC64.
A table of 256 characters is created and marked based on
the 'accept' argument and used to check for any occurance on
the input string.Loop unrolling is also used to gain improvements.
|
|
|
|
|
|
|
|
Indent the preprocessor directives correctly according
to the normal glibc style.
|
|
Replace bespoke code to align a value with
the ALIGN_UP macro to make it easier to read.
|
|
Developers creating development packages must take care
to have their static linker DSO link point to the actual
SONAME file. This allows ldconfig to correctly create
the required links for the SONAME. The behaviour is now
more clearly documented in a code comment added by this
patch.
|
|
This patch addresses one known caveat in the linknamespace tests: with
this patch they will now only look for definitions of symbols in
relevant libraries, meaning that librt and libpthread are not checked
for ISO C standards, XPG3 and XPG4.
In particular, this means that if __pthread_initialize_minimal is
somehow brought in for one of those standards, the definition from
libc-tls.o will be considered instead of that from libpthread, so
avoiding bringing in lots of other libpthread symbols. This should
address some of the failures reported by Carlos in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00882.html>, where
__pointer_chk_guard_local brought in __pthread_initialize_minimal.
Tested for x86_64. The removal of one XFAIL for XPG4 actually shows
up a header bug (shm_open should not be declared for XPG4 - the
namespace issue was for symbols brought in by shm_open, which is no
longer found at all now librt isn't searched; I've filed bug 17663 for
the header bug, though it would show up eventually anyway in the
course of review of conform/ data against XPG4).
Committed.
* conform/Makefile (linknamespace-symlist-stdlibs-base): New
variable.
(linknamespace-symlist-stdlibs-tests): Likewise.
(tests-special): Append $(linknamespace-symlist-stdlibs-tests)
instead of $(objpfx)symlist-stdlibs.
(linknamespace-libs-isoc): New variable.
(linknamespace-libs): Use $(linknamespace-libs-isoc).
(linknamespace-libs-ISO): New variable.
(linknamespace-libs-ISO99): Likewise.
(linknamespace-libs-ISO11): Likewise.
(linknamespace-libs-XPG3): Likewise.
(linknamespace-libs-XPG4): Likewise.
(linknamespace-libs-POSIX): Likewise.
(linknamespace-libs-UNIX98): Likewise.
(linknamespace-libs-XOPEN2K): Likewise.
(linknamespace-libs-POSIX2008): Likewise.
(linknamespace-libs-XOPEN2K8): Likewise.
($(objpfx)symlist-stdlibs): Replace by
$(linknamespace-symlist-stdlibs-tests). Use
$(linknamespace-libs-$*) as set of libraries.
($(linknamespace-header-tests)): Update dependencies. Use
$(objpfx)symlist-stdlibs-$$std for --libsyms argument.
(test-xfail-XPG4/sys/mman.h/linknamespace): Remove.
* conform/linknamespace.pl: Remove comment about considering
definitions of symbols from irrelevant libraries.
|
|
|
|
This patch changes _dl_allocate_tls_init to resize DTV if the current DTV
isn't big enough. Tested on X86-64, x32 and ia32.
[BZ #13862]
* elf/dl-tls.c: Include <atomic.h>.
(oom): Remove #ifdef SHARED/#endif.
(_dl_static_dtv, _dl_initial_dtv): Moved before ...
(_dl_resize_dtv): This. Extracted from _dl_update_slotinfo.
(_dl_allocate_tls_init): Resize DTV if the current DTV isn't
big enough.
(_dl_update_slotinfo): Call _dl_resize_dtv to resize DTV.
* nptl/Makefile (tests): Add tst-stack4.
(modules-names): Add tst-stack4mod.
($(objpfx)tst-stack4): New.
(tst-stack4mod.sos): Likewise.
($(objpfx)tst-stack4.out): Likewise.
($(tst-stack4mod.sos)): Likewise.
(clean): Likewise.
* nptl/tst-stack4.c: New file.
* nptl/tst-stack4mod.c: Likewise.
|
|
|
|
misc/tst-pselect.c uses the deprecated sigblock interface, resulting
in "tst-pselect.c:42:3: warning: 'sigblock' is deprecated (declared at
../signal/signal.h:189) [-Wdeprecated-declarations]". The choice of
sigblock rather than sigprocmask has nothing to do with what this test
is testing, so this patch changes it to use sigprocmask to avoid the
warning.
Tested for x86_64.
* misc/tst-pselect.c (do_test): Use sigprocmask instead of
sigblock.
|
|
This patch fixes a warning "variable 'wc' set but not used" in
libio/bug-ungetwc1.c.
The test didn't verify much about the results of the functions it
called. This patch makes it check the result of getwc (thereby fixing
the warning), check end of file does not arrive too late in the getwc
loop, and check EOF is no longer set after ungetwc.
Tested for x86_64.
* libio/bug-ungetwc1.c (do_test): Verify results of getwc and
feof.
|
|
This patch fixes a "set but not used" warning from
dlfcn/failtestmod.c. A variable is used only to store the return
value from dlsym. As I understand this test, the point is simply to
do a sequence of load / unload operations in a loop, and all that
matters here is that dlsym gets called and returns without crashing,
not what its return value is. So this patch removes the assignment to
a variable.
Tested for x86_64.
* dlfcn/failtestmod.c (constr): Do not store result of dlsym in a
variable.
|
|
|
|
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.
|
|
Testing for 32-bit x86 shows up warnings in
stdio-common/tst-fmemopen.c where off_t values are passed to %zu
printf formats. Since the values are in messages relating to function
calls where the relevant argument is of type size_t, it seems most
appropriate to cast explicitly to size_t when passing to printf, which
this patch does.
Tested for 32-bit x86.
* stdio-common/tst-fmemopen.c (do_test): Cast st_size values to
size_t for %zu format.
|
|
Testing for 32-bit x86 shows up a warning "tst-nss-test1.c:25:3:
warning: format '%ju' expects argument of type 'uintmax_t', but
argument 2 has type 'int' [-Wformat=]". The argument is a difference
of two pointers, a signed quantity of type ptrdiff_t for which the
right format is %td; this patch makes this test use that format.
Tested for 32-bit x86.
* nss/tst-nss-test1.c (do_test): Use %td printf format for pointer
difference, not %ju.
|
|
This patch avoids warnings for unused results of setuid and setgid in
nscd/connections.c using an ignore_value macro along the lines
suggested by Paul in
<https://sourceware.org/ml/libc-alpha/2014-11/msg00733.html>.
Tested for x86_64.
* include/libc-internal.h (ignore_value): New macro.
* nscd/connections.c (restart): Wrap calls to setuid and setgid
with ignore_value.
|
|
This patch fixes
../sysdeps/mips/__longjmp.c:27:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
which arose I think from the MIPS16 changes (renaming the function to
____longjmp with an alias __longjmp, so a prior header prototype for
__longjmp no longer sufficed to prevent a warning). I've made the
function use a prototype definition, which is what we want for all
function definitions in glibc anyway.
Tested for MIPS.
* sysdeps/mips/__longjmp.c (____longjmp): Use prototype
definition.
|
|
This patch fixes "../sysdeps/nptl/pthread.h:670:26: warning:
initialization discards 'volatile' qualifier from pointer target type"
arising when building nptl/tst-cancel-self-cancelstate.c. The problem
is passing a volatile int * to a macro expecting void *; the patch
adds an explicit cast.
Tested for x86_64.
* nptl/tst-cancel-self-cancelstate.c (do_test): Cast argument of
pthread_cleanup_push to void *.
|