This is the mail archive of the cygwin 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: Cygwin's GCC doesn't like this .sa_handler initialization for some reason


[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?

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


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