This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
Re: [PATCH 64bit] Export <io.h> symbols with underscore
On Feb 22 10:27, Christopher Faylor wrote:
> On Fri, Feb 22, 2013 at 03:44:48PM +0100, Corinna Vinschen wrote:
> >On Feb 22 09:32, Christopher Faylor wrote:
> >> On Fri, Feb 22, 2013 at 11:02:55AM +0100, Corinna Vinschen wrote:
> >> >On Feb 22 10:51, Corinna Vinschen wrote:
> >> >> On Feb 22 03:40, Yaakov wrote:
> >> >> > On Fri, 22 Feb 2013 09:49:51 +0100, Corinna Vinschen wrote:
> >> >> > > > access should go, no doubt about it.
> >> >> > > >
> >> >> > > > For get_osfhandle and setmode I would prefer maintaining backward
> >> >> > > > compatibility with existing applications. Both variations, with and
> >> >> > > > without underscore are definitely in use.
> >> >> > > >
> >> >> > > > What about exporting the underscored variants only, but define the
> >> >> > > > non-underscored ones:
> >> >> > > >
> >> >> > > > extern long _get_osfhandle(int);
> >> >> > > > #define get_osfhandle(i) _get_osfhandle(i)
> >> >> > > >
> >> >> > > > extern int _setmode (int __fd, int __mode);
> >> >> > > > #define setmode(f,m) _setmode((f),(m))
> >> >> > >
> >> >> > > Just to be clear: On 32 bit we should keep the exported symbols, too.
> >> >> > > On 64 bit we can drop the non-underscored ones (which just requires
> >> >> > > to rebuild gawk for me) and only keep the defines for backward
> >> >> > > compatibility.
> >> >> >
> >> >> > Like this?
> >> >>
> >> >> Almost. The _setmode needs a tweak, too. I also think it makes
> >> >> sense to rename the functions inside of syscalls.cc:
> >> >> [...]
> >> >
> >> >I applied this patch to the 64 bit branch for now.
> >>
> >> I was actually expecting that we'd break the compilation of existing
> >> applications which incorrectly referenced get_osfhandle and setmode (I
> >> have a couple of those). It's a simple fix if someone recompiles and
> >> it wouldn't be the first time that you'd have to make a source code
> >> change when upreving to a new "OS". For 32-bit we would need to keep
> >> both in cygwin.din though, of course.
> >
> >I'm trying to keep up with backward compatibility on the source level
> >as far as it makes sense (for a given value of "sense").
>
> Yeah, but I worry about carrying cruft like this around forever. I know
> it's a mile pain for the person who copmiles programs but it shouldn't
> be that big a deal to add an underscore.
Alternatively, we We keep exporting the unloved symbols and add an
__attribute__ ((deprecated)) in the header, as we did for
cygwin_conv_to_win32_path and friends.
> >> But, if you're going to use defines, why not just simplify them as:
> >>
> >> #define get_osfhandle _get_osfhandle
> >> #define setmode _setmode
> >
> >I can do that, but I thought error messages would be more meaningful
> >when using macros with arguments. Dunno, I was just trying to do
> >it right. Shall I still simplify them?
>
> I don't know. If you use your method and say, for example setmode(x)
> you'll get an error about a macro lacking arguments. If you said
> setmode ((char *) foo) you'd get an error about the '_setmode' function.
> If you defined the macro without arguments you'd get a compiler error
> referencing '_setmode' in both cases. I guess I'd want this to be
> consistent but I don't really care that much.
Me neither. I can define them just by name, but that depends on the
above decision.
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Maintainer cygwin AT cygwin DOT com
Red Hat