X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Tue, 27 Apr 2010 11:05:16 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Cygwin's GCC doesn't like this .sa_handler initialization for some reason Message-ID: <20100427090516.GA12365@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <20100425113232 DOT GA11541 AT sbox> <4BD5C311 DOT 2060708 AT redhat DOT com> <4BD5E165 DOT 6070907 AT gmail DOT com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4BD5E165.6070907@gmail.com> User-Agent: Mutt/1.5.20 (2009-06-14) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Apr 26 19:54, Dave Korn wrote: > On 26/04/2010 17:45, Eric Blake wrote: > > [this was originally raised on the libvirt list] > > > > On 04/25/2010 05:32 AM, Matthias Bolte wrote: > >> + struct sigaction action_stop; > >> > >> - struct sigaction action_stop = { > >> - .sa_handler = stop > >> - }; > >> + memset(&action_stop, 0, sizeof action_stop); > >> + > >> + action_stop.sa_handler = stop; > > > > This is because on Linux, sa_handler is a macro that expands into an > > access of a named member of a named union, whereas on cygwin, sa_handler > > is a directly named member of an anonymous union. Is this a gcc bug, or > > should we be changing cygwin/signal.h to follow Linux' lead of using > > macros to access named unions to allow source compatibility, since gcc > > falls flat at performing named initialization of a member of gcc's > > extension of an anonymous union? > > This is the long-standing PR10676 :-( > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=10676 > > Given the rate of progress so far, I reckon we should adopt Linux' > workaround. Hopefully we'll be able to take it back out again someday. Like this? We are already using analog definitions in the socket header files. Index: include/cygwin/signal.h =================================================================== RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/signal.h,v retrieving revision 1.18 diff -u -p -r1.18 signal.h --- include/cygwin/signal.h 26 Feb 2010 05:43:50 -0000 1.18 +++ include/cygwin/signal.h 27 Apr 2010 07:23:05 -0000 @@ -194,14 +194,16 @@ typedef void (*_sig_func_ptr)(int); struct sigaction { - __extension__ union + union { _sig_func_ptr sa_handler; /* SIG_DFL, SIG_IGN, or pointer to a function */ void (*sa_sigaction) ( int, siginfo_t *, void * ); - }; + } __sighandler_or_action; sigset_t sa_mask; int sa_flags; }; +#define sa_handler __sighandler_or_action.sa_handler +#define sa_sigaction __sighandler_or_action.sa_sigaction #define SA_NOCLDSTOP 1 /* Do not generate SIGCHLD when children stop */ Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple