From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 3AEFA3858CDA for ; Thu, 30 Mar 2023 14:09:22 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3AEFA3858CDA Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-x32d.google.com with SMTP id l37so11002145wms.2 for ; Thu, 30 Mar 2023 07:09:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680185361; x=1682777361; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=pblGikQ9xXyUmR5Lyx44XlK6S56T7WTMriML65CI86M=; b=Vvv8BF1+uYqBnXceMomcmJyFFT6HE5fhJNQOOISIz/lElMn6wELy/BA4bzBanF72SW ugLaFUG3tM6KW7O58OvUls+eg2oM7GAajGL4vuylzXCV1eJoBoeTxOn9jETmEMo2Qy9j Sw7gsOHe+bSfVHPr3yshSJxSz9i6gI1Iv3baIrppkBwgoEQ3OpbPYgSaX7eldHJkWzzn utjtFg2Bcz0gcZoyvrOhWjehCqXAHWIlwfylTBvRFeNvoZ7RJNEwwbu0IIRXDYWbg8bM YRgBgO/rlR0SR1NwZ5jQY66+Z/wNLsmIoqMmaQZKLqmaRA0DlVo360thc7x8LHmcCsgc NWHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680185361; x=1682777361; h=in-reply-to:from:content-language:references:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=pblGikQ9xXyUmR5Lyx44XlK6S56T7WTMriML65CI86M=; b=iINGe8fM3pf5MjPoGITmP/78CzMoet8wUmeCFB97fce/y4Cwu/UDR2APBdBvaIuf1j CDzLgilyJoOFFK5sCTzuR7QM0wliojk/Q8wqvuxa0sKDNYjYlvL1vIJ+fb28mZVaBdjZ TRMyZanjkEfx2Jg465AuGZgBqZ3dNZ8SIj/YTkWajBpOkkHyJx+Jqn9ATwtHz54B793/ Z6WADr7tvZloCSa0z68IW+s+uWUmjSjTaOh2i+rGTlp8mKX75YGj4sajyrKJwMSqC26S LqrX8R4yVI4ZJexMmQbglQK2mJXfpna5AqpsULgdvxY4T9YkIpe9vT9KQlj5abSvBig6 /WGA== X-Gm-Message-State: AO0yUKUyaoxRE20TXC9HtLWoTWWy+3ifWMUN5RwXj5Ty1mkm9G+aY4M2 QsqqsCpO2wrI/IJp3Yge7k6irf7colM= X-Google-Smtp-Source: AK7set8zSE0qTuQSIIryewB8hfuddSfukc58OH4EQGvx9NF/w58MU68L6FhTQNljodw3MNqZoq1f1Q== X-Received: by 2002:a1c:f013:0:b0:3ed:ac66:9445 with SMTP id a19-20020a1cf013000000b003edac669445mr18617847wmb.8.1680185360827; Thu, 30 Mar 2023 07:09:20 -0700 (PDT) Received: from [192.168.0.160] ([170.253.51.134]) by smtp.gmail.com with ESMTPSA id bd6-20020a05600c1f0600b003ef36ef3833sm6158114wmb.8.2023.03.30.07.09.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 30 Mar 2023 07:09:20 -0700 (PDT) Message-ID: <9d23a09f-31d6-17ce-5bd1-37f7035d1371@gmail.com> Date: Thu, 30 Mar 2023 16:09:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Bad interaction between signal constants and -Wsign-conversion To: Vincent Lefevre , libc-alpha@sourceware.org References: <280b4afe-d080-4be5-a296-ec914b0b5439@app.fastmail.com> <4e573abd-9ba0-e483-ab48-84e9ea98f90a@gmail.com> <20230330135911.GA2458@cventin.lip.ens-lyon.fr> Content-Language: en-US From: Alejandro Colomar In-Reply-To: <20230330135911.GA2458@cventin.lip.ens-lyon.fr> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------QaR7ZNpiqusvvRQLHuaHGv20" X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------QaR7ZNpiqusvvRQLHuaHGv20 Content-Type: multipart/mixed; boundary="------------nQh86mvolVKsNNCQUZ0XomSx"; protected-headers="v1" From: Alejandro Colomar To: Vincent Lefevre , libc-alpha@sourceware.org Message-ID: <9d23a09f-31d6-17ce-5bd1-37f7035d1371@gmail.com> Subject: Re: Bad interaction between signal constants and -Wsign-conversion References: <280b4afe-d080-4be5-a296-ec914b0b5439@app.fastmail.com> <4e573abd-9ba0-e483-ab48-84e9ea98f90a@gmail.com> <20230330135911.GA2458@cventin.lip.ens-lyon.fr> In-Reply-To: <20230330135911.GA2458@cventin.lip.ens-lyon.fr> --------------nQh86mvolVKsNNCQUZ0XomSx Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Vincent, On 3/30/23 15:59, Vincent Lefevre wrote: > On 2023-03-29 02:08:39 +0200, Alejandro Colomar via Libc-alpha wrote: > [about sa_flags in struct sigaction] >> Well, probably not doable now, but is switching to the unsigned counte= rpart >> still possible now? It would require investigating how this member is= >> being used out there, to know if we're going to break anyones code, an= d >> integer conversions are very tricky, so it's hard to know, but for a f= lags >> field that is to be used in bitwise operations, I don't expect anyone = to >> actually use it as an int, but rather as an unsigned that for historic= >> reasons happens to be signed. >> >> This is also a reminder that new such fields in structures and functio= n >> parameters should always be of unsigned types if they're going to hold= >> flags (or in general, if they're to be treated as something that requi= res >> bitwise operations). >=20 > I entirely agree. >=20 > But concerning struct sigaction in particular, shouldn't this be fixed > in POSIX? IMHO, POSIX, and in general, standards, should follow implementations rather than lead them. I think changes should start as vendor extensions. For example, timespec::tv_nsec was mandated to be long by POSIX and C11, but glibc used 'long long' in some cases, because it was necessary. I would say using 'unsigned int' here would be a nice GNU extension, and if it proves its value, POSIX could later pick it. However, as Zack said, I'm not sure how we could check if any programs out there are using this member unreasonably. Cheers, Alex --=20 GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 --------------nQh86mvolVKsNNCQUZ0XomSx-- --------------QaR7ZNpiqusvvRQLHuaHGv20 Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmQlmAgACgkQnowa+77/ 2zLZdhAAo9LyD9H1wPjSEIRpIww0lw18gO2eWXnNnWdD4HvTECOl8QRkCeMk++wW sRLbmQpvJJEnaSeGe3gvSdTfXXcmQjV5TMYfg4nrjoIssrEOxXc/6l4jTosbpRWD bE4S89svhzzRoEQCYpkR6pHf0CSeN/a0FO0VR38VMvMjI6qq7Ci0aATQf7rTYddl Bj4nNajPYwvXqbIU43m3Z4PEW8rg9T/jFQpwdLSKqzkxdpixJOO5YF3KfwvY3XLQ kufgwgexC3l+65ESsGYboPUwYd2nSzCQmM4W611Vy4TD3A32XG82VVsKJU41urm6 6bOuprygu6Az0hcfIBY51zNw0IIMaY8fG3x5/anqi1V8DJYP7bseP/wZj8UI6zWm G7tM4cLl7cFOlqXLw/+fiYdLxGxyjLr+42sYhQAPeGx7IxVPwYXByn09LzYMeSDb 47GhprPbWM5qq07LOZqtto1U1E3BuY80WS7DDeBRHwMUBc3/rc5omuWXjt04wzb7 0E1g7jB6VgG6rTJ1raNjBnvJGQy7W7e6WupudkhpPjKzj8INe2FvwouHMci53hJA N7Zmc+Fl4ThWFKGOVl5yBAg+I5B+M+pg7IhX0T5JrPCIQRcToBQNK/k4qwOzhcyJ 3XJAMSSTztKgf1EVRL1rS5GnWWdT5yyW1ie61nzOz3Jgia3HRow= =pxv9 -----END PGP SIGNATURE----- --------------QaR7ZNpiqusvvRQLHuaHGv20--