bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62889: 29.0.60; (setopt ...) does not give "assignment to free varia


From: Philip Kaludercic
Subject: bug#62889: 29.0.60; (setopt ...) does not give "assignment to free variable" warning
Date: Tue, 18 Apr 2023 06:18:55 +0000

ar0x2ff@gmail.com writes:

> If I open emacs -q and write the following code in a Emacs Lisp buffer:
>
> ;;; init.el --- summary
>
> ;;; Commentary:
>
> ;;; Code:
>
> (setq var1 2)
> (customize-set-variable var2 2)
> (setopt var3 2)
>
> (provide 'init)
> ;;; init.el ends here
>
> I'll get the following errors, if i enable FlyMake:
>
> 7   6 warning  e-f-b-c  assignment to free variable ‘var1’
> 8  24 warning  e-f-b-c  reference to free variable ‘var2’
>
> Why setopt is not underlined here? I know it's a new macro introduced in 
> Emacs 
> 29 but I wonder if it is intended to be like this or the linter is just 
> misbehaving here.

var2 should also not be highlighted, since the first argument to the
function `customize-set-variable' is a symbol, and the byte compiler
correctly states that it doesn't know that any variable "var2" will be
defined.

If you macroexpand setopt, you will see that it generates

  (setopt--set 'var3 2)

which is all fine, since no functions are being invoked with undefined
variables.

The reason this makes sense is that not all user options have to be
loaded when they are set.  A number of them are even auto-loaded and
will load the library for the necessary user-option setters if
necessary.

> In GNU Emacs 29.0.60 (build 1, x86_64-redhat-linux-gnu, GTK+ Version
>  3.24.37, cairo version 1.17.6) of 2023-03-14 built on
>  2cafab91c998469c95c4917f66b01a98
> System Description: Fedora Linux 37 (Thirty Seven)
>
> Configured using:
>  'configure --build=x86_64-redhat-linux-gnu
>  --host=x86_64-redhat-linux-gnu --program-prefix=
>  --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr
>  --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc
>  --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64
>  --libexecdir=/usr/libexec --localstatedir=/var
>  --sharedstatedir=/var/lib --mandir=/usr/share/man
>  --infodir=/usr/share/info --with-dbus --with-gif --with-jpeg --with-png
>  --with-rsvg --with-tiff --with-xft --with-xpm --with-gpm=no
>  --with-xwidgets --with-modules --with-harfbuzz --with-cairo --with-json
>  --with-pgtk --with-native-compilation --enable-link-time-optimization
>  build_alias=x86_64-redhat-linux-gnu host_alias=x86_64-redhat-linux-gnu
>  CC=gcc 'CFLAGS=-DMAIL_USE_LOCKF -O2 -flto=auto -ffat-lto-objects
>  -fexceptions -g -grecord-gcc-switches -pipe -Wall
>  -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2
>  -Wp,-D_GLIBCXX_ASSERTIONS
>  -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
>  -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
>  -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection'
>  LDFLAGS=-Wl,-z,relro
>  PKG_CONFIG_PATH=:/usr/lib64/pkgconfig:/usr/share/pkgconfig CXX=g++
>  'CXXFLAGS=-O2 -flto=auto -ffat-lto-objects -fexceptions -g
>  -grecord-gcc-switches -pipe -Wall -Werror=format-security
>  -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS
>  -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong
>  -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic
>  -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection''
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
> LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
> INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF
> TOOLKIT_SCROLL_BARS XIM XWIDGETS GTK3 ZLIB
>
> Important settings:
>   value of $LANG: it_IT.UTF-8
>   locale-coding-system: utf-8-unix
>
> Major mode: ELisp/d
>
> Minor modes in effect:
>   flymake-mode: t
>   tooltip-mode: t
>   global-eldoc-mode: t
>   eldoc-mode: t
>   show-paren-mode: t
>   electric-indent-mode: t
>   mouse-wheel-mode: t
>   tool-bar-mode: t
>   menu-bar-mode: t
>   file-name-shadow-mode: t
>   global-font-lock-mode: t
>   font-lock-mode: t
>   blink-cursor-mode: t
>   line-number-mode: t
>   indent-tabs-mode: t
>   transient-mark-mode: t
>   auto-composition-mode: t
>   auto-encryption-mode: t
>   auto-compression-mode: t
>
> Load-path shadows:
> /usr/share/emacs/site-lisp/lilypond-init hides /usr/share/emacs/site-lisp/
> site-start.d/lilypond-init
>
> Features:
> (shadow sort mail-extr emacsbug message mailcap yank-media puny dired
> dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068
> epg-config gnus-util mm-decode mm-bodies mm-encode mail-parse rfc2231
> mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
> mm-util mail-prsvr mail-utils noutline outline checkdoc lisp-mnt
> flymake-proc flymake project byte-opt compile text-property-search
> comint ansi-osc ansi-color ring thingatpt time-date cl-loaddefs comp
> comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode
> bytecomp byte-compile cl-lib rmc iso-transl tooltip cconv eldoc paren
> electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
> term/pgtk-win pgtk-win term/common-win pgtk-dnd tool-bar dnd fontset
> image regexp-opt fringe tabulated-list replace newcomment text-mode
> lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
> easymenu timer select scroll-bar mouse jit-lock font-lock syntax
> font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic
> indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
> tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
> romanian slovak czech european ethiopic indian cyrillic chinese
> composite emoji-zwj charscript charprop case-table epa-hook
> jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
> theme-loaddefs faces cus-face macroexp files window text-properties
> overlay sha1 md5 base64 format env code-pages mule custom widget keymap
> hashtable-print-readable backquote threads xwidget-internal dbusbind
> inotify dynamic-setting system-font-setting font-render-setting cairo
> gtk pgtk lcms2 multi-tty make-network-process native-compile emacs)
>
> Memory information:
> ((conses 16 101023 9352)
>  (symbols 48 8599 0)
>  (strings 32 25108 1552)
>  (string-bytes 1 788606)
>  (vectors 16 18679)
>  (vector-slots 8 373173 11952)
>  (floats 8 37 38)
>  (intervals 56 517 0)
>  (buffers 976 16))





reply via email to

[Prev in Thread] Current Thread [Next in Thread]