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] Add wcharP.h to hide internal wchar functions [BZ #18822]


On 12/12/2017 12:40 AM, Joseph Myers wrote:
On Mon, 11 Dec 2017, Florian Weimer wrote:

We should enhance the toolchain to do this kind of optimization automatically
(maybe using LTO?).  Or find another way to implement the markup in a more

glibc makes use of being written as "C with ABI boundaries" - that is,
code does things that are undefined in C for the program as a whole, but
defined on the basis that each separate translation unit must implement
the semantics of the functions therein in a way that would be valid for
any valid caller.  I think supporting LTO for glibc would be hard.

Certainly for some parts of the library. But not for high-level routines such as fnmatch or wcsxfrm_l.

Anyway, the point I was trying to make is that some optimizations need to happen at the compiler or linker level, otherwise the maintenance burden is too costly. Functions in the public API already need to be declared in three places in many cases, and I think it's unwise to add an arbitrary number of architecture-specific header files into the mix.

It's also not clear why you need to replicate ___atribute_pure__ in those
declarations.

Generally, an internal header can avoid repeating a function prototype
using typeof, but typeof does not copy attributes, so making an internal
declaration share the attributes of a public declaration requires
duplicating them in both places.

I thought that these attributes were cumulative, so attribute_hidden would just be added to the attributes declared in include/wchar.h for those internal aliases.

Florian


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