From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: tpeplt Newsgroups: gmane.emacs.help Subject: Re: On byte compilation Date: Mon, 18 Sep 2023 15:07:36 -0400 Message-ID: <87bkdz2tc7.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24059"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Petteri Hintsanen Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 18 21:08:17 2023 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qiJbV-00063z-17 for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 18 Sep 2023 21:08:17 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qiJaw-0003zu-P9; Mon, 18 Sep 2023 15:07:42 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qiJav-0003yp-7t for help-gnu-emacs@gnu.org; Mon, 18 Sep 2023 15:07:41 -0400 Original-Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qiJat-0000k1-Et for help-gnu-emacs@gnu.org; Mon, 18 Sep 2023 15:07:40 -0400 Original-Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-76dc7b0da9fso294406285a.1 for ; Mon, 18 Sep 2023 12:07:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1695064058; x=1695668858; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=SxfF4Y0Vqg9FzqpAPJ7RAU/XsK6QRrZfqDZS7zjBzEg=; b=ksPODrm/Jja39uRDD3sceiS2Dyq6EZZaoIlVOtRURDrXsYStDHRppe68zrsUWAdY59 C5lTFv1h7mNC7aY0XQf5Hkk/lUpI1PvRxyCBMYJP4gRn7tYLDB3BuO2BCcUrFfTtFivt dGktAly7T1f85Woo/jl3MCLpZgmmiiPsfz5arh7BWQU+zvOBDhzGPga31IYaQXoLfPFy 3bBL5XiLxFu33rQNTBa34Uvhx/+Vd4rKHBwnsXghBFYiypB5MBwlzvnYcqn+RLyiyKmF jRfJ4KY0vvyYNXZcQPq0zcvCTGOGUGsrNiKvOKSQ/b28RiPglW6df/CC19fNZtv1gIC4 08vw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695064058; x=1695668858; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SxfF4Y0Vqg9FzqpAPJ7RAU/XsK6QRrZfqDZS7zjBzEg=; b=u1+uXawF+VBi1JZd0x0wIivzoxJY3cyQHh0pYyLH0S1rYymQlEU0ZAut/0WShKlFTN bC01x7ElaV86LXddH+F6QBxVnWxWKBMvrE+WeNxpKPkZtmmXiMUc0QeeRVGPvKGT9DOM 8DJGw8i7vpdodynch3voP4ZPKPkzGi+SLmb73GfCFgCxctaHONOZxTAl8/fBy9FyUN4T TFum0Qo3CA0+KoCKv7UQj6KVK1NCVHT7RkGaOHsePoA7XhIkzA7iPUU9+clBHzUPsJEq yBKnCkjyanwpqW2zEm7Tgiao56+foltv9SkTBYNHTcgdg8tGQk2+jWl+ZxaIdY+hg2hx 92Ag== X-Gm-Message-State: AOJu0YygknmiuxQjz97k9GT3yJFGA7daU4BUiJ4JxiL9/SWEwhk6Y8yD tY0iFOKyK5lBqd+nnDAHEIo= X-Google-Smtp-Source: AGHT+IGmH7dfeSr8kcBPcfLDTSeL+c2IVJU657XLeollycfwOSAMaadfdftpCPwIe+DamkopNa67jQ== X-Received: by 2002:a05:620a:22ad:b0:76d:52a:c93b with SMTP id p13-20020a05620a22ad00b0076d052ac93bmr7336798qkh.73.1695064057913; Mon, 18 Sep 2023 12:07:37 -0700 (PDT) Original-Received: from t530.local ([2600:8806:a821:2b00::b9d0]) by smtp.gmail.com with ESMTPSA id d8-20020a05620a166800b0076ceb5eb309sm3351164qko.74.2023.09.18.12.07.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 12:07:37 -0700 (PDT) In-Reply-To: (Petteri Hintsanen's message of "Sun, 17 Sep 2023 21:32:32 +0300") Received-SPF: pass client-ip=2607:f8b0:4864:20::736; envelope-from=tpeplt@gmail.com; helo=mail-qk1-x736.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:145138 Archived-At: Petteri Hintsanen writes: > Hello, > > I'm converting some old code to use new bindat-type introduced in > Emacs=C2=A028.1. I'd like to keep the legacy forms for backwards > compatibility with older emacsen. But there is a problem with byte > compilation. > > Toy example: > > (defconst foo-bindat-spec > (eval-when-compile > (if (fboundp 'bindat-type) > (bindat-type ;; new form > (id uint 32)) > '((id u32)))) ;; legacy form > "Bindat spec for foo.") > > What I try to accomplish here is to assign to foo-bindat-spec either the > result of (bindat-type ...) or list '((id u32)), depending on whether > bindat-type macro is available or not. However, Emacs' 27.2 byte > compiler complains: > > foo.el:5:14:Warning: reference to free variable =E2=80=98uint=E2=80=99 > Emacs 28.2 reports this, also. Did you mean 28.2 instead of 27.2? =E2=80=98uint=E2=80=99 is a symbol rather than a variable, according to the documentation in the elisp info manual: (elisp)"Bindat Types". So, it is good that the compiler is warning you. You would get the same warning if you used: (id uintr 32) or (id str 32) or (id strz 32) or (id vec 32),... The identifier =E2=80=98uint=E2=80=99 needs to be quoted: (id 'uint 32) or alternatively, (id (quote uint) 32), if that is clearer to you. (type-of uint) =3D> error, void variable (type-of 'uint) =3D> symbol Also, if you have not read it or haven=E2=80=99t read it recently, here is = the node in the elisp manual for Eval During Compile: (elisp) Eval During Compile --