From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 Received: from zero.zsh.org (zero.zsh.org [IPv6:2a02:898:31:0:48:4558:7a:7368]) by inbox.vuxu.org (Postfix) with ESMTP id 011162882E for ; Sat, 27 Jan 2024 07:42:30 +0100 (CET) ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1706337750; b=q0pi4VPLsfIyVPGeZgmwYLCA+2rDbVAnZzn3/YwSOQ9CF5Jkm6ptyi+IbMQLbPSrTqQdgQnp6H rAtHq1GY+UGntY6Z1JNX6GG+0Xcx/rFEz6cYQnyZZyBI6w8276BlRLTfnARfM+dkNdt586tumN hFVwUdsgB1M+5inB8J6yZsEe0lo/ryqflj17a/e2oVTLZgepDlsVnhyhXZ4LqYwjHi21S++Uv9 uIcvUCITUHcrjzNcNoekrmdipYAwIJf4rcUxsrOfsWO7Kc8owXUe/FnhHH0MvZHP4+sz0Zr1OR bj5bcQV5Uc64Nj9l0YOc4ZpYBZiccRBtutkpNc1Ot4npvQ==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (s1.jo-so.de) smtp.remote-ip=37.221.195.157; dmarc=none header.from=jo-so.de; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1706337750; bh=BpVQG7H9/7GBmdS7K0TQIQX8CC4KQGDwWKsBFn8kzkI=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:In-Reply-To:Content-Type:MIME-Version:References:Message-ID: Subject:Cc:To:From:Date:DKIM-Signature; b=OnmK9otu62VjPWNnvj/KqKiWMm3jUnEc0/HI1NCRufV/SNOTz8ZpMj9OEpAvoGDhHGIZARP6P8 BqqOmb//W5qxDqemcOjoOYWDWAiv+JHfvVDPbRUSnbs4e3Bb1CpvPyzWwvb45wtDlPmXDKSlnd kml9kiOLlwha+peE+5N2fW8E6ZT5S7WwnGKo6gr1FgwEk3xW/kc0dF62KqoRfNtJF10gYKYStM BwpYcP85JlW4lUpQEiQ0sYdaDdPSMhJM7SH8BCr8GSAxvLiaTIJ3kvSP3SxCAbYfF3sx4xnpI7 zCIy9JGeXRGaYwzVNx0ivMV/dr550JqA1F2FbVH+M1ORTg==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=G4dBnHB7qCjIXuP94ZH+zqe2vhv/6vPiQgk0cYsA8/E=; b=UgNRRzIqcwf9AjjQRmf5qJRQEU a+oTvaLXUChmH7TLhmBGHGNKvO7LC+RkT8EAQ6HVKf4FNzYI+IsU615t7Go8VA04mlZ9l1f7Qdsga Whwg+ne1/XYkugkcXtI9dY552CtJB+OtSGaFeDcD3CTcgbrXi/7mvT3KvFw4DX0PbuY593urLb/fp 8KKyVbtB0ejW/BkjY3XIUCYCt9ZEcBmrJEYngSGKKMxqK+UEDn71hJQifQuSQT/6HdjDRFQNBfTFe OKDGrrk89bRI3W+CvyVcRnJIiR7aYK/mcUBsUZWMTduhZxIZYKuhsNMYXRrl9qzreNYxbQTDXjRhn 6CPx6D1w==; Received: by zero.zsh.org with local id 1rTcOb-0001v6-5Z; Sat, 27 Jan 2024 06:42:29 +0000 Authentication-Results: zsh.org; iprev=pass (s1.jo-so.de) smtp.remote-ip=37.221.195.157; dmarc=none header.from=jo-so.de; arc=none Received: from s1.jo-so.de ([37.221.195.157]:52881) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1rTcNy-0001ZB-Pu; Sat, 27 Jan 2024 06:41:51 +0000 Received: from mail-relay (helo=jo-so.de) by s1.jo-so.de with local-bsmtp (Exim 4.96) (envelope-from ) id 1rTcNx-0056Vo-0F; Sat, 27 Jan 2024 07:41:49 +0100 Received: from joerg by zenbook.jo-so.de with local (Exim 4.97) (envelope-from ) id 1rTcNU-00000000RJT-0Wt1; Sat, 27 Jan 2024 07:41:20 +0100 Date: Sat, 27 Jan 2024 07:41:20 +0100 From: =?utf-8?B?SsO2cmc=?= Sommer To: Oliver Kiddle Cc: zsh-workers@zsh.org Subject: Re: [PATCH 2/6] lex: Mark variables with const init as const Message-ID: <4jkxcveoznwk7zps3wfnoxwo4wcjitwkfjzzynidj2p2zntwpk@uiydkr3zltjw> References: <8a1e39c6b8f061ce6d2e37c86e6d889309250f13.1704132620.git.joerg@jo-so.de> <2942-1706254789.333425@NzBz.rL2-.PsQC> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="cqvf45nj74sarhy6" Content-Disposition: inline In-Reply-To: <2942-1706254789.333425@NzBz.rL2-.PsQC> X-Seq: 52504 Archived-At: X-Loop: zsh-workers@zsh.org Errors-To: zsh-workers-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-workers-request@zsh.org X-no-archive: yes List-Id: List-Help: , List-Subscribe: , List-Unsubscribe: , List-Post: List-Owner: List-Archive: --cqvf45nj74sarhy6 Content-Type: text/plain; protected-headers=v1; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Subject: Re: [PATCH 2/6] lex: Mark variables with const init as const MIME-Version: 1.0 Oliver Kiddle schrieb am Fr 26. Jan, 08:39 (+0100): > On 1 Jan, J=F6rg Sommer wrote: > > Because these variables are initialized with as constant string, they s= hould > > be marked as *const* to make the compiler running with `-Wwrite-strings` > > more happy. >=20 > Applying this patch series causes a couple of fresh warnings: >=20 > zle_thingy.c: In function 'bin_zle_refresh': > zle_thingy.c:420:15: warning: initialization discards 'const' qualifier f= rom pointer target type [-Wdiscarded-qualifiers] > 420 | char *s =3D statusline; > | >=20 > lex.c: In function 'exalias': > lex.c:1964:20: warning: assignment discards 'const' qualifier from pointe= r target type [-Wdiscarded-qualifiers] > 1964 | zshlextext =3D tokstrings[tok]; > | >=20 > clang describes these as "initializing 'char *' with an expression of > type 'const char *' discards qualifiers > [-Wincompatible-pointer-types-discards-qualifiers]". Yes, it's a kind of chicken egg problem. Either it gets a really big patch or you have steps that introduce new warnings and solve them with later patches. I don't know what you prefer for review. > I have no objection to adding const in more places where possible. You may > find we have code that is not really modifying its parameter but relies on > being able to temporarily swap a nul in for a character as part of > parsing. Unfortunately, in the sense of *const* this is a modification. And I think I saw a function that expects to have modifiable memory, if it contains a separator character. If it not, because its not user input and hence pre-splitted, it doesn't modify the memory (and is const). Sorry, I don't remember the name after that time. My main question is how this patch set should be organized? One commit per file which reduces the number of warnings in this file to the cost of new warnings in other files? Regards J=F6rg --=20 Wenn du nur einen Hammer hast, sieht jedes Problem aus wie ein Nagel. --cqvf45nj74sarhy6 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iJMEAREIADsWIQS1pYxd0T/67YejVyF9LJoj0a6jdQUCZbSljh0YaHR0cHM6Ly9q by1zby5kZS9wZ3Ata2V5LnR4dAAKCRB9LJoj0a6jdSFZAP9fNxSDLTF9yPN/pG3K hgdxyLBta8rMyj55FRlOyEsL2wD+L0Ft6lmveaq7//kEZzOGJ50rPd7/bTpT6ESq EwLfMsQ= =EasE -----END PGP SIGNATURE----- --cqvf45nj74sarhy6--