bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Avoid polluting cygwin namespace.


From: Bruno Haible
Subject: Re: [PATCH] Avoid polluting cygwin namespace.
Date: Wed, 7 Apr 2010 02:04:01 +0200
User-agent: KMail/1.9.9

Eric Blake wrote:
> >    error: redefinition of typedef ‘CONTEXT’
>
> That can be worked around; here's an alternative approach:
> 
> FAULT_CONTEXT='struct _CONTEXT'
> FAULT_CONTEXT_INCLUDE='struct _CONTEXT; /* include <windows.h> to see inside 
> */'

Yes, this would fix the first problem.

> > 2) The users of libsigsegv need to access the field of the FAULT_CONTEXT.
> >    That's what it is provided for, in the first place. For example, GNU 
> > clisp
> >    does in src/spvw_sigsegv.d:
> > 
> >      stackoverflow_context_t scp = (stackoverflow_context_t) arg1;
> >      ...
> >      #if defined(WIN32_NATIVE) || defined(UNIX_CYGWIN32)
> >       #ifdef I80386
> >        if (scp) { setSTACK(STACK = (gcv_object_t*)(scp->Ebx)); }
> >       #endif
> >      #endif
> > 
> >    This would be impossible if stackoverflow_context_t was an opaque type.
> 
> If you are already using windows-specific #ifdefs, then it doesn't hurt
> to add another one in src/spvw_sigsegv.d:
> 
> #if defined WIN32_NATIVE || defined UNIX_CYGWIN32
> # include <windows.h>
> #endif

It does hurt. libsigsegv is supposed to take away a maximum of portability
problems from the user. On some platforms, you need <signal.h> to get
the type defined, or <asm/sigcontext.h>, on some others <ucontext.h>, or
maybe some <mach/*> header, etc.

And when Cygwin implements <ucontext.h>, libsisegv users should not have
to change their #include <windows.h> to #include <ucontext.h>. libsigsegv
is designed to take away that worry.

> for cygwin, it goes
> counter to the goals of cygwin of providing a Unix-y environment.  True,
> cygwin does not yet provide ucontext_t

So that is the problem, and that needs to be fixed. Cygwin requires
including <windows.h> for some services that are in the scope of POSIX.
Why would you propose to change libsigsegv because of this? It would
not solve the real problem.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]