delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/06/08/13:43:33

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=nyk3qXQpcVsZvIUH
Il9PnPmDBxbM3gZaJOuq336KNxWmTesmiMYOREDsA+WDM1KLUuK//kiOHaMG4dew
jATTVH1NjD0fFm9AFGMN40Mp2F94BelzUq4YWEvY+2Cwrt2N8flm+zZWm+j/z2Pl
+DXmLicgSeHlrMbncpP8RlqYkoI=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=1H9ID13QUltQJCoXI0TN9h
yYXSY=; b=Aoj1K6NB6E0haHGNtXhyW7hbSDCEY7fNz7nnSTiJ++hFcPBK0xMJby
Zb/Wr5Zy7H5AZMff10UDUeKBIYY5EXru6KwkFH6hK/hxXTHuhB+BW97szv9vPZTk
QW1MxPPuNPlVTuA8tW7ix4f9JWj+xPdavEP3BThjzOPKI2N/Wh53o=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=continued, claims
X-HELO: mx1.redhat.com
Subject: Re: [Bug] __wait_status_to_int() is expected to be a macro
To: cygwin AT cygwin DOT com, denis DOT nikif AT gmail DOT com
References: <CA+fF77nK6EUSWe_jxnQpEcOBiX-+uTxhh4vwT86swiybMcxB2A AT mail DOT gmail DOT com> <0ec2d4a0-07e7-1c04-4efc-dbd0a21c077e AT t-online DOT de>
From: Eric Blake <eblake AT redhat DOT com>
Message-ID: <636aef6d-c47f-ee0e-52c5-db4976452c18@redhat.com>
Date: Fri, 8 Jun 2018 12:43:19 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0
MIME-Version: 1.0
In-Reply-To: <0ec2d4a0-07e7-1c04-4efc-dbd0a21c077e@t-online.de>
X-IsSubscribed: yes

On 06/08/2018 12:26 PM, Hans-Bernhard Bröker wrote:
> Am 08.06.2018 um 17:16 schrieb Denis Nikiforov:
>> /usr/include/boost/process/detail/posix/is_running.hpp:18:1: error:
>> non-constant condition for static assertion
>>   static_assert(!WIFEXITED(still_active), "Internal Error");
>>   ^~~~~~~~~~~~~
>>
>> __wait_status_to_int must be a macros but it's redefined as a function.
> 
> It must?  Says who, based on what standard document?
> 
> For starters, nobody gets to make any such claims about 
> __wait_status_to_int(), because that's an internal implementation detail 
> of Cygwin.  If at all, such a claim might be made about WIFEXITED(), 
> which is a POSIX standard element.  But POSIX makes no such requirement, 
> as far as I could see on short examination.

POSIX requires:

http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html#tag_13_71

"The <sys/wait.h> header shall define the following macros for analysis 
of process status values:

WEXITSTATUS
     Return exit status.
WIFCONTINUED
     [XSI] [Option Start] True if child has been continued. [Option End]
WIFEXITED
     True if child exited normally.
..."

and:

http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html

"Regardless of its value, this information may be interpreted using the 
following macros, which are defined in <sys/wait.h> and evaluate to 
integral expressions; the stat_val argument is the integer value pointed 
to by stat_loc.

WIFEXITED(stat_val)
     Evaluates to a non-zero value if status was returned for a child 
process that terminated normally.
WEXITSTATUS(stat_val)"


Nothing in that wording requires WIFEXITED(foo) to be a compile-time 
constant if foo is also a compile-time constant, so on that grounds, 
Boost is buggy for trying to assume that WIFEXITED(constant) can be used 
in a static_assert().  On the other hand, the implementation of 
WIFEXITED() is more like Linux if it DOES result in a compile-time 
constant when used on a compile-time constant argument; so in that 
regards, it would ALSO be worth patching Cygwin, whether or not the 
Boost portability bug is fixed.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019