This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 17/19] Provide default definition for IS_IN when _LIBC is not defined


On Fri, 22 Aug 2014, Roland McGrath wrote:

> Please explain this more.  There must be on appearances of IS_IN or
> anything like that in actual installed headers.  So I guess you are
> talking about include/ wrappers for headers that will be installed.
> But still I don't understand under what conditions any of this code
> is used where _LIBC is not defined.  Is it just in tests?

bits/stdio-lock.h, as changed by this patch,

(a) is installed;

(b) includes the non-installed header <lowlevellock.h> (at least);

(c) is not namespace-clean;

(d) only actually gets included by libio.h if _IO_MTSAFE_IO is defined, 
which is not the case for any valid use of installed libc, so this doesn't 
cause any user-visible bugs.

Of course that should still be cleaned up.  A clean state would, as far as 
possible, not have the installed libio.h containing any code (such as 
_IO_MTSAFE_IO conditionals) that's not relevant for users of installed 
libc; that would go in include/libio.h instead.  It would not have 
bits/stdio-lock.h installed, since it's not actually used in installed 
headers.  That header would have a name that doesn't involve bits/, 
following the rule that bits/ headers are installed headers (see bug 
14912).

And it's doubtful if _IO_MTSAFE_IO (or _LIBC_REENTRANT) conditionals are 
needed at all - maybe the code should just assume it's true (outside 
installed headers, with the conditionals in installed headers having been 
moved to include/).  (I'd think it would be better for any single-thread 
ports to work via macros that expand to do nothing, rather than having 
_IO_MTSAFE_IO or _LIBC_REENTRANT conditionals on calls to those macros.)

(Before removing such conditionals, make sure the macro in question is 
actually defined for the source file in question - _IO_MTSAFE_IO isn't 
defined globally, but by lots of separate makefile references to 
$(libio-mtsafe).)

libio also has lots of _LIBC conditionals that are probably relics of when 
it was used in libstdc++.  In general such conditionals are unnecessary in 
files that are neither installed nor shared with other projects.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]