From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16734 invoked from network); 11 Nov 2021 11:07:10 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 11 Nov 2021 11:07:10 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1636628830; b=I31SHDFxeXY6cJ+ScZ/iMj2f/Bqryp82iCg5uIBv/e2AoGKyUeOtLZzYlveejXTBKNTFADKnhS K1eQiC1Eg0hfkfrBPY7Srr7V+hTMfbwKZz2vfscMvNmqyxcEaWMcuAttfvz8H5j/Hv0Elyme85 4plJeicn60UOWJkddd/R8i1lGnDy1/RCEAOhsZqOK6AECFNzPuwwhC9FDlfb0t+uCQ4lsnqxiO 2R3xvxFjFSru0gZOENXUsmFqNrqIKAvo6rBDSEiEOQ+vGgUOQzfkc7kn73rsg9kLCyypyR0O95 VlTgsznl/HF5JNwzp5lfEpcqT7MH05Lcn4Zl9I4H/GsnCA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (snd01001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.17; dmarc=none header.from=kba.biglobe.ne.jp; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1636628830; bh=0zW/zydzSm2Yq0AeMvI2GgLyRn8I8Xuv2D1Z6I67Qss=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Message-ID:In-Reply-To:To:References:Date:Subject: MIME-Version:Content-Transfer-Encoding:Content-Type:From:DKIM-Signature; b=qS1VjD1Vr22mJlzHg9LODdPnys8jeS8L9/8yFDOfwnNtbt3ouP77ohjbqjIa8vr2Cl/Up0ItJY i/f8UVVV8avu4zoemx06WHwmhx3kgSHXGO6ESuzQXZk8JmPz3uTCpKMWxzGWMxDDakaw1Uak0I WIaP8+1buCF6efM/X+1jVe6kfnj3vwmF45ZQiZyZd0Gx7K7N0ZbYXTb1FpifG7UEkXsOPSMw8p bZQsiiSuND9ckllTCgwnUgUoh5T+PX6FeGpwYn77mxWQAbRsr6BroJM5pU5V9r9Cf3RglxKXLC w7H61Dn9wwFz+5mVlwHBZwzbhXKkWcHF3bRrKtXPh5O6Ng==; 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:Message-Id:In-Reply-To:To:References: Date:Subject:Mime-Version:Content-Transfer-Encoding:Content-Type:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=8xsmc7REmd7sRiikWW+TzHZHQL9Sq0dc8Kf5m2PNEQo=; b=lBZrLb0AEAleeZ87Lv3ep5wOEc V8jqVBTnYPiAly1XfG8yZTWXg0lsKxBu8jebPrAjVyc3CW7RNtNIqqBPYiEqE+DHUqHRfuFDh8CdQ czdpldoP3IUMdpt1JuE4FDNPntt/cdQRAXU6GLJZJ0XpsILLPt02j/EMvtHJI5AgWO3rlfXdHu6nD afmcwCrIOxkPcQsYCilcjYLGqyst0ANVhNHVJNLlQXZLoFgZrTbW5Y8cdwVX31crt0m8TF9tc0z4g 57NP1kH+fPO5ODQTfPQlThFd4xCESnEOJa0NFgBGAooJpA91zBx3AZfjNA0JzrRk+O0ISb53BfIfj EejXDXbw==; Received: from authenticated user by zero.zsh.org with local id 1ml7vA-000KPs-61; Thu, 11 Nov 2021 11:07:08 +0000 Authentication-Results: zsh.org; iprev=pass (snd01001-bg.im.kddi.ne.jp) smtp.remote-ip=27.86.113.17; dmarc=none header.from=kba.biglobe.ne.jp; arc=none Received: from snd01001-bg.im.kddi.ne.jp ([27.86.113.17]:11819 helo=dfmta1012.biglobe.ne.jp) by zero.zsh.org with esmtps (TLS1.3:TLS_AES_256_GCM_SHA384:256) id 1ml7uo-000K8d-4O; Thu, 11 Nov 2021 11:06:48 +0000 Received: from mail.biglobe.ne.jp by omta1012.biglobe.ne.jp with ESMTP id <20211111110639902.DPWW.32237.mail.biglobe.ne.jp@biglobe.ne.jp> for ; Thu, 11 Nov 2021 20:06:39 +0900 From: Jun T Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Subject: Re: PATCH: separate watch/log functionality out into a module Date: Thu, 11 Nov 2021 20:06:39 +0900 References: <41833-1635545739.955327@NiDy.UqMC.wWcd> To: zsh-workers@zsh.org In-Reply-To: <41833-1635545739.955327@NiDy.UqMC.wWcd> Message-Id: X-Mailer: Apple Mail (2.3445.104.21) X-Biglobe-Sender: takimoto-j@kba.biglobe.ne.jp X-Seq: 49563 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: > 2021/10/30 7:15, Oliver Kiddle wrote: >=20 > This patch extracts the functionality out into a zsh/watch module. With this patch (either with or without the one in worker/49544=E2=81=A9),= build fails on Cygwin as follows: gcc -c ...(snip)... -o watch..o watch.c In file included from ../../Src/zsh.mdh:16, from watch.mdh:15, from watch.c:30: ../../Src/zsh.h:2097:34: error: initializer element is not constant 2097 | { name, flags, (void *) var, (void *) gsu, \ | ^ watch.c:643:5: note: in expansion of macro =E2=80=98PARAMDEF=E2=80=99 643 | PARAMDEF("WATCH", PM_SCALAR|PM_SPECIAL, &watch, = &colonarr_gsu), | ^~~~~~~~ (and the same error for &vararray_gsu) On Cygwin, params.o (in which colonarr_gsu is defined) is not included = in the main zsh.exe but in libzsh.dll (I don't know why). This means &colonarr_gsu is not a build-time constant and can't be used for the initialization of the static variable partab[]. A simple workaround is to set the .gsu in the setup_() function. This takes virtually no time to execute and I think we don't need to use #ifdef __CYGWIN__. diff --git a/Src/Modules/watch.c b/Src/Modules/watch.c index 5ce604c63..1c2766dda 100644 --- a/Src/Modules/watch.c +++ b/Src/Modules/watch.c @@ -640,8 +640,8 @@ static struct builtin bintab[] =3D { }; =20 static struct paramdef partab[] =3D { - PARAMDEF("WATCH", PM_SCALAR|PM_SPECIAL, &watch, &colonarr_gsu), - PARAMDEF("watch", PM_ARRAY|PM_SPECIAL, &watch, &vararray_gsu), + PARAMDEF("WATCH", PM_SCALAR|PM_SPECIAL, &watch, NULL), + PARAMDEF("watch", PM_ARRAY|PM_SPECIAL, &watch, NULL), }; =20 static struct features module_features =3D { @@ -656,6 +656,10 @@ static struct features module_features =3D { int setup_(UNUSED(Module m)) { + /* On Cygwin, colonarr_gsu exists in libzsh.dll and we can't + * use &colonarr_gsu in the initialization of bintab[] above */ + partab[0].gsu =3D (void *)&colonarr_gsu; + partab[1].gsu =3D (void *)&vararray_gsu; return 0; } =20