[PATCH] make <sys/sysmacros.h> compatible with glibc

Christopher Faylor cgf-use-the-mailinglist-please@cygwin.com
Mon Apr 4 05:22:00 GMT 2011


On Sun, Apr 03, 2011 at 07:11:51PM -0500, Yaakov (Cygwin/X) wrote:
>On Sun, 2011-04-03 at 19:55 -0400, Christopher Faylor wrote:
>> >+#define __INSIDE_CYGWIN_GNU_DEV__
>> 
>> I'd prefer a more descriptive name like "__DONT_DEFINE_INLINE_GNU_DEV" 
>
>The __INSIDE_CYGWIN_foo__ naming scheme seems to be what is used
>elsewhere for similar purposes, hence my choice here.

There is a __INSIDE_CYGWIN_NET__ which I apparently added ten years ago
but my ideas about naming have changed.  I also added
USE_SYS_TYPES_FD_SET which is closer to what I now prefer but it should
have had some leading underscores.

>> but, then again, why do these have to be exported?  Why can't they just be
>> always inlined?
>
>I just followed what I observed with glibc:
>
>$ cat test.c 
>#include <sys/types.h>
>#include <stdio.h>
>
>int
>main(void)
>{
>  int maj = 4, min = 64;	/* /dev/ttyS0 */
>  printf("%d, %d = %d\n", maj, min, makedev(maj, min));
>  return 0;
>}
>
>$ gcc -O0 test.c
>
>$ nm a.out | grep " U "
>         U __libc_start_main@@GLIBC_2.0
>         U gnu_dev_makedev@@GLIBC_2.3.3
>         U printf@@GLIBC_2.0
>
>$ gcc -O1 test.c 
>
>$ nm a.out | grep " U "
>         U __libc_start_main@@GLIBC_2.0
>         U printf@@GLIBC_2.0

Maybe the functions were added to gcc before it had the ability to force
inlining.

I'll leave it to Corinna but I'd prefer not adding YA export if we can
avoid it.

cgf



More information about the Cygwin-patches mailing list