delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/06/12/04:49:01

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:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=VBQE4QbBNNa9HZcEHfhhvdFGOK3n9EZqNiC01iiuPpA+yi8b5rxyj
G0F8BRaZ4i8pLZKqowXkzwVRbH7tvACWtiSPkMw56i6W7ZwmX+Pbmzs1p47/sKrr
2wnNsxYb14JoEjioKZsqYKvTGSveA5IpP84VQeCeCWW8hzR9fIoDdc=
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:date:from:to:cc:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=BLfSDCKNIXLWI0+j/z0RT6W012A=; b=UWTH6AwvO0Si7aIjuvzXifpVAEVH
GvGiFeNmH2cPYA/5XEZ/fvI5u2xdEY5WZMytOE7oexalqsuWPvBR8X83mVLkwp6l
H85Gn8lTnrIGEaf5mp9Kg6upP9uHD/JS0ZXQR7Gd0xdkqzRDsmOkH/hG1rKRn+wX
cjI/BAIKwLzGdYg=
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=-101.8 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=08062018, Hx-languages-length:3019, Hat, claims
X-HELO: mout.kundenserver.de
Date: Tue, 12 Jun 2018 10:48:43 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Cc: denis DOT nikif AT gmail DOT com
Subject: Re: [Bug] __wait_status_to_int() is expected to be a macro
Message-ID: <20180612084843.GO7851@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-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> <636aef6d-c47f-ee0e-52c5-db4976452c18 AT redhat DOT com>
MIME-Version: 1.0
In-Reply-To: <636aef6d-c47f-ee0e-52c5-db4976452c18@redhat.com>
User-Agent: Mutt/1.9.2 (2017-12-15)

--Nq2Wo0NMKNjxTN9z
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jun  8 12:43, Eric Blake wrote:
> On 06/08/2018 12:26 PM, Hans-Bernhard Br=C3=B6ker 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
> > > =C2=A0 static_assert(!WIFEXITED(still_active), "Internal Error");
> > > =C2=A0 ^~~~~~~~~~~~~
> > >=20
> > > __wait_status_to_int must be a macros but it's redefined as a functio=
n.

I don't know the surrounding code, but in how for does this make
sense at all?  This expression is never static, afaics:

  int status;
  wait (&status);
  WIFEXITED(status);

The sense of the above expression with a constant "still_active" is
somehow beyond me.

And this has nothing to do with macro vs. inline function, nor ...

> > It must?=C2=A0 Says who, based on what standard document?
> >=20
> > For starters, nobody gets to make any such claims about
> > __wait_status_to_int(), because that's an internal implementation detail
> > of Cygwin.=C2=A0 If at all, such a claim might be made about WIFEXITED(=
),
> > which is a POSIX standard element.=C2=A0 But POSIX makes no such requir=
ement,
> > as far as I could see on short examination.
>=20
> POSIX requires:
>=20
> http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_wait.h.html#=
tag_13_71
>=20
> "The <sys/wait.h> header shall define the following macros for analysis of
> process status values:
>=20
> WEXITSTATUS
>     Return exit status.
> WIFCONTINUED
>     [XSI] [Option Start] True if child has been continued. [Option End]
> WIFEXITED
>     True if child exited normally.
> ..."
>=20
> and:
>=20
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/waitpid.html
>=20
> "Regardless of its value, this information may be interpreted using the
> following macros, which are defined in <sys/wait.h> and evaluate to integ=
ral
> expressions; the stat_val argument is the integer value pointed to by
> stat_loc.
>=20
> WIFEXITED(stat_val)
>     Evaluates to a non-zero value if status was returned for a child proc=
ess
> that terminated normally.
> WEXITSTATUS(stat_val)"
>=20
>=20
> 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.

...with Cygwin vs. Linux.

But, assuming I'm completely off-track above and a macro is really
desired:

Defining __wait_status_to_int as function is C++-specific.  I don't think
this is really required.  A quick test implies the C macro definition in
sys/wait.h is sufficent for C++ as well.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--Nq2Wo0NMKNjxTN9z
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlsfiOsACgkQ9TYGna5E
T6AvaQ/9HvcDa4KeKDWsaM+x+a1wXfEZCG2iEhXDXkBh4I8NLU6dHWT2G+XKX3PD
wrWnwoyckoFLDTXZGQ3PXkmIZI/M1clbpfXV2GuAozIi8h7dzpsR3ZB1d0QTLtor
tGpA+N6lDkshJD5hM9MmL3RfzyMtwslIJZOyqJqodvscSAWMC5K3hoMQKzCJpUfc
8s+/L0leRERet/0W8AtSK9RQjY+SYJjOZFpmxhtv6/py0AX6QNQp5jI1/pWkTXh5
bHuKVS5ouLb4ZO374IvtdXpQ4J/h+6ZIiMo3s1eICUvIV8OluABz2PBYpJpV3PXW
2KcLqZJbiFPRb7wIxA5SmCt31pBZdwXN52HZkiOCdOh9aecnMiXbGHWn1hEX2VUv
zh0Kfa7s70XKZYX6ER1UALJATCzAouHd5NQwK8fV1gKIkdQtK3lc5FTnZglT3R4n
63uhhpSmpvjJycygENjah8BRfAM2rG4wdswOWpSzVvGk4QlmTkNeHz9/OQAi5lpR
uUIDdJrDTfaSmcU+KUWT/K4QcJYK+BQK+mamySQdRAcBqkYeZYBJmR8xy6p61Vbw
uJedrFvu4KWMqxYeGnwJDZBbLv+hgWsNuUI6DCIfl++JWcvAPkki9EFZMoB/w8wB
BchTkGF1srj7H1oNeBJ3ZRReW0DxPL2b/KCkFE2OuDsPBwAPhmE=
=yCBN
-----END PGP SIGNATURE-----

--Nq2Wo0NMKNjxTN9z--

- Raw text -


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