libc_hidden_proto in headers

Denys Vlasenko vda.linux at
Fri Jun 6 18:12:25 UTC 2008

On Friday 06 June 2008 17:41, Bernd Schmidt wrote:
> I think the transition to putting libc_hidden_proto into headers is a 
> good thing, but I'm not entirely happy about the implementation in 
> string.h: duplicating the ifdef tree and having to keep two different 
> locations in sync seems like a recipe for errors.  So, IMO we should put 
> every libc_hidden_proto next to the function declaration.
> How does the patch below look?

Looks much more sane than current situation.

> For now I've left in the unifdef step,  
> but it's probably unnecessary if we decide to go this way.

It can be useful to exclude blocks of lines in include files
when we install them, unrelated to libc_hidden_proto's.

Also it can be trivially expanded to remove, for example,
__UCLIBC_MJN3_ONLY__ blocks:

#ifdef __UCLIBC_MJN3_ONLY__
#warning "mjn3 FIXME: None of these prototypes have implementations."


#ifdef __UCLIBC_MJN3_ONLY__
#warning "mjn3 FIXME: a bunch of unimplemented function prototypes."
#  if defined __USE_XOPEN2K && defined __UCLIBC_HAS_ADVANCED_REALTIME__
/* High-resolution sleep with the specified clock.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int clock_nanosleep (clockid_t __clock_id, int __flags,
                            __const struct timespec *__req,
                            struct timespec *__rem);

/* Return clock ID for CPU-time clock.  */
extern int clock_getcpuclockid (pid_t __pid, clockid_t *__clock_id) __THROW;
#  endif
#endif /* __UCLIBC_MJN3_ONLY__ */


More information about the uClibc mailing list