Don't include <bits/stdio-lock.h> from installed <libio.h>.
commitacf0cb6f249a051cf342784d4bca9558b3d1b651
authorJoseph Myers <joseph@codesourcery.com>
Thu, 3 Sep 2015 20:24:54 +0000 (3 20:24 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 3 Sep 2015 20:24:54 +0000 (3 20:24 +0000)
tree79ad8b9e511a97f2e8e3c46949104a246cb40477
parent2d8e36e691f460aeeb3362fd44c71cafc7bb5852
Don't include <bits/stdio-lock.h> from installed <libio.h>.

Every so often someone gets confused by the fact that the installed
<bits/stdio-lock.h> header includes the non-installed <lowlevellock.h>
header.

This inclusion is not in fact a bug, because <bits/stdio-lock.h> only
gets included by any header that users should include directly if
_IO_MTSAFE_IO is defined, and that's an internal define used when
building libio, not a feature test macro it's valid for users to
define.  However, on general principles it's best to have as little as
possible in the installed headers that is inapplicable for valid uses
of the installed glibc.

This patch moves the include of <bits/stdio-lock.h> to the internal
header include/libio.h, so that even if someone defines _IO_MTSAFE_IO
it won't get included.  This is intended as preparation for stopping
<bits/stdio-lock.h> and <bits/libc-lock.h> from being installed at all
(after this patch they aren't used in any installed header; formally
of course they don't need to be installed even before this patch, but
stopping them being installed before removing the #include would just
exacerbate the confusion described above), and then moving those out
of the bits/ namespace in accordance with the principle that that
namespace is only for installed headers.

The tests scanf15.c and scanf17.c avoid the internal headers; after
this patch that means they need to undefine _IO_MTSAFE_IO as well as
_LIBC so as to get a working _IO_lock_t definition for libio.h.  This
brings them closer to using the headers as an installed program would,
which clearly accords with the intent of those tests.

Tested for x86_64 (testsuite, and that installed stripped shared
libraries are unchanged by the patch).

* libio/libio.h [_IO_MTSAFE_IO]: Remove include of
<bits/stdio-lock.h> and commented-out include of <comthread.h>.
* include/libio.h [!_ISOMAC && _IO_MTSAFE_IO]: Include
<bits/stdio-lock.h>.
* stdio-common/scanf15.c (_IO_MTSAFE_IO): Undefine.
* stdio-common/scanf17.c (_IO_MTSAFE_IO): Likewise.
ChangeLog
include/libio.h
libio/libio.h
stdio-common/scanf15.c
stdio-common/scanf17.c