RFC: first stab at getting rid of libc_hidden_proto() forest

Denys Vlasenko vda.linux at googlemail.com
Sat Apr 12 17:33:37 UTC 2008


On Saturday 12 April 2008 15:36, Joakim Tjernlund wrote:
> > > Obvious solution of adding libc_hidden_proto's to .h files
> > > does not work so well since we'd like to not pollute them with
> > > machinery which doesn't belong to public interface.
> > >
> > but we could scrub public *h at install time by removing
> > all occurences of libc_hidden_proto producing a sort of
> > sanitized libc headers, in the same way kernel does.

BTW: simply removing every line which starts with "libc_hidden_proto("
string will not work so nice:

#ifdef __UCLIBC_HAS_XLOCALE__
libc_hidden_proto(__ctype_b_loc)
#elif __UCLIBC_HAS_CTYPE_TABLES__
libc_hidden_proto(__ctype_b)
#endif

will turn into

#ifdef __UCLIBC_HAS_XLOCALE__
#elif __UCLIBC_HAS_CTYPE_TABLES__
#endif

Scrubbing needs to be more clever than that.

> > > In the attached patch, I chose to create a "master include file"
> > > which includes almost all other headers; and then marks
> > > all exported functions(variables) with libc_hidden_proto.
> > > The file is called uClibc_libc.h.
> > >
> > I don't like this approach since I usually prefer explicitely
> > including all specific headers are areally need, no less, no more,
> > instead of a master include header.
> 
> yes, and development will hurt too as most of uClibc will need to rebuild
> when adding some new feature.

How ofter do you change public headers? I believe most changes go into
implementation of the libc interface, not in interface.

> > This is my opinion. I agree with you about the needs of consistently
> > using libc_hidden_proto, but I'd try to find another solution.
> > 
> > Anyway, being this a big change, I'd like to hear other opinions
> > and comment.
> > Mike, Jocke, Bernds, Peter others... what do you think ?
> 
> Scrubbing headers like Linux do is the best. There will probably be other
> things in there too that would benefit from such scrubbing.

Sounds reasonable. What method do you prefer?

#ifdef blocks with a special #define which are removed by scrubber script?
E.g.:

#ifdef UCLIBC_INTERNAL
...yadda yadda...
#endif

Magic comment? Scrubber script will just delete it and everything below
till the end of file:

/* *** UCLIBC_INTERNAL *** */
...yadda yadda...

Other method I didn't think about?
--
vda



More information about the uClibc mailing list