This is the mail archive of the cygwin-patches mailing list for the Cygwin 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] make <sys/sysmacros.h> compatible with glibc


On Apr  4 01:19, Christopher Faylor wrote:
> 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.

USE_SYS_TYPES_FD_SET is 10 years old, too  ;)

> >> 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.

Apparently they have been added rather late. Per the man page the macros
existed for a long time, but the exported functions have been added only
with glibc 2.3.3.

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

This is very simple code, so I, too, would prefer to keep it inline.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


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