[adding bug-libsigsegv]

On 05/03/2011 01:55 AM, Corinna Vinschen wrote:
> Hi Reini,
> 
> 
> I have a problem with the libsigsegv package.  Right now the gawk
> maintainer started the testing cycle for the next gawk release, and the
> second time now the sigsegv.h header broke the build.
> 
> The reason for the breakage is the same each time, sigsegv.h includes
> windows.h and thus clutters the namespace with stuff unexpected by a
> POSIX application:
> 
> - The first time it was the definition of "WCHAR".
> 
> - The second time it was the definition of "small"i, which, believe it
>   or not, is defined as datatype in .
> 
> - And there's still the definition of "min", which fortunately only
>   produces a warning.
> 
> AFAICS the only reason to include windows.h is to get the definition of
> the CONTEXT type which in turn is used to typedef stackoverflow_context_t.

This is the second time this issue has come up.  I have previously
posted patches for the issue, (unfortunately, they predated the public
list archives at http://lists.gnu.org/archive/html/bug-libsigsegv/), but
that pre-dated my libsigsegv commit rights and no one else pushed them
at the time.  I'm re-attaching the patch here; any objection from other
libsigsegv maintainers on applying it?

> 
> Is it really necessary to expose this to the application?  Wouldn't it
> be better to define stackoverflow_context_t to void * for applications?
> THus we can drop the unfortunate inclusion of windows.h and not clutter
> the POSIX namespace with Windows definitions.

That's what I argued when I wrote the patch a year ago April.  Also, my
patch is available at http://repo.or.cz/w/libsigsegv/ericb.git, if Reini
would rather rebuild from there instead of the official upstream 2.10.

-- 
Eric Blake   ebl...@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
From 24266ca247b659a16aa7e2445f6a3a11144bc917 Mon Sep 17 00:00:00 2001
From: Eric Blake <ebl...@redhat.com>
Date: Tue, 6 Apr 2010 13:51:58 -0600
Subject: [PATCH] Avoid polluting cygwin namespace.

---
 ChangeLog    |    7 +++++++
 configure.ac |    7 +++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 7c6d9d6..c3441e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -125,6 +125,13 @@
        * m4/ltversion.m4: Likewise.
        * build-aux/ltmain.sh: Likewise.

+2010-04-06  Eric Blake  <ebl...@redhat.com>
+
+       Avoid polluting cygwin namespace.
+       * configure.ac (FAULT_CONTEXT_INCLUDE): Avoid including
+       <windows.h> on cygwin.
+       Reported by Corinna Vinschen, via Aharon Robbins.
+
 2010-06-04  Bruno Haible  <br...@clisp.org>

        * m4/libtool.m4: Update from libtool-2.2.8.
diff --git a/configure.ac b/configure.ac
index ce34fa1..1932042 100644
--- a/configure.ac
+++ b/configure.ac
@@ -523,8 +523,11 @@ case "$host_os" in
     CFG_FAULT=fault-win32.h # nonexistent, just a dummy
     ;;
   cygwin*)
-    FAULT_CONTEXT='CONTEXT'
-    FAULT_CONTEXT_INCLUDE='#include <windows.h>'
+    FAULT_CONTEXT='struct _CONTEXT'
+    # CONTEXT is defined in <windows.h>, but cygwin programs should not
+    # normally inspect the contents of CONTEXT, and the outright inclusion
+    # of <windows.h> pollutes the namespace.
+    FAULT_CONTEXT_INCLUDE='struct _CONTEXT;'
     # Cygwin 1.7 uses fault-posix.h. Cygwin 1.5.x needs a hacky workaround.
     if test -z "$CFG_FAULT"; then
       CFG_FAULT=fault-cygwin-old.h
-- 
1.7.4.4

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to