[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 99ceefa: Merge from origin/emacs-26
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 99ceefa: Merge from origin/emacs-26 |
Date: |
Mon, 13 Nov 2017 13:58:23 -0500 (EST) |
branch: master
commit 99ceefa8ec4f9993663492cfcce6bb82a94569c1
Merge: a7b7b85 7910889
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Merge from origin/emacs-26
79108894db Port to IBM xlc 12.01
d14956099d Simplify by removing HAVE_STRUCT_ATTRIBUTE_ALIGNED
b1573a97e1 Use alignas to fix GCALIGN-related bugs
5d68dc9a2f Change vectorlike from struct to union
6aa0a26b46 Don't enable cursor-sensor-mode in mhtml-mode
2b8ef8dddf * lisp/files.el (abbreviate-file-name): Doc fix. (Bug#29267)
fe85ce1e16 Unbreak interactive run of a flymake test (bug#29267)
48ad00390d Fix Bug#29225
42daf83f08 CC Mode: Fix defun-open being recognized as brace-list-ope...
7775c47298 Merge from Gnulib
e470d16448 Pacify GCC when configured --with-x-toolkit=no
49450d0951 * lisp/find-dired.el (find-grep-dired): Doc fix. (Bug#29262)
e286b3381f Fix more flymake-diag-region eob corner cases and add test...
# Conflicts:
# src/lisp.h
---
admin/CPP-DEFINES | 1 -
build-aux/config.guess | 9 +-
build-aux/config.sub | 5 +-
configure.ac | 16 --
doc/lispref/internals.texi | 4 +-
doc/misc/texinfo.tex | 4 +-
lib-src/make-docfile.c | 4 +-
lib/faccessat.c | 60 ++++++-
lib/fstatat.c | 2 +-
lib/gnulib.mk.in | 2 +
lib/unistd.in.h | 16 +-
lisp/files.el | 8 +-
lisp/find-dired.el | 6 +-
lisp/progmodes/cc-engine.el | 14 +-
lisp/progmodes/flymake.el | 16 +-
lisp/textmodes/mhtml-mode.el | 5 +-
m4/faccessat.m4 | 6 +-
m4/gnulib-comp.m4 | 10 +-
m4/unistd_h.m4 | 3 +-
oldXMenu/Activate.c | 1 +
src/alloc.c | 234 +++++++++++++--------------
src/buffer.c | 19 +--
src/buffer.h | 2 +-
src/bytecode.c | 4 +-
src/casefiddle.c | 4 +-
src/cmds.c | 6 +-
src/data.c | 76 ++++-----
src/doc.c | 2 +-
src/emacs-module.c | 17 --
src/eval.c | 59 +++----
src/fileio.c | 3 +-
src/fns.c | 4 +-
src/font.h | 6 +-
src/frame.h | 2 +-
src/keyboard.c | 10 +-
src/lisp.h | 303 +++++++++++++++++------------------
src/lread.c | 52 +++---
src/minibuf.c | 12 +-
src/process.h | 2 +-
src/termhooks.h | 2 +-
src/thread.c | 2 +-
src/thread.h | 6 +-
src/w32term.h | 2 +-
src/window.c | 8 +-
src/window.h | 2 +-
src/xterm.c | 7 +-
src/xterm.h | 2 +-
src/xwidget.h | 4 +-
test/lisp/net/tramp-tests.el | 251 ++++++++++++++++++++++++-----
test/lisp/progmodes/flymake-tests.el | 37 ++++-
50 files changed, 790 insertions(+), 542 deletions(-)
diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES
index eb3eadf..04d1ff7 100644
--- a/admin/CPP-DEFINES
+++ b/admin/CPP-DEFINES
@@ -102,7 +102,6 @@ HAVE_ALARM
HAVE_ALLOCA
HAVE_ALLOCA_H
HAVE_ALSA
-HAVE_ATTRIBUTE_ALIGNED
HAVE_BDFFONT
HAVE_BOXES
HAVE_C99_STRTOLD
diff --git a/build-aux/config.guess b/build-aux/config.guess
index 2773ac4..31e01ef 100755
--- a/build-aux/config.guess
+++ b/build-aux/config.guess
@@ -2,7 +2,7 @@
# Attempt to guess a canonical system name.
# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2017-11-01'
+timestamp='2017-11-07'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -39,7 +39,7 @@ Usage: $0 [OPTION]
Output the configuration name of the system \`$me' is run on.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -244,6 +244,9 @@ case
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE}
exit ;;
+ *:MidnightBSD:*:*)
+ echo ${UNAME_MACHINE}-unknown-midnightbsd${UNAME_RELEASE}
+ exit ;;
*:ekkoBSD:*:*)
echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
exit ;;
@@ -479,7 +482,7 @@ case
"${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
#endif
#if defined (host_mips) && defined (MIPSEB)
#if defined (SYSTYPE_SYSV)
- printf ("mips-mips-risco0s%ssysv\\n", argv[1]); exit (0);
+ printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0);
#endif
#if defined (SYSTYPE_SVR4)
printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0);
diff --git a/build-aux/config.sub b/build-aux/config.sub
index bbad4c4..fb57947 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,7 +2,7 @@
# Configuration validation subroutine script.
# Copyright 1992-2017 Free Software Foundation, Inc.
-timestamp='2017-11-01'
+timestamp='2017-11-04'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -57,7 +57,7 @@ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS
Canonicalize a configuration name.
-Operation modes:
+Options:
-h, --help print this help, then exit
-t, --time-stamp print date of last modification, then exit
-v, --version print version number, then exit
@@ -313,7 +313,6 @@ case $basic_machine in
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| wasm32 \
- | we32k \
| x86 | xc16x | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
diff --git a/configure.ac b/configure.ac
index 2dd21b7..29016d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5113,22 +5113,6 @@ else
fi
AC_SUBST(LIBXMENU)
-AC_CACHE_CHECK([for struct alignment],
- [emacs_cv_struct_alignment],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM([[#include <stddef.h>
- struct __attribute__ ((aligned (8))) s { char c; };
- struct t { char c; struct s s; };
- char verify[offsetof (struct t, s) == 8 ? 1 : -1];
- ]])],
- [emacs_cv_struct_alignment=yes],
- [emacs_cv_struct_alignment=no])])
-if test "$emacs_cv_struct_alignment" = yes; then
- AC_DEFINE([HAVE_STRUCT_ATTRIBUTE_ALIGNED], 1,
- [Define to 1 if 'struct __attribute__ ((aligned (N)))' aligns the
- structure to an N-byte boundary.])
-fi
-
if test "${GNU_MALLOC}" = "yes" ; then
AC_DEFINE(GNU_MALLOC, 1,
[Define to 1 if you want to use the GNU memory allocator.])
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 663d0fd..b0348e7 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -248,7 +248,7 @@ of 8k bytes, and small vectors are packed into blocks of 4k
bytes).
@cindex storage of vector-like Lisp objects
Beyond the basic vector, a lot of objects like window, buffer, and
frame are managed as if they were vectors. The corresponding C data
-structures include the @code{struct vectorlike_header} field whose
+structures include the @code{union vectorlike_header} field whose
@code{size} member contains the subtype enumerated by @code{enum pvec_type}
and an information about how many @code{Lisp_Object} fields this structure
contains and what the size of the rest data is. This information is
@@ -1085,7 +1085,7 @@ Some of the fields of @code{struct buffer} are:
@table @code
@item header
-A header of type @code{struct vectorlike_header} is common to all
+A header of type @code{union vectorlike_header} is common to all
vectorlike objects.
@item own_text
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 9bd75b9..022c3f5 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2017-09-16.10}
+\def\texinfoversion{2017-09-11.18}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -11425,9 +11425,11 @@ directory should work if nowhere else does.}
%
\dimen0 = #1\relax
\advance\dimen0 by \voffset
+ \advance\dimen0 by 1in % reference point for DVI is 1 inch from top of page
%
\dimen2 = \hsize
\advance\dimen2 by \normaloffset
+ \advance\dimen2 by 1in % reference point is 1 inch from left edge of page
%
\internalpagesizes{#1}{\hsize}%
{\voffset}{\normaloffset}%
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index ff84df9..9e4755b 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -667,9 +667,7 @@ close_emacs_globals (ptrdiff_t num_symbols)
"#ifndef DEFINE_SYMBOLS\n"
"extern\n"
"#endif\n"
- "struct {\n"
- " struct GCALIGNED Lisp_Symbol s;\n"
- "} lispsym[%td];\n"),
+ "struct Lisp_Symbol lispsym[%td];\n"),
num_symbols);
}
diff --git a/lib/faccessat.c b/lib/faccessat.c
index 6cf9c99..fa92358 100644
--- a/lib/faccessat.c
+++ b/lib/faccessat.c
@@ -16,10 +16,31 @@
/* written by Eric Blake */
+/* If the user's config.h happens to include <unistd.h>, let it include only
+ the system's <unistd.h> here, so that orig_faccessat doesn't recurse to
+ rpl_faccessat. */
+#define _GL_INCLUDING_UNISTD_H
#include <config.h>
#include <unistd.h>
+#include <errno.h>
#include <fcntl.h>
+#include <string.h>
+#include <sys/stat.h>
+#undef _GL_INCLUDING_UNISTD_H
+
+#if HAVE_FACCESSAT
+static int
+orig_faccessat (int fd, char const *name, int mode, int flag)
+{
+ return faccessat (fd, name, mode, flag);
+}
+#endif
+
+/* Write "unistd.h" here, not <unistd.h>, otherwise OSF/1 5.1 DTK cc
+ eliminates this include because of the preliminary #include <unistd.h>
+ above. */
+#include "unistd.h"
#ifndef HAVE_ACCESS
/* Mingw lacks access, but it also lacks real vs. effective ids, so
@@ -28,6 +49,29 @@
# define access euidaccess
#endif
+#if HAVE_FACCESSAT
+
+int
+rpl_faccessat (int fd, char const *file, int mode, int flag)
+{
+ int result = orig_faccessat (fd, file, mode, flag);
+
+ if (result == 0 && file[strlen (file) - 1] == '/')
+ {
+ struct stat st;
+ result = fstatat (fd, file, &st, 0);
+ if (result == 0 && !S_ISDIR (st.st_mode))
+ {
+ errno = ENOTDIR;
+ return -1;
+ }
+ }
+
+ return result;
+}
+
+#else /* !HAVE_FACCESSAT */
+
/* Invoke access or euidaccess on file, FILE, using mode MODE, in the directory
open on descriptor FD. If possible, do it without changing the
working directory. Otherwise, resort to using save_cwd/fchdir, then
@@ -36,10 +80,12 @@
Note that this implementation only supports AT_EACCESS, although some
native versions also support AT_SYMLINK_NOFOLLOW. */
-#define AT_FUNC_NAME faccessat
-#define AT_FUNC_F1 euidaccess
-#define AT_FUNC_F2 access
-#define AT_FUNC_USE_F1_COND AT_EACCESS
-#define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
-#define AT_FUNC_POST_FILE_ARGS , mode
-#include "at-func.c"
+# define AT_FUNC_NAME faccessat
+# define AT_FUNC_F1 euidaccess
+# define AT_FUNC_F2 access
+# define AT_FUNC_USE_F1_COND AT_EACCESS
+# define AT_FUNC_POST_FILE_PARAM_DECLS , int mode, int flag
+# define AT_FUNC_POST_FILE_ARGS , mode
+# include "at-func.c"
+
+#endif
diff --git a/lib/fstatat.c b/lib/fstatat.c
index 67e48d9..294861f 100644
--- a/lib/fstatat.c
+++ b/lib/fstatat.c
@@ -28,7 +28,7 @@
#include <sys/stat.h>
#undef __need_system_sys_stat_h
-#if HAVE_FSTATAT
+#if HAVE_FSTATAT && HAVE_WORKING_FSTATAT_ZERO_FLAG
static int
orig_fstatat (int fd, char const *filename, struct stat *buf, int flags)
{
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index e9358a6..a7b33ba 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -689,6 +689,7 @@ REPLACE_DIRFD = @REPLACE_DIRFD@
REPLACE_DPRINTF = @REPLACE_DPRINTF@
REPLACE_DUP = @REPLACE_DUP@
REPLACE_DUP2 = @REPLACE_DUP2@
+REPLACE_FACCESSAT = @REPLACE_FACCESSAT@
REPLACE_FCHOWNAT = @REPLACE_FCHOWNAT@
REPLACE_FCLOSE = @REPLACE_FCLOSE@
REPLACE_FCNTL = @REPLACE_FCNTL@
@@ -2997,6 +2998,7 @@ unistd.h: unistd.in.h $(top_builddir)/config.status
$(CXXDEFS_H) $(ARG_NONNULL_H
-e 's|@''REPLACE_CLOSE''@|$(REPLACE_CLOSE)|g' \
-e 's|@''REPLACE_DUP''@|$(REPLACE_DUP)|g' \
-e 's|@''REPLACE_DUP2''@|$(REPLACE_DUP2)|g' \
+ -e 's|@''REPLACE_FACCESSAT''@|$(REPLACE_FACCESSAT)|g' \
-e 's|@''REPLACE_FCHOWNAT''@|$(REPLACE_FCHOWNAT)|g' \
-e 's|@''REPLACE_FTRUNCATE''@|$(REPLACE_FTRUNCATE)|g' \
-e 's|@''REPLACE_GETCWD''@|$(REPLACE_GETCWD)|g' \
diff --git a/lib/unistd.in.h b/lib/unistd.in.h
index ca8090a..9144783 100644
--- a/lib/unistd.in.h
+++ b/lib/unistd.in.h
@@ -461,13 +461,25 @@ _GL_WARN_ON_USE (euidaccess, "euidaccess is unportable - "
#if @GNULIB_FACCESSAT@
-# if address@hidden@
+# if @REPLACE_FACCESSAT@
+# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+# undef faccessat
+# define faccessat rpl_faccessat
+# endif
+_GL_FUNCDECL_RPL (faccessat, int,
+ (int fd, char const *name, int mode, int flag)
+ _GL_ARG_NONNULL ((2)));
+_GL_CXXALIAS_RPL (faccessat, int,
+ (int fd, char const *name, int mode, int flag));
+# else
+# if address@hidden@
_GL_FUNCDECL_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag)
_GL_ARG_NONNULL ((2)));
-# endif
+# endif
_GL_CXXALIAS_SYS (faccessat, int,
(int fd, char const *file, int mode, int flag));
+# endif
_GL_CXXALIASWARN (faccessat);
#elif defined GNULIB_POSIXCHECK
# undef faccessat
diff --git a/lisp/files.el b/lisp/files.el
index e3a34af..ae90d19 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1855,7 +1855,13 @@ The value includes abbreviation according to
`directory-abbrev-alist'.")
"Return a version of FILENAME shortened using `directory-abbrev-alist'.
This also substitutes \"~\" for the user's home directory (unless the
home directory is a root directory) and removes automounter prefixes
-\(see the variable `automount-dir-prefix')."
+\(see the variable `automount-dir-prefix').
+
+When this function is first called, it caches the user's home
+directory as a regexp in `abbreviated-home-dir', and reuses it
+afterwards. Lisp programs that temporarily set the home directory
+to a different value should let-bind `abbreviated-home-dir' for
+the modified home directory to take effect."
;; Get rid of the prefixes added by the automounter.
(save-match-data
(if (and automount-dir-prefix
diff --git a/lisp/find-dired.el b/lisp/find-dired.el
index 2d2540b..3b0613b 100644
--- a/lisp/find-dired.el
+++ b/lisp/find-dired.el
@@ -255,14 +255,14 @@ See `find-name-arg' to customize the arguments."
(defalias 'lookfor-dired 'find-grep-dired)
;;;###autoload
(defun find-grep-dired (dir regexp)
- "Find files in DIR matching a regexp REGEXP and start Dired on output.
+ "Find files in DIR that contain matches for REGEXP and start Dired on output.
The command run (after changing into DIR) is
find . \\( -type f -exec `grep-program' `find-grep-options' \\
-e REGEXP {} \\; \\) -ls
-where the car of the variable `find-ls-option' specifies what to
-use in place of \"-ls\" as the final argument."
+where the first string in the value of the variable `find-ls-option'
+specifies what to use in place of \"-ls\" as the final argument."
;; Doc used to say "Thus ARG can also contain additional grep options."
;; i) Presumably ARG == REGEXP?
;; ii) No it can't have options, since it gets shell-quoted.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8ec01e1..ab0204c 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10740,10 +10740,8 @@ comment at the start of cc-engine.el for more info."
(t ; We're at (1+ here).
(cond
((progn (c-forward-syntactic-ws)
- (eq (point) (1- there)))
- t)
- ((c-syntactic-re-search-forward c-keywords-regexp there t)
- t)
+ (eq (point) (1- there))))
+ ((c-syntactic-re-search-forward c-keywords-regexp there t))
((c-syntactic-re-search-forward "{" there t t)
(backward-char)
(c-looking-at-statement-block))
@@ -10752,8 +10750,12 @@ comment at the start of cc-engine.el for more info."
(cond
((c-syntactic-re-search-forward "[;,]" nil t t)
(eq (char-before) ?\;))
- ((c-syntactic-re-search-forward c-keywords-regexp nil t t)
- t)
+ ((progn (c-forward-syntactic-ws)
+ (eobp)))
+ ((c-syntactic-re-search-forward c-keywords-regexp nil t t))
+ ((c-syntactic-re-search-forward "{" nil t t)
+ (backward-char)
+ (c-looking-at-statement-block))
(t nil)))
(goto-char here))))
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 1930f4f..aac1673 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -318,7 +318,11 @@ region is invalid."
(goto-char (point-min))
(forward-line (1- line))
(cl-flet ((fallback-bol
- () (progn (back-to-indentation) (point)))
+ ()
+ (back-to-indentation)
+ (if (eobp)
+ (line-beginning-position 0)
+ (point)))
(fallback-eol
(beg)
(progn
@@ -335,11 +339,11 @@ region is invalid."
(not (= sexp-end beg))
sexp-end)
(and (< (goto-char (1+ beg)) (point-max))
- (point))))
- (safe-end (or end
- (fallback-eol beg))))
- (cons (if end beg (fallback-bol))
- safe-end))
+ (point)))))
+ (if end
+ (cons beg end)
+ (cons (setq beg (fallback-bol))
+ (fallback-eol beg))))
(let* ((beg (fallback-bol))
(end (fallback-eol beg)))
(cons beg end)))))))
diff --git a/lisp/textmodes/mhtml-mode.el b/lisp/textmodes/mhtml-mode.el
index 5854167..8df2512 100644
--- a/lisp/textmodes/mhtml-mode.el
+++ b/lisp/textmodes/mhtml-mode.el
@@ -237,8 +237,8 @@ smallest."
(cons 'jit-lock-bounds (cons new-beg new-end)))))
(defvar-local mhtml--last-submode nil
- "Record the last visited submode, so the cursor-sensor function
-can function properly.")
+ "Record the last visited submode.
+This is used by `mhtml--pre-command'.")
(defvar-local mhtml--stashed-crucial-variables nil
"Alist of stashed values of the crucial variables.")
@@ -359,7 +359,6 @@ can function properly.")
Code inside a <script> element is indented using the rules from
`js-mode'; and code inside a <style> element is indented using
the rules from `css-mode'."
- (cursor-sensor-mode)
(setq-local indent-line-function #'mhtml-indent-line)
(setq-local parse-sexp-lookup-properties t)
(setq-local syntax-propertize-function #'mhtml-syntax-propertize)
diff --git a/m4/faccessat.m4 b/m4/faccessat.m4
index 837ae54..f4cb49d 100644
--- a/m4/faccessat.m4
+++ b/m4/faccessat.m4
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
# See if we need to provide faccessat replacement.
dnl Copyright (C) 2009-2017 Free Software Foundation, Inc.
@@ -18,10 +18,12 @@ AC_DEFUN([gl_FUNC_FACCESSAT],
AC_CHECK_FUNCS_ONCE([faccessat])
if test $ac_cv_func_faccessat = no; then
HAVE_FACCESSAT=0
+ elif test "$gl_cv_func_lstat_dereferences_slashed_symlink" != yes; then
+ REPLACE_FACCESSAT=1
fi
])
-# Prerequisites of lib/faccessat.m4.
+# Prerequisites of lib/faccessat.c.
AC_DEFUN([gl_PREREQ_FACCESSAT],
[
AC_CHECK_FUNCS([access])
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4
index cb255fc..61d39eb 100644
--- a/m4/gnulib-comp.m4
+++ b/m4/gnulib-comp.m4
@@ -223,7 +223,7 @@ AC_DEFUN([gl_INIT],
gl_STRING_MODULE_INDICATOR([explicit_bzero])
AC_REQUIRE([gl_EXTERN_INLINE])
gl_FUNC_FACCESSAT
- if test $HAVE_FACCESSAT = 0; then
+ if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
AC_LIBOBJ([faccessat])
gl_PREREQ_FACCESSAT
fi
@@ -599,16 +599,16 @@ AC_DEFUN([gl_INIT],
gl_gnulib_enabled_682e609604ccaac6be382e4ee3a4eaec=true
fi
}
- if test $HAVE_FACCESSAT = 0; then
+ if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_260941c0e5dc67ec9e87d1fb321c300b
fi
- if test $HAVE_FACCESSAT = 0; then
+ if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_dosname
fi
- if test $HAVE_FACCESSAT = 0; then
+ if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_euidaccess
fi
- if test $HAVE_FACCESSAT = 0; then
+ if test $HAVE_FACCESSAT = 0 || test $REPLACE_FACCESSAT = 1; then
func_gl_gnulib_m4code_03e0aaad4cb89ca757653bd367a6ccb7
fi
if test $HAVE_FCNTL = 0 || test $REPLACE_FCNTL = 1; then
diff --git a/m4/unistd_h.m4 b/m4/unistd_h.m4
index cc44677..60e7ea4 100644
--- a/m4/unistd_h.m4
+++ b/m4/unistd_h.m4
@@ -1,4 +1,4 @@
-# unistd_h.m4 serial 70
+# unistd_h.m4 serial 71
dnl Copyright (C) 2006-2017 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -159,6 +159,7 @@ AC_DEFUN([gl_UNISTD_H_DEFAULTS],
REPLACE_CLOSE=0; AC_SUBST([REPLACE_CLOSE])
REPLACE_DUP=0; AC_SUBST([REPLACE_DUP])
REPLACE_DUP2=0; AC_SUBST([REPLACE_DUP2])
+ REPLACE_FACCESSAT=0; AC_SUBST([REPLACE_FACCESSAT])
REPLACE_FCHOWNAT=0; AC_SUBST([REPLACE_FCHOWNAT])
REPLACE_FTRUNCATE=0; AC_SUBST([REPLACE_FTRUNCATE])
REPLACE_GETCWD=0; AC_SUBST([REPLACE_GETCWD])
diff --git a/oldXMenu/Activate.c b/oldXMenu/Activate.c
index c27005f..638a208 100644
--- a/oldXMenu/Activate.c
+++ b/oldXMenu/Activate.c
@@ -571,6 +571,7 @@ XMenuActivate(
event.xbutton.window
);
if (event_xmp != NULL) continue;
+ FALLTHROUGH;
default:
/*
* This is a foreign event.
diff --git a/src/alloc.c b/src/alloc.c
index ae892e4..15a3d34 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -211,9 +211,9 @@ alloc_unexec_post (void)
/* Mark, unmark, query mark bit of a Lisp string. S must be a pointer
to a struct Lisp_String. */
-#define MARK_STRING(S) ((S)->size |= ARRAY_MARK_FLAG)
-#define UNMARK_STRING(S) ((S)->size &= ~ARRAY_MARK_FLAG)
-#define STRING_MARKED_P(S) (((S)->size & ARRAY_MARK_FLAG) != 0)
+#define MARK_STRING(S) ((S)->u.s.size |= ARRAY_MARK_FLAG)
+#define UNMARK_STRING(S) ((S)->u.s.size &= ~ARRAY_MARK_FLAG)
+#define STRING_MARKED_P(S) (((S)->u.s.size & ARRAY_MARK_FLAG) != 0)
#define VECTOR_MARK(V) ((V)->header.size |= ARRAY_MARK_FLAG)
#define VECTOR_UNMARK(V) ((V)->header.size &= ~ARRAY_MARK_FLAG)
@@ -1730,14 +1730,14 @@ static EMACS_INT total_string_bytes;
string_free_list, return a pointer to its successor in the
free-list. */
-#define NEXT_FREE_LISP_STRING(S) (*(struct Lisp_String **) (S))
+#define NEXT_FREE_LISP_STRING(S) ((S)->u.next)
/* Return a pointer to the sdata structure belonging to Lisp string S.
S must be live, i.e. S->data must not be null. S->data is actually
a pointer to the `u.data' member of its sdata structure; the
structure starts at a constant offset in front of that. */
-#define SDATA_OF_STRING(S) ((sdata *) ((S)->data - SDATA_DATA_OFFSET))
+#define SDATA_OF_STRING(S) ((sdata *) ((S)->u.s.data - SDATA_DATA_OFFSET))
#ifdef GC_CHECK_STRING_OVERRUN
@@ -1818,9 +1818,10 @@ ptrdiff_t
string_bytes (struct Lisp_String *s)
{
ptrdiff_t nbytes =
- (s->size_byte < 0 ? s->size & ~ARRAY_MARK_FLAG : s->size_byte);
+ (s->u.s.size_byte < 0 ? s->u.s.size & ~ARRAY_MARK_FLAG : s->u.s.size_byte);
- if (!PURE_P (s) && s->data && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
+ if (!PURE_P (s) && s->u.s.data
+ && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s)))
emacs_abort ();
return nbytes;
}
@@ -1926,7 +1927,7 @@ allocate_string (void)
{
s = b->strings + i;
/* Every string on a free list should have NULL data pointer. */
- s->data = NULL;
+ s->u.s.data = NULL;
NEXT_FREE_LISP_STRING (s) = string_free_list;
string_free_list = s;
}
@@ -1965,10 +1966,10 @@ allocate_string (void)
/* Set up Lisp_String S for holding NCHARS characters, NBYTES bytes,
- plus a NUL byte at the end. Allocate an sdata structure for S, and
- set S->data to its `u.data' member. Store a NUL byte at the end of
- S->data. Set S->size to NCHARS and S->size_byte to NBYTES. Free
- S->data if it was initially non-null. */
+ plus a NUL byte at the end. Allocate an sdata structure DATA for
+ S, and set S->u.s.data to SDATA->u.data. Store a NUL byte at the
+ end of S->u.s.data. Set S->u.s.size to NCHARS and S->u.s.size_byte
+ to NBYTES. Free S->u.s.data if it was initially non-null. */
void
allocate_string_data (struct Lisp_String *s,
@@ -1984,7 +1985,7 @@ allocate_string_data (struct Lisp_String *s,
/* Determine the number of bytes needed to store NBYTES bytes
of string data. */
needed = SDATA_SIZE (nbytes);
- if (s->data)
+ if (s->u.s.data)
{
old_data = SDATA_OF_STRING (s);
old_nbytes = STRING_BYTES (s);
@@ -2043,13 +2044,13 @@ allocate_string_data (struct Lisp_String *s,
MALLOC_UNBLOCK_INPUT;
- s->data = SDATA_DATA (data);
+ s->u.s.data = SDATA_DATA (data);
#ifdef GC_CHECK_STRING_BYTES
SDATA_NBYTES (data) = nbytes;
#endif
- s->size = nchars;
- s->size_byte = nbytes;
- s->data[nbytes] = '\0';
+ s->u.s.size = nchars;
+ s->u.s.size_byte = nbytes;
+ s->u.s.data[nbytes] = '\0';
#ifdef GC_CHECK_STRING_OVERRUN
memcpy ((char *) data + needed, string_overrun_cookie,
GC_STRING_OVERRUN_COOKIE_SIZE);
@@ -2093,7 +2094,7 @@ sweep_strings (void)
{
struct Lisp_String *s = b->strings + i;
- if (s->data)
+ if (s->u.s.data)
{
/* String was not on free-list before. */
if (STRING_MARKED_P (s))
@@ -2102,7 +2103,7 @@ sweep_strings (void)
UNMARK_STRING (s);
/* Do not use string_(set|get)_intervals here. */
- s->intervals = balance_intervals (s->intervals);
+ s->u.s.intervals = balance_intervals (s->u.s.intervals);
++total_strings;
total_string_bytes += STRING_BYTES (s);
@@ -2125,7 +2126,7 @@ sweep_strings (void)
/* Reset the strings's `data' member so that we
know it's free. */
- s->data = NULL;
+ s->u.s.data = NULL;
/* Put the string on the free-list. */
NEXT_FREE_LISP_STRING (s) = string_free_list;
@@ -2264,7 +2265,7 @@ compact_small_strings (void)
{
eassert (tb != b || to < from);
memmove (to, from, nbytes + GC_STRING_EXTRA);
- to->string->data = SDATA_DATA (to);
+ to->string->u.s.data = SDATA_DATA (to);
}
/* Advance past the sdata we copied to. */
@@ -2546,7 +2547,7 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT
nbytes)
return empty_multibyte_string;
s = allocate_string ();
- s->intervals = NULL;
+ s->u.s.intervals = NULL;
allocate_string_data (s, nchars, nbytes);
XSETSTRING (string, s);
string_chars_consed += nbytes;
@@ -2731,8 +2732,8 @@ static struct Lisp_Cons *cons_free_list;
void
free_cons (struct Lisp_Cons *ptr)
{
- ptr->u.chain = cons_free_list;
- ptr->car = Vdead;
+ ptr->u.s.u.chain = cons_free_list;
+ ptr->u.s.car = Vdead;
cons_free_list = ptr;
consing_since_gc -= sizeof *ptr;
total_free_conses++;
@@ -2751,7 +2752,7 @@ DEFUN ("cons", Fcons, Scons, 2, 2, 0,
/* We use the cdr for chaining the free list
so that we won't use the same field that has the mark bit. */
XSETCONS (val, cons_free_list);
- cons_free_list = cons_free_list->u.chain;
+ cons_free_list = cons_free_list->u.s.u.chain;
}
else
{
@@ -2788,7 +2789,7 @@ check_cons_list (void)
struct Lisp_Cons *tail = cons_free_list;
while (tail)
- tail = tail->u.chain;
+ tail = tail->u.s.u.chain;
}
#endif
@@ -2923,19 +2924,16 @@ set_next_vector (struct Lisp_Vector *v, struct
Lisp_Vector *p)
#define VECTOR_BLOCK_SIZE 4096
-enum
- {
- /* Alignment of struct Lisp_Vector objects. Because pseudovectors
- can contain any C type, align at least as strictly as
- max_align_t. On x86 and x86-64 this can waste up to 8 bytes
- for typical vectors, since alignof (max_align_t) is 16 but
- typical vectors need only an alignment of 8. However, it is
- not worth the hassle to avoid wasting those bytes. */
- vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT),
-
- /* Vector size requests are a multiple of this. */
- roundup_size = COMMON_MULTIPLE (vector_alignment, word_size)
- };
+/* Alignment of struct Lisp_Vector objects. Because pseudovectors
+ can contain any C type, align at least as strictly as
+ max_align_t. On x86 and x86-64 this can waste up to 8 bytes
+ for typical vectors, since alignof (max_align_t) is 16 but
+ typical vectors need only an alignment of 8. However, it is
+ not worth the hassle to avoid wasting those bytes. */
+enum {vector_alignment = COMMON_MULTIPLE (alignof (max_align_t), GCALIGNMENT)};
+
+/* Vector size requests are a multiple of this. */
+enum { roundup_size = COMMON_MULTIPLE (vector_alignment, word_size) };
/* Verify assumptions described above. */
verify (VECTOR_BLOCK_SIZE % roundup_size == 0);
@@ -3545,27 +3543,17 @@ usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS
DEPTH &optional DOCSTRING INT
Symbol Allocation
***********************************************************************/
-/* Like struct Lisp_Symbol, but padded so that the size is a multiple
- of the required alignment. */
-
-union aligned_Lisp_Symbol
-{
- struct Lisp_Symbol s;
- unsigned char c[(sizeof (struct Lisp_Symbol) + GCALIGNMENT - 1)
- & -GCALIGNMENT];
-};
-
/* Each symbol_block is just under 1020 bytes long, since malloc
really allocates in units of powers of two and uses 4 bytes for its
own overhead. */
#define SYMBOL_BLOCK_SIZE \
- ((1020 - sizeof (struct symbol_block *)) / sizeof (union
aligned_Lisp_Symbol))
+ ((1020 - sizeof (struct symbol_block *)) / sizeof (struct Lisp_Symbol))
struct symbol_block
{
/* Place `symbols' first, to preserve alignment. */
- union aligned_Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
+ struct Lisp_Symbol symbols[SYMBOL_BLOCK_SIZE];
struct symbol_block *next;
};
@@ -3589,7 +3577,7 @@ static struct Lisp_Symbol *symbol_free_list;
static void
set_symbol_name (Lisp_Object sym, Lisp_Object name)
{
- XSYMBOL (sym)->name = name;
+ XSYMBOL (sym)->u.s.name = name;
}
void
@@ -3598,15 +3586,15 @@ init_symbol (Lisp_Object val, Lisp_Object name)
struct Lisp_Symbol *p = XSYMBOL (val);
set_symbol_name (val, name);
set_symbol_plist (val, Qnil);
- p->redirect = SYMBOL_PLAINVAL;
+ p->u.s.redirect = SYMBOL_PLAINVAL;
SET_SYMBOL_VAL (p, Qunbound);
set_symbol_function (val, Qnil);
set_symbol_next (val, NULL);
- p->gcmarkbit = false;
- p->interned = SYMBOL_UNINTERNED;
- p->trapped_write = SYMBOL_UNTRAPPED_WRITE;
- p->declared_special = false;
- p->pinned = false;
+ p->u.s.gcmarkbit = false;
+ p->u.s.interned = SYMBOL_UNINTERNED;
+ p->u.s.trapped_write = SYMBOL_UNTRAPPED_WRITE;
+ p->u.s.declared_special = false;
+ p->u.s.pinned = false;
}
DEFUN ("make-symbol", Fmake_symbol, Smake_symbol, 1, 1, 0,
@@ -3623,7 +3611,7 @@ Its value is void, and its function definition and
property list are nil. */)
if (symbol_free_list)
{
XSETSYMBOL (val, symbol_free_list);
- symbol_free_list = symbol_free_list->next;
+ symbol_free_list = symbol_free_list->u.s.next;
}
else
{
@@ -3636,7 +3624,7 @@ Its value is void, and its function definition and
property list are nil. */)
symbol_block_index = 0;
total_free_symbols += SYMBOL_BLOCK_SIZE;
}
- XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index].s);
+ XSETSYMBOL (val, &symbol_block->symbols[symbol_block_index]);
symbol_block_index++;
}
@@ -4589,7 +4577,7 @@ live_string_holding (struct mem_node *m, void *p)
if (0 <= offset && offset < STRING_BLOCK_SIZE * sizeof b->strings[0])
{
struct Lisp_String *s = p = cp -= offset % sizeof b->strings[0];
- if (s->data)
+ if (s->u.s.data)
return make_lisp_ptr (s, Lisp_String);
}
}
@@ -4623,7 +4611,7 @@ live_cons_holding (struct mem_node *m, void *p)
|| offset / sizeof b->conses[0] < cons_block_index))
{
struct Lisp_Cons *s = p = cp -= offset % sizeof b->conses[0];
- if (!EQ (s->car, Vdead))
+ if (!EQ (s->u.s.car, Vdead))
return make_lisp_ptr (s, Lisp_Cons);
}
}
@@ -4658,7 +4646,7 @@ live_symbol_holding (struct mem_node *m, void *p)
|| offset / sizeof b->symbols[0] < symbol_block_index))
{
struct Lisp_Symbol *s = p = cp -= offset % sizeof b->symbols[0];
- if (!EQ (s->function, Vdead))
+ if (!EQ (s->u.s.function, Vdead))
return make_lisp_symbol (s);
}
}
@@ -4986,7 +4974,7 @@ mark_memory (void *start, void *end)
Lisp_Object obj = build_string ("test");
struct Lisp_String *s = XSTRING (obj);
Fgarbage_collect ();
- fprintf (stderr, "test '%s'\n", s->data);
+ fprintf (stderr, "test '%s'\n", s->u.s.data);
return Qnil;
}
@@ -5486,16 +5474,16 @@ make_pure_string (const char *data,
{
Lisp_Object string;
struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
- s->data = (unsigned char *) find_string_data_in_pure (data, nbytes);
- if (s->data == NULL)
+ s->u.s.data = (unsigned char *) find_string_data_in_pure (data, nbytes);
+ if (s->u.s.data == NULL)
{
- s->data = pure_alloc (nbytes + 1, -1);
- memcpy (s->data, data, nbytes);
- s->data[nbytes] = '\0';
+ s->u.s.data = pure_alloc (nbytes + 1, -1);
+ memcpy (s->u.s.data, data, nbytes);
+ s->u.s.data[nbytes] = '\0';
}
- s->size = nchars;
- s->size_byte = multibyte ? nbytes : -1;
- s->intervals = NULL;
+ s->u.s.size = nchars;
+ s->u.s.size_byte = multibyte ? nbytes : -1;
+ s->u.s.intervals = NULL;
XSETSTRING (string, s);
return string;
}
@@ -5508,10 +5496,10 @@ make_pure_c_string (const char *data, ptrdiff_t nchars)
{
Lisp_Object string;
struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);
- s->size = nchars;
- s->size_byte = -1;
- s->data = (unsigned char *) data;
- s->intervals = NULL;
+ s->u.s.size = nchars;
+ s->u.s.size_byte = -1;
+ s->u.s.data = (unsigned char *) data;
+ s->u.s.intervals = NULL;
XSETSTRING (string, s);
return string;
}
@@ -5622,7 +5610,7 @@ purecopy (Lisp_Object obj)
|| SUBRP (obj))
return obj; /* Already pure. */
- if (STRINGP (obj) && XSTRING (obj)->intervals)
+ if (STRINGP (obj) && XSTRING (obj)->u.s.intervals)
message_with_string ("Dropping text-properties while making string `%s'
pure",
obj, true);
@@ -5677,10 +5665,10 @@ purecopy (Lisp_Object obj)
}
else if (SYMBOLP (obj))
{
- if (!XSYMBOL (obj)->pinned && !c_symbol_p (XSYMBOL (obj)))
+ if (!XSYMBOL (obj)->u.s.pinned && !c_symbol_p (XSYMBOL (obj)))
{ /* We can't purify them, but they appear in many pure objects.
Mark them as `pinned' so we know to mark them at every GC cycle.
*/
- XSYMBOL (obj)->pinned = true;
+ XSYMBOL (obj)->u.s.pinned = true;
symbol_block_pinned = symbol_block;
}
/* Don't hash-cons it. */
@@ -5893,10 +5881,10 @@ mark_pinned_symbols (void)
for (sblk = symbol_block_pinned; sblk; sblk = sblk->next)
{
- union aligned_Lisp_Symbol *sym = sblk->symbols, *end = sym + lim;
+ struct Lisp_Symbol *sym = sblk->symbols, *end = sym + lim;
for (; sym < end; ++sym)
- if (sym->s.pinned)
- mark_object (make_lisp_symbol (&sym->s));
+ if (sym->u.s.pinned)
+ mark_object (make_lisp_symbol (sym));
lim = SYMBOL_BLOCK_SIZE;
}
@@ -6258,7 +6246,7 @@ mark_char_table (struct Lisp_Vector *ptr, enum pvec_type
pvectype)
{
Lisp_Object val = ptr->contents[i];
- if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->gcmarkbit))
+ if (INTEGERP (val) || (SYMBOLP (val) && XSYMBOL (val)->u.s.gcmarkbit))
continue;
if (SUB_CHAR_TABLE_P (val))
{
@@ -6501,7 +6489,7 @@ mark_object (Lisp_Object arg)
break;
CHECK_ALLOCATED_AND_LIVE (live_string_p);
MARK_STRING (ptr);
- MARK_INTERVAL_TREE (ptr->intervals);
+ MARK_INTERVAL_TREE (ptr->u.s.intervals);
#ifdef GC_CHECK_STRING_BYTES
/* Check that the string size recorded in the string is the
same as the one recorded in the sdata structure. */
@@ -6642,17 +6630,17 @@ mark_object (Lisp_Object arg)
case Lisp_Symbol:
{
- register struct Lisp_Symbol *ptr = XSYMBOL (obj);
+ struct Lisp_Symbol *ptr = XSYMBOL (obj);
nextsym:
- if (ptr->gcmarkbit)
+ if (ptr->u.s.gcmarkbit)
break;
CHECK_ALLOCATED_AND_LIVE_SYMBOL ();
- ptr->gcmarkbit = 1;
+ ptr->u.s.gcmarkbit = 1;
/* Attempt to catch bogus objects. */
- eassert (valid_lisp_object_p (ptr->function));
- mark_object (ptr->function);
- mark_object (ptr->plist);
- switch (ptr->redirect)
+ eassert (valid_lisp_object_p (ptr->u.s.function));
+ mark_object (ptr->u.s.function);
+ mark_object (ptr->u.s.plist);
+ switch (ptr->u.s.redirect)
{
case SYMBOL_PLAINVAL: mark_object (SYMBOL_VAL (ptr)); break;
case SYMBOL_VARALIAS:
@@ -6673,11 +6661,11 @@ mark_object (Lisp_Object arg)
break;
default: emacs_abort ();
}
- if (!PURE_P (XSTRING (ptr->name)))
- MARK_STRING (XSTRING (ptr->name));
- MARK_INTERVAL_TREE (string_intervals (ptr->name));
+ if (!PURE_P (XSTRING (ptr->u.s.name)))
+ MARK_STRING (XSTRING (ptr->u.s.name));
+ MARK_INTERVAL_TREE (string_intervals (ptr->u.s.name));
/* Inner loop to mark next symbol in this bucket, if any. */
- po = ptr = ptr->next;
+ po = ptr = ptr->u.s.next;
if (ptr)
goto nextsym;
}
@@ -6731,14 +6719,14 @@ mark_object (Lisp_Object arg)
CHECK_ALLOCATED_AND_LIVE (live_cons_p);
CONS_MARK (ptr);
/* If the cdr is nil, avoid recursion for the car. */
- if (EQ (ptr->u.cdr, Qnil))
+ if (EQ (ptr->u.s.u.cdr, Qnil))
{
- obj = ptr->car;
+ obj = ptr->u.s.car;
cdr_count = 0;
goto loop;
}
- mark_object (ptr->car);
- obj = ptr->u.cdr;
+ mark_object (ptr->u.s.car);
+ obj = ptr->u.s.u.cdr;
cdr_count++;
if (cdr_count == mark_object_loop_halt)
emacs_abort ();
@@ -6799,7 +6787,7 @@ survives_gc_p (Lisp_Object obj)
break;
case Lisp_Symbol:
- survives_p = XSYMBOL (obj)->gcmarkbit;
+ survives_p = XSYMBOL (obj)->u.s.gcmarkbit;
break;
case Lisp_Misc:
@@ -6875,9 +6863,9 @@ sweep_conses (void)
if (!CONS_MARKED_P (&cblk->conses[pos]))
{
this_free++;
- cblk->conses[pos].u.chain = cons_free_list;
+ cblk->conses[pos].u.s.u.chain = cons_free_list;
cons_free_list = &cblk->conses[pos];
- cons_free_list->car = Vdead;
+ cons_free_list->u.s.car = Vdead;
}
else
{
@@ -6896,7 +6884,7 @@ sweep_conses (void)
{
*cprev = cblk->next;
/* Unhook from the free list. */
- cons_free_list = cblk->conses[0].u.chain;
+ cons_free_list = cblk->conses[0].u.s.u.chain;
lisp_align_free (cblk);
}
else
@@ -7020,39 +7008,39 @@ sweep_symbols (void)
symbol_free_list = NULL;
for (int i = 0; i < ARRAYELTS (lispsym); i++)
- lispsym[i].s.gcmarkbit = 0;
+ lispsym[i].u.s.gcmarkbit = 0;
for (sblk = symbol_block; sblk; sblk = *sprev)
{
int this_free = 0;
- union aligned_Lisp_Symbol *sym = sblk->symbols;
- union aligned_Lisp_Symbol *end = sym + lim;
+ struct Lisp_Symbol *sym = sblk->symbols;
+ struct Lisp_Symbol *end = sym + lim;
for (; sym < end; ++sym)
{
- if (!sym->s.gcmarkbit)
+ if (!sym->u.s.gcmarkbit)
{
- if (sym->s.redirect == SYMBOL_LOCALIZED)
+ if (sym->u.s.redirect == SYMBOL_LOCALIZED)
{
- xfree (SYMBOL_BLV (&sym->s));
+ xfree (SYMBOL_BLV (sym));
/* At every GC we sweep all symbol_blocks and rebuild the
symbol_free_list, so those symbols which stayed unused
between the two will be re-swept.
So we have to make sure we don't re-free this blv next
time we sweep this symbol_block (bug#29066). */
- sym->s.redirect = SYMBOL_PLAINVAL;
+ sym->u.s.redirect = SYMBOL_PLAINVAL;
}
- sym->s.next = symbol_free_list;
- symbol_free_list = &sym->s;
- symbol_free_list->function = Vdead;
+ sym->u.s.next = symbol_free_list;
+ symbol_free_list = sym;
+ symbol_free_list->u.s.function = Vdead;
++this_free;
}
else
{
++num_used;
- sym->s.gcmarkbit = 0;
+ sym->u.s.gcmarkbit = 0;
/* Attempt to catch bogus objects. */
- eassert (valid_lisp_object_p (sym->s.function));
+ eassert (valid_lisp_object_p (sym->u.s.function));
}
}
@@ -7064,7 +7052,7 @@ sweep_symbols (void)
{
*sprev = sblk->next;
/* Unhook from the free list. */
- symbol_free_list = sblk->symbols[0].s.next;
+ symbol_free_list = sblk->symbols[0].u.s.next;
lisp_free (sblk);
}
else
@@ -7291,10 +7279,10 @@ symbol_uses_obj (Lisp_Object symbol, Lisp_Object obj)
struct Lisp_Symbol *sym = XSYMBOL (symbol);
Lisp_Object val = find_symbol_value (symbol);
return (EQ (val, obj)
- || EQ (sym->function, obj)
- || (!NILP (sym->function)
- && COMPILEDP (sym->function)
- && EQ (AREF (sym->function, COMPILED_BYTECODE), obj))
+ || EQ (sym->u.s.function, obj)
+ || (!NILP (sym->u.s.function)
+ && COMPILEDP (sym->u.s.function)
+ && EQ (AREF (sym->u.s.function, COMPILED_BYTECODE), obj))
|| (!NILP (val)
&& COMPILEDP (val)
&& EQ (AREF (val, COMPILED_BYTECODE), obj)));
@@ -7325,15 +7313,15 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
for (sblk = symbol_block; sblk; sblk = sblk->next)
{
- union aligned_Lisp_Symbol *aligned_sym = sblk->symbols;
+ struct Lisp_Symbol *asym = sblk->symbols;
int bn;
- for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, aligned_sym++)
+ for (bn = 0; bn < SYMBOL_BLOCK_SIZE; bn++, asym++)
{
if (sblk == symbol_block && bn >= symbol_block_index)
break;
- Lisp_Object sym = make_lisp_symbol (&aligned_sym->s);
+ Lisp_Object sym = make_lisp_symbol (asym);
if (symbol_uses_obj (sym, obj))
{
found = Fcons (sym, found);
diff --git a/src/buffer.c b/src/buffer.c
index edeed55..4ae5e81 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -61,7 +61,7 @@ struct buffer *all_buffers;
Setting the default value also goes through the alist of buffers
and stores into each buffer that does not say it has a local value. */
-struct GCALIGNED buffer buffer_defaults;
+struct buffer buffer_defaults;
/* This structure marks which slots in a buffer have corresponding
default values in buffer_defaults.
@@ -84,7 +84,7 @@ struct buffer buffer_local_flags;
/* This structure holds the names of symbols whose values may be
buffer-local. It is indexed and accessed in the same way as the above. */
-struct GCALIGNED buffer buffer_local_symbols;
+struct buffer buffer_local_symbols;
/* Return the symbol of the per-buffer variable at offset OFFSET in
the buffer structure. */
@@ -1021,7 +1021,8 @@ reset_buffer_local_variables (struct buffer *b, bool
permanent_too)
newlist = Fcons (elt, newlist);
}
newlist = Fnreverse (newlist);
- if (XSYMBOL (local_var)->trapped_write ==
SYMBOL_TRAPPED_WRITE)
+ if (XSYMBOL (local_var)->u.s.trapped_write
+ == SYMBOL_TRAPPED_WRITE)
notify_variable_watchers (local_var, newlist,
Qmakunbound, Fcurrent_buffer ());
XSETCDR (XCAR (tmp), newlist);
@@ -1034,7 +1035,7 @@ reset_buffer_local_variables (struct buffer *b, bool
permanent_too)
else
XSETCDR (last, XCDR (tmp));
- if (XSYMBOL (local_var)->trapped_write == SYMBOL_TRAPPED_WRITE)
+ if (XSYMBOL (local_var)->u.s.trapped_write == SYMBOL_TRAPPED_WRITE)
notify_variable_watchers (local_var, Qnil,
Qmakunbound, Fcurrent_buffer ());
}
@@ -1166,7 +1167,7 @@ buffer_local_value (Lisp_Object variable, Lisp_Object
buffer)
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: result = SYMBOL_VAL (sym); break;
@@ -2096,7 +2097,7 @@ void set_buffer_internal_2 (register struct buffer *b)
{
Lisp_Object var = XCAR (XCAR (tail));
struct Lisp_Symbol *sym = XSYMBOL (var);
- if (sym->redirect == SYMBOL_LOCALIZED /* Just to be sure. */
+ if (sym->u.s.redirect == SYMBOL_LOCALIZED /* Just to be sure. */
&& SYMBOL_BLV (sym)->fwd)
/* Just reference the variable
to cause it to become set for this buffer. */
@@ -2752,7 +2753,7 @@ swap_out_buffer_local_variables (struct buffer *b)
for (alist = oalist; CONSP (alist); alist = XCDR (alist))
{
Lisp_Object sym = XCAR (XCAR (alist));
- eassert (XSYMBOL (sym)->redirect == SYMBOL_LOCALIZED);
+ eassert (XSYMBOL (sym)->u.s.redirect == SYMBOL_LOCALIZED);
/* Need not do anything if some other buffer's binding is
now cached. */
if (EQ (SYMBOL_BLV (XSYMBOL (sym))->where, buffer))
@@ -5423,8 +5424,8 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd,
const char *namestring,
bo_fwd->type = Lisp_Fwd_Buffer_Obj;
bo_fwd->offset = offset;
bo_fwd->predicate = predicate;
- sym->declared_special = 1;
- sym->redirect = SYMBOL_FORWARDED;
+ sym->u.s.declared_special = true;
+ sym->u.s.redirect = SYMBOL_FORWARDED;
SET_SYMBOL_FWD (sym, (union Lisp_Fwd *) bo_fwd);
XSETSYMBOL (PER_BUFFER_SYMBOL (offset), sym);
diff --git a/src/buffer.h b/src/buffer.h
index ac7c5a5..46c7c6e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -504,7 +504,7 @@ struct buffer_text
struct buffer
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The name of this buffer. */
Lisp_Object name_;
diff --git a/src/bytecode.c b/src/bytecode.c
index 50c7abe..ebaf3c3 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -489,7 +489,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector,
Lisp_Object maxdepth,
{
Lisp_Object v1 = vectorp[op], v2;
if (!SYMBOLP (v1)
- || XSYMBOL (v1)->redirect != SYMBOL_PLAINVAL
+ || XSYMBOL (v1)->u.s.redirect != SYMBOL_PLAINVAL
|| (v2 = SYMBOL_VAL (XSYMBOL (v1)), EQ (v2, Qunbound)))
v2 = Fsymbol_value (v1);
PUSH (v2);
@@ -558,7 +558,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector,
Lisp_Object maxdepth,
/* Inline the most common case. */
if (SYMBOLP (sym)
&& !EQ (val, Qunbound)
- && !XSYMBOL (sym)->redirect
+ && !XSYMBOL (sym)->u.s.redirect
&& !SYMBOL_TRAPPED_WRITE_P (sym))
SET_SYMBOL_VAL (XSYMBOL (sym), val);
else
diff --git a/src/casefiddle.c b/src/casefiddle.c
index 8f564ed..7b34f78 100644
--- a/src/casefiddle.c
+++ b/src/casefiddle.c
@@ -133,9 +133,9 @@ case_character_impl (struct casing_str_buf *buf,
struct Lisp_String *str = XSTRING (prop);
if (STRING_BYTES (str) <= sizeof buf->data)
{
- buf->len_chars = str->size;
+ buf->len_chars = str->u.s.size;
buf->len_bytes = STRING_BYTES (str);
- memcpy (buf->data, str->data, buf->len_bytes);
+ memcpy (buf->data, str->u.s.data, buf->len_bytes);
return 1;
}
}
diff --git a/src/cmds.c b/src/cmds.c
index f76fe87..6a7a0fa 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -421,11 +421,11 @@ internal_self_insert (int c, EMACS_INT n)
and the hook has a non-nil `no-self-insert' property,
return right away--don't really self-insert. */
if (SYMBOLP (sym) && ! NILP (sym)
- && ! NILP (XSYMBOL (sym)->function)
- && SYMBOLP (XSYMBOL (sym)->function))
+ && ! NILP (XSYMBOL (sym)->u.s.function)
+ && SYMBOLP (XSYMBOL (sym)->u.s.function))
{
Lisp_Object prop;
- prop = Fget (XSYMBOL (sym)->function, intern ("no-self-insert"));
+ prop = Fget (XSYMBOL (sym)->u.s.function, intern ("no-self-insert"));
if (! NILP (prop))
return 1;
}
diff --git a/src/data.c b/src/data.c
index 00d1eb4..4a3afed 100644
--- a/src/data.c
+++ b/src/data.c
@@ -670,7 +670,7 @@ global value outside of any lexical scope. */)
sym = XSYMBOL (symbol);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_PLAINVAL: valcontents = SYMBOL_VAL (sym); break;
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
@@ -704,10 +704,10 @@ global value outside of any lexical scope. */)
expect `t' in particular, rather than any true value. */
DEFUN ("fboundp", Ffboundp, Sfboundp, 1, 1, 0,
doc: /* Return t if SYMBOL's function definition is not void. */)
- (register Lisp_Object symbol)
+ (Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return NILP (XSYMBOL (symbol)->function) ? Qnil : Qt;
+ return NILP (XSYMBOL (symbol)->u.s.function) ? Qnil : Qt;
}
DEFUN ("makunbound", Fmakunbound, Smakunbound, 1, 1, 0,
@@ -736,18 +736,18 @@ Return SYMBOL. */)
DEFUN ("symbol-function", Fsymbol_function, Ssymbol_function, 1, 1, 0,
doc: /* Return SYMBOL's function definition, or nil if that is void.
*/)
- (register Lisp_Object symbol)
+ (Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return XSYMBOL (symbol)->function;
+ return XSYMBOL (symbol)->u.s.function;
}
DEFUN ("symbol-plist", Fsymbol_plist, Ssymbol_plist, 1, 1, 0,
doc: /* Return SYMBOL's property list. */)
- (register Lisp_Object symbol)
+ (Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return XSYMBOL (symbol)->plist;
+ return XSYMBOL (symbol)->u.s.plist;
}
DEFUN ("symbol-name", Fsymbol_name, Ssymbol_name, 1, 1, 0,
@@ -771,7 +771,7 @@ DEFUN ("fset", Ffset, Sfset, 2, 2, 0,
if (NILP (symbol))
xsignal1 (Qsetting_constant, symbol);
- function = XSYMBOL (symbol)->function;
+ function = XSYMBOL (symbol)->u.s.function;
if (!NILP (Vautoload_queue) && !NILP (function))
Vautoload_queue = Fcons (Fcons (symbol, function), Vautoload_queue);
@@ -814,7 +814,7 @@ The return value is undefined. */)
{ /* Only add autoload entries after dumping, because the ones before are
not useful and else we get loads of them from the loaddefs.el. */
- if (AUTOLOADP (XSYMBOL (symbol)->function))
+ if (AUTOLOADP (XSYMBOL (symbol)->u.s.function))
/* Remember that the function was already an autoload. */
LOADHIST_ATTACH (Fcons (Qt, symbol));
LOADHIST_ATTACH (Fcons (autoload ? Qautoload : Qdefun, symbol));
@@ -940,10 +940,10 @@ indirect_variable (struct Lisp_Symbol *symbol)
hare = tortoise = symbol;
- while (hare->redirect == SYMBOL_VARALIAS)
+ while (hare->u.s.redirect == SYMBOL_VARALIAS)
{
hare = SYMBOL_ALIAS (hare);
- if (hare->redirect != SYMBOL_VARALIAS)
+ if (hare->u.s.redirect != SYMBOL_VARALIAS)
break;
hare = SYMBOL_ALIAS (hare);
@@ -1247,7 +1247,7 @@ find_symbol_value (Lisp_Object symbol)
sym = XSYMBOL (symbol);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
@@ -1310,7 +1310,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval,
Lisp_Object where,
CHECK_SYMBOL (symbol);
sym = XSYMBOL (symbol);
- switch (sym->trapped_write)
+ switch (sym->u.s.trapped_write)
{
case SYMBOL_NOWRITE:
if (NILP (Fkeywordp (symbol))
@@ -1336,7 +1336,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval,
Lisp_Object where,
}
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: SET_SYMBOL_VAL (sym , newval); return;
@@ -1436,7 +1436,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval,
Lisp_Object where,
if (voide)
{ /* If storing void (making the symbol void), forward only through
buffer-local indicator, not through Lisp_Objfwd, etc. */
- sym->redirect = SYMBOL_PLAINVAL;
+ sym->u.s.redirect = SYMBOL_PLAINVAL;
SET_SYMBOL_VAL (sym, newval);
}
else
@@ -1452,9 +1452,9 @@ static void
set_symbol_trapped_write (Lisp_Object symbol, enum symbol_trapped_write trap)
{
struct Lisp_Symbol *sym = XSYMBOL (symbol);
- if (sym->trapped_write == SYMBOL_NOWRITE)
+ if (sym->u.s.trapped_write == SYMBOL_NOWRITE)
xsignal1 (Qtrapping_constant, symbol);
- sym->trapped_write = trap;
+ sym->u.s.trapped_write = trap;
}
static void
@@ -1469,7 +1469,7 @@ harmonize_variable_watchers (Lisp_Object alias,
Lisp_Object base_variable)
if (!EQ (base_variable, alias)
&& EQ (base_variable, Findirect_variable (alias)))
set_symbol_trapped_write
- (alias, XSYMBOL (base_variable)->trapped_write);
+ (alias, XSYMBOL (base_variable)->u.s.trapped_write);
}
DEFUN ("add-variable-watcher", Fadd_variable_watcher, Sadd_variable_watcher,
@@ -1583,7 +1583,7 @@ default_value (Lisp_Object symbol)
sym = XSYMBOL (symbol);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return SYMBOL_VAL (sym);
@@ -1653,7 +1653,7 @@ set_default_internal (Lisp_Object symbol, Lisp_Object
value,
CHECK_SYMBOL (symbol);
sym = XSYMBOL (symbol);
- switch (sym->trapped_write)
+ switch (sym->u.s.trapped_write)
{
case SYMBOL_NOWRITE:
if (NILP (Fkeywordp (symbol))
@@ -1665,7 +1665,7 @@ set_default_internal (Lisp_Object symbol, Lisp_Object
value,
case SYMBOL_TRAPPED_WRITE:
/* Don't notify here if we're going to call Fset anyway. */
- if (sym->redirect != SYMBOL_PLAINVAL
+ if (sym->u.s.redirect != SYMBOL_PLAINVAL
/* Setting due to thread switching doesn't count. */
&& bindflag != SET_INTERNAL_THREAD_SWITCH)
notify_variable_watchers (symbol, value, Qset_default, Qnil);
@@ -1677,7 +1677,7 @@ set_default_internal (Lisp_Object symbol, Lisp_Object
value,
}
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: set_internal (symbol, value, Qnil, bindflag); return;
@@ -1829,7 +1829,7 @@ The function `default-value' gets the default value and
`set-default' sets it.
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL:
@@ -1857,7 +1857,7 @@ The function `default-value' gets the default value and
`set-default' sets it.
if (!blv)
{
blv = make_blv (sym, forwarded, valcontents);
- sym->redirect = SYMBOL_LOCALIZED;
+ sym->u.s.redirect = SYMBOL_LOCALIZED;
SET_SYMBOL_BLV (sym, blv);
}
@@ -1897,7 +1897,7 @@ Instead, use `add-hook' and specify t for the LOCAL
argument. */)
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL:
@@ -1914,7 +1914,7 @@ Instead, use `add-hook' and specify t for the LOCAL
argument. */)
default: emacs_abort ();
}
- if (sym->trapped_write == SYMBOL_NOWRITE)
+ if (sym->u.s.trapped_write == SYMBOL_NOWRITE)
error ("Symbol %s may not be buffer-local",
SDATA (SYMBOL_NAME (variable)));
@@ -1930,7 +1930,7 @@ Instead, use `add-hook' and specify t for the LOCAL
argument. */)
if (!blv)
{
blv = make_blv (sym, forwarded, valcontents);
- sym->redirect = SYMBOL_LOCALIZED;
+ sym->u.s.redirect = SYMBOL_LOCALIZED;
SET_SYMBOL_BLV (sym, blv);
}
@@ -1987,7 +1987,7 @@ From now on the default value will apply in this buffer.
Return VARIABLE. */)
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return variable;
@@ -2014,7 +2014,7 @@ From now on the default value will apply in this buffer.
Return VARIABLE. */)
default: emacs_abort ();
}
- if (sym->trapped_write == SYMBOL_TRAPPED_WRITE)
+ if (sym->u.s.trapped_write == SYMBOL_TRAPPED_WRITE)
notify_variable_watchers (variable, Qnil, Qmakunbound, Fcurrent_buffer ());
/* Get rid of this buffer's alist element, if any. */
@@ -2056,7 +2056,7 @@ BUFFER defaults to the current buffer. */)
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return Qnil;
@@ -2110,7 +2110,7 @@ value in BUFFER, or if VARIABLE is automatically
buffer-local (see
sym = XSYMBOL (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return Qnil;
@@ -2145,7 +2145,7 @@ If the current binding is global (the default), the value
is nil. */)
find_symbol_value (variable);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS: sym = indirect_variable (sym); goto start;
case SYMBOL_PLAINVAL: return Qnil;
@@ -2163,7 +2163,7 @@ If the current binding is global (the default), the value
is nil. */)
buffer's or frame's value we are saving. */
if (!NILP (Flocal_variable_p (variable, Qnil)))
return Fcurrent_buffer ();
- else if (sym->redirect == SYMBOL_LOCALIZED
+ else if (sym->u.s.redirect == SYMBOL_LOCALIZED
&& blv_found (SYMBOL_BLV (sym)))
return SYMBOL_BLV (sym)->where;
else
@@ -2234,12 +2234,12 @@ indirect_function (register Lisp_Object object)
{
if (!SYMBOLP (hare) || NILP (hare))
break;
- hare = XSYMBOL (hare)->function;
+ hare = XSYMBOL (hare)->u.s.function;
if (!SYMBOLP (hare) || NILP (hare))
break;
- hare = XSYMBOL (hare)->function;
+ hare = XSYMBOL (hare)->u.s.function;
- tortoise = XSYMBOL (tortoise)->function;
+ tortoise = XSYMBOL (tortoise)->u.s.function;
if (EQ (hare, tortoise))
xsignal1 (Qcyclic_function_indirection, object);
@@ -2261,7 +2261,7 @@ function chain of symbols. */)
/* Optimize for no indirection. */
result = object;
if (SYMBOLP (result) && !NILP (result)
- && (result = XSYMBOL (result)->function, SYMBOLP (result)))
+ && (result = XSYMBOL (result)->u.s.function, SYMBOLP (result)))
result = indirect_function (result);
if (!NILP (result))
return result;
@@ -3894,7 +3894,7 @@ syms_of_data (void)
defsubr (&Sbool_vector_count_consecutive);
defsubr (&Sbool_vector_count_population);
- set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->function);
+ set_symbol_function (Qwholenump, XSYMBOL (Qnatnump)->u.s.function);
DEFVAR_LISP ("most-positive-fixnum", Vmost_positive_fixnum,
doc: /* The largest value that is representable in a Lisp
integer. */);
diff --git a/src/doc.c b/src/doc.c
index e81740b..0cd6217 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -472,7 +472,7 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
{
/* Don't use indirect_function here, or defaliases will apply their
docstrings to the base functions (Bug#2603). */
- Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->function : obj;
+ Lisp_Object fun = SYMBOLP (obj) ? XSYMBOL (obj)->u.s.function : obj;
/* The type determines where the docstring is stored. */
diff --git a/src/emacs-module.c b/src/emacs-module.c
index 6bc91a7..b351515 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -998,10 +998,6 @@ lisp_to_value_bits (Lisp_Object o)
return (emacs_value) p;
}
-#ifndef HAVE_STRUCT_ATTRIBUTE_ALIGNED
-enum { HAVE_STRUCT_ATTRIBUTE_ALIGNED = 0 };
-#endif
-
/* Convert O to an emacs_value. Allocate storage if needed; this can
signal if memory is exhausted. Must be an injective function. */
static emacs_value
@@ -1029,19 +1025,6 @@ lisp_to_value (emacs_env *env, Lisp_Object o)
/* Package the incompressible object pointer inside a pair
that is compressible. */
Lisp_Object pair = Fcons (o, ltv_mark);
-
- if (! HAVE_STRUCT_ATTRIBUTE_ALIGNED)
- {
- /* Keep calling Fcons until it returns a compressible pair.
- This shouldn't take long. */
- while ((intptr_t) XCONS (pair) & (GCALIGNMENT - 1))
- pair = Fcons (o, pair);
-
- /* Plant the mark. The garbage collector will eventually
- reclaim any just-allocated incompressible pairs. */
- XSETCDR (pair, ltv_mark);
- }
-
v = (emacs_value) ((intptr_t) XCONS (pair) + Lisp_Cons);
}
diff --git a/src/eval.c b/src/eval.c
index 063deb4..ec507dd 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -603,7 +603,7 @@ The return value is BASE-VARIABLE. */)
sym = XSYMBOL (new_alias);
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_FORWARDED:
error ("Cannot make an internal variable an alias");
@@ -632,14 +632,14 @@ The return value is BASE-VARIABLE. */)
error ("Don't know how to make a let-bound variable an alias");
}
- if (sym->trapped_write == SYMBOL_TRAPPED_WRITE)
+ if (sym->u.s.trapped_write == SYMBOL_TRAPPED_WRITE)
notify_variable_watchers (new_alias, base_variable, Qdefvaralias, Qnil);
- sym->declared_special = 1;
- XSYMBOL (base_variable)->declared_special = 1;
- sym->redirect = SYMBOL_VARALIAS;
+ sym->u.s.declared_special = true;
+ XSYMBOL (base_variable)->u.s.declared_special = true;
+ sym->u.s.redirect = SYMBOL_VARALIAS;
SET_SYMBOL_ALIAS (sym, XSYMBOL (base_variable));
- sym->trapped_write = XSYMBOL (base_variable)->trapped_write;
+ sym->u.s.trapped_write = XSYMBOL (base_variable)->u.s.trapped_write;
LOADHIST_ATTACH (new_alias);
/* Even if docstring is nil: remove old docstring. */
Fput (new_alias, Qvariable_documentation, docstring);
@@ -745,7 +745,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
tem = Fdefault_boundp (sym);
/* Do it before evaluating the initial value, for self-references. */
- XSYMBOL (sym)->declared_special = 1;
+ XSYMBOL (sym)->u.s.declared_special = true;
if (NILP (tem))
Fset_default (sym, eval_sub (XCAR (tail)));
@@ -769,7 +769,7 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */)
LOADHIST_ATTACH (sym);
}
else if (!NILP (Vinternal_interpreter_environment)
- && !XSYMBOL (sym)->declared_special)
+ && !XSYMBOL (sym)->u.s.declared_special)
/* A simple (defvar foo) with lexical scoping does "nothing" except
declare that var to be dynamically scoped *locally* (i.e. within
the current file or let-block). */
@@ -818,7 +818,7 @@ usage: (defconst SYMBOL INITVALUE [DOCSTRING]) */)
if (!NILP (Vpurify_flag))
tem = Fpurecopy (tem);
Fset_default (sym, tem);
- XSYMBOL (sym)->declared_special = 1;
+ XSYMBOL (sym)->u.s.declared_special = true;
if (!NILP (docstring))
{
if (!NILP (Vpurify_flag))
@@ -837,7 +837,7 @@ DEFUN ("internal-make-var-non-special",
Fmake_var_non_special,
(Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- XSYMBOL (symbol)->declared_special = 0;
+ XSYMBOL (symbol)->u.s.declared_special = false;
return Qnil;
}
@@ -877,7 +877,7 @@ usage: (let* VARLIST BODY...) */)
}
if (!NILP (lexenv) && SYMBOLP (var)
- && !XSYMBOL (var)->declared_special
+ && !XSYMBOL (var)->u.s.declared_special
&& NILP (Fmemq (var, Vinternal_interpreter_environment)))
/* Lexically bind VAR by adding it to the interpreter's binding
alist. */
@@ -953,7 +953,7 @@ usage: (let VARLIST BODY...) */)
tem = temps[argnum];
if (!NILP (lexenv) && SYMBOLP (var)
- && !XSYMBOL (var)->declared_special
+ && !XSYMBOL (var)->u.s.declared_special
&& NILP (Fmemq (var, Vinternal_interpreter_environment)))
/* Lexically bind VAR by adding it to the lexenv alist. */
lexenv = Fcons (Fcons (var, tem), lexenv);
@@ -1022,7 +1022,7 @@ definitions to shadow the loaded ones for use in file
byte-compilation. */)
tem = Fassq (sym, environment);
if (NILP (tem))
{
- def = XSYMBOL (sym)->function;
+ def = XSYMBOL (sym)->u.s.function;
if (!NILP (def))
continue;
}
@@ -1932,8 +1932,8 @@ this does nothing and returns nil. */)
CHECK_STRING (file);
/* If function is defined and not as an autoload, don't override. */
- if (!NILP (XSYMBOL (function)->function)
- && !AUTOLOADP (XSYMBOL (function)->function))
+ if (!NILP (XSYMBOL (function)->u.s.function)
+ && !AUTOLOADP (XSYMBOL (function)->u.s.function))
return Qnil;
if (!NILP (Vpurify_flag) && EQ (docstring, make_number (0)))
@@ -2165,7 +2165,7 @@ eval_sub (Lisp_Object form)
fun = original_fun;
if (!SYMBOLP (fun))
fun = Ffunction (Fcons (fun, Qnil));
- else if (!NILP (fun) && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ else if (!NILP (fun) && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
fun = indirect_function (fun);
if (SUBRP (fun))
@@ -2348,7 +2348,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
/* Optimize for no indirection. */
if (SYMBOLP (fun) && !NILP (fun)
- && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
{
fun = indirect_function (fun);
if (NILP (fun))
@@ -2760,7 +2760,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */)
/* Optimize for no indirection. */
fun = original_fun;
if (SYMBOLP (fun) && !NILP (fun)
- && (fun = XSYMBOL (fun)->function, SYMBOLP (fun)))
+ && (fun = XSYMBOL (fun)->u.s.function, SYMBOLP (fun)))
fun = indirect_function (fun);
if (SUBRP (fun))
@@ -3076,7 +3076,7 @@ function with `&rest' args, or `unevalled' for a special
form. */)
function = original;
if (SYMBOLP (function) && !NILP (function))
{
- function = XSYMBOL (function)->function;
+ function = XSYMBOL (function)->u.s.function;
if (SYMBOLP (function))
function = indirect_function (function);
}
@@ -3215,7 +3215,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
if ((--p)->kind > SPECPDL_LET)
{
struct Lisp_Symbol *let_bound_symbol = XSYMBOL (specpdl_symbol (p));
- eassert (let_bound_symbol->redirect != SYMBOL_VARALIAS);
+ eassert (let_bound_symbol->u.s.redirect != SYMBOL_VARALIAS);
if (symbol == let_bound_symbol
&& EQ (specpdl_where (p), buf))
return 1;
@@ -3228,10 +3228,10 @@ static void
do_specbind (struct Lisp_Symbol *sym, union specbinding *bind,
Lisp_Object value, enum Set_Internal_Bind bindflag)
{
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_PLAINVAL:
- if (!sym->trapped_write)
+ if (!sym->u.s.trapped_write)
SET_SYMBOL_VAL (sym, value);
else
set_internal (specpdl_symbol (bind), value, Qnil, bindflag);
@@ -3275,7 +3275,7 @@ specbind (Lisp_Object symbol, Lisp_Object value)
sym = XSYMBOL (symbol);
start:
- switch (sym->redirect)
+ switch (sym->u.s.redirect)
{
case SYMBOL_VARALIAS:
sym = indirect_variable (sym); XSETSYMBOL (symbol, sym); goto start;
@@ -3299,10 +3299,10 @@ specbind (Lisp_Object symbol, Lisp_Object value)
specpdl_ptr->let.where = Fcurrent_buffer ();
specpdl_ptr->let.saved_value = Qnil;
- eassert (sym->redirect != SYMBOL_LOCALIZED
+ eassert (sym->u.s.redirect != SYMBOL_LOCALIZED
|| (EQ (SYMBOL_BLV (sym)->where, Fcurrent_buffer ())));
- if (sym->redirect == SYMBOL_LOCALIZED)
+ if (sym->u.s.redirect == SYMBOL_LOCALIZED)
{
if (!blv_found (SYMBOL_BLV (sym)))
specpdl_ptr->let.kind = SPECPDL_LET_DEFAULT;
@@ -3413,9 +3413,9 @@ do_one_unbind (union specbinding *this_binding, bool
unwinding,
{ /* If variable has a trivial value (no forwarding), and isn't
trapped, we can just set it. */
Lisp_Object sym = specpdl_symbol (this_binding);
- if (SYMBOLP (sym) && XSYMBOL (sym)->redirect == SYMBOL_PLAINVAL)
+ if (SYMBOLP (sym) && XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL)
{
- if (XSYMBOL (sym)->trapped_write == SYMBOL_UNTRAPPED_WRITE)
+ if (XSYMBOL (sym)->u.s.trapped_write == SYMBOL_UNTRAPPED_WRITE)
SET_SYMBOL_VAL (XSYMBOL (sym), specpdl_old_value (this_binding));
else
set_internal (sym, specpdl_old_value (this_binding),
@@ -3547,7 +3547,7 @@ context where binding is lexical by default. */)
(Lisp_Object symbol)
{
CHECK_SYMBOL (symbol);
- return XSYMBOL (symbol)->declared_special ? Qt : Qnil;
+ return XSYMBOL (symbol)->u.s.declared_special ? Qt : Qnil;
}
@@ -3703,7 +3703,8 @@ backtrace_eval_unrewind (int distance)
just set it. No need to check for constant symbols here,
since that was already done by specbind. */
Lisp_Object sym = specpdl_symbol (tmp);
- if (SYMBOLP (sym) && XSYMBOL (sym)->redirect == SYMBOL_PLAINVAL)
+ if (SYMBOLP (sym)
+ && XSYMBOL (sym)->u.s.redirect == SYMBOL_PLAINVAL)
{
Lisp_Object old_value = specpdl_old_value (tmp);
set_specpdl_old_value (tmp, SYMBOL_VAL (XSYMBOL (sym)));
diff --git a/src/fileio.c b/src/fileio.c
index fb66118..8808ad1 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3050,7 +3050,8 @@ support. */)
acl = acl_from_text (SSDATA (acl_string));
if (acl == NULL)
{
- report_file_error ("Converting ACL", absname);
+ if (acl_errno_valid (errno))
+ report_file_error ("Converting ACL", absname);
return Qnil;
}
diff --git a/src/fns.c b/src/fns.c
index 2311a6e..4285934 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1993,7 +1993,7 @@ This is the last value stored with `(put SYMBOL PROPNAME
VALUE)'. */)
propname);
if (!NILP (propval))
return propval;
- return Fplist_get (XSYMBOL (symbol)->plist, propname);
+ return Fplist_get (XSYMBOL (symbol)->u.s.plist, propname);
}
DEFUN ("plist-put", Fplist_put, Splist_put, 3, 3, 0,
@@ -2039,7 +2039,7 @@ It can be retrieved with `(get SYMBOL PROPNAME)'. */)
{
CHECK_SYMBOL (symbol);
set_symbol_plist
- (symbol, Fplist_put (XSYMBOL (symbol)->plist, propname, value));
+ (symbol, Fplist_put (XSYMBOL (symbol)->u.s.plist, propname, value));
return value;
}
diff --git a/src/font.h b/src/font.h
index 8f2e27f..43d6f67 100644
--- a/src/font.h
+++ b/src/font.h
@@ -244,7 +244,7 @@ enum font_property_index
struct font_spec
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object props[FONT_SPEC_MAX];
};
@@ -252,7 +252,7 @@ struct font_spec
struct font_entity
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object props[FONT_ENTITY_MAX];
};
@@ -265,7 +265,7 @@ struct font_entity
struct font
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* All Lisp_Object components must come first.
That ensures they are all aligned normally. */
diff --git a/src/frame.h b/src/frame.h
index e610fc7..a3b7763 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -79,7 +79,7 @@ enum ns_appearance_type
struct frame
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* All Lisp_Object components must come first.
That ensures they are all aligned normally. */
diff --git a/src/keyboard.c b/src/keyboard.c
index 2c29a64..399149a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -7904,7 +7904,7 @@ parse_menu_item (Lisp_Object item, int inmenubar)
(such as lmenu.el set it up), check if the
original command matches the cached command. */
&& !(SYMBOLP (def)
- && EQ (tem, XSYMBOL (def)->function))))
+ && EQ (tem, XSYMBOL (def)->u.s.function))))
keys = Qnil;
}
@@ -8764,9 +8764,9 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key,
Lisp_Object prompt,
/* Handle a symbol whose function definition is a keymap
or an array. */
if (SYMBOLP (next) && !NILP (Ffboundp (next))
- && (ARRAYP (XSYMBOL (next)->function)
- || KEYMAPP (XSYMBOL (next)->function)))
- next = Fautoload_do_load (XSYMBOL (next)->function, next, Qnil);
+ && (ARRAYP (XSYMBOL (next)->u.s.function)
+ || KEYMAPP (XSYMBOL (next)->u.s.function)))
+ next = Fautoload_do_load (XSYMBOL (next)->u.s.function, next, Qnil);
/* If the keymap gives a function, not an
array, then call the function with one arg and use
@@ -11513,7 +11513,7 @@ for that character after that prefix key. */);
doc: /* Form to evaluate when Emacs starts up.
Useful to set before you dump a modified Emacs. */);
Vtop_level = Qnil;
- XSYMBOL (Qtop_level)->declared_special = false;
+ XSYMBOL (Qtop_level)->u.s.declared_special = false;
DEFVAR_KBOARD ("keyboard-translate-table", Vkeyboard_translate_table,
doc: /* Translate table for local keyboard input, or nil.
diff --git a/src/lisp.h b/src/lisp.h
index e3262ad..a25a673 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -229,7 +229,7 @@ extern bool suppress_checking EXTERNALLY_VISIBLE;
USE_LSB_TAG not only requires the least 3 bits of pointers returned by
malloc to be 0 but also needs to be able to impose a mult-of-8 alignment
on the few static Lisp_Objects used, all of which are aligned via
- the GCALIGN macro defined below. */
+ 'char alignas (GCALIGNMENT) gcaligned;' inside a union. */
enum Lisp_Bits
{
@@ -277,20 +277,6 @@ DEFINE_GDB_SYMBOL_END (VALMASK)
error !;
#endif
-/* Use GCALIGNED immediately after the 'struct' keyword to require the
- struct to have an address that is a multiple of GCALIGNMENT. This
- is a no-op if the struct's natural alignment is already a multiple
- of GCALIGNMENT. GCALIGNED's implementation uses the 'aligned'
- attribute instead of 'alignas (GCALIGNMENT)', as the latter would
- fail if an object's natural alignment exceeds GCALIGNMENT. The
- implementation hopes that natural alignment suffices on platforms
- lacking 'aligned'. */
-#ifdef HAVE_STRUCT_ATTRIBUTE_ALIGNED
-# define GCALIGNED __attribute__ ((aligned (GCALIGNMENT)))
-#else
-# define GCALIGNED /* empty */
-#endif
-
/* Some operations are so commonly executed that they are implemented
as macros, not functions, because otherwise runtime performance would
suffer too much when compiling with GCC without optimization.
@@ -338,15 +324,17 @@ error !;
#define lisp_h_MISCP(x) (XTYPE (x) == Lisp_Misc)
#define lisp_h_NILP(x) EQ (x, Qnil)
#define lisp_h_SET_SYMBOL_VAL(sym, v) \
- (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value = (v))
-#define lisp_h_SYMBOL_CONSTANT_P(sym) (XSYMBOL (sym)->trapped_write ==
SYMBOL_NOWRITE)
-#define lisp_h_SYMBOL_TRAPPED_WRITE_P(sym) (XSYMBOL (sym)->trapped_write)
+ (eassert ((sym)->u.s.redirect == SYMBOL_PLAINVAL), \
+ (sym)->u.s.val.value = (v))
+#define lisp_h_SYMBOL_CONSTANT_P(sym) \
+ (XSYMBOL (sym)->u.s.trapped_write == SYMBOL_NOWRITE)
+#define lisp_h_SYMBOL_TRAPPED_WRITE_P(sym) (XSYMBOL (sym)->u.s.trapped_write)
#define lisp_h_SYMBOL_VAL(sym) \
- (eassert ((sym)->redirect == SYMBOL_PLAINVAL), (sym)->val.value)
+ (eassert ((sym)->u.s.redirect == SYMBOL_PLAINVAL), (sym)->u.s.val.value)
#define lisp_h_SYMBOLP(x) (XTYPE (x) == Lisp_Symbol)
#define lisp_h_VECTORLIKEP(x) (XTYPE (x) == Lisp_Vectorlike)
-#define lisp_h_XCAR(c) XCONS (c)->car
-#define lisp_h_XCDR(c) XCONS (c)->u.cdr
+#define lisp_h_XCAR(c) XCONS (c)->u.s.car
+#define lisp_h_XCDR(c) XCONS (c)->u.s.u.cdr
#define lisp_h_XCONS(a) \
(eassert (CONSP (a)), (struct Lisp_Cons *) XUNTAG (a, Lisp_Cons))
#define lisp_h_XHASH(a) XUINT (a)
@@ -676,52 +664,60 @@ enum symbol_trapped_write
struct Lisp_Symbol
{
- bool_bf gcmarkbit : 1;
-
- /* Indicates where the value can be found:
- 0 : it's a plain var, the value is in the `value' field.
- 1 : it's a varalias, the value is really in the `alias' symbol.
- 2 : it's a localized var, the value is in the `blv' object.
- 3 : it's a forwarding variable, the value is in `forward'. */
- ENUM_BF (symbol_redirect) redirect : 3;
-
- /* 0 : normal case, just set the value
- 1 : constant, cannot set, e.g. nil, t, :keywords.
- 2 : trap the write, call watcher functions. */
- ENUM_BF (symbol_trapped_write) trapped_write : 2;
-
- /* Interned state of the symbol. This is an enumerator from
- enum symbol_interned. */
- unsigned interned : 2;
-
- /* True means that this variable has been explicitly declared
- special (with `defvar' etc), and shouldn't be lexically bound. */
- bool_bf declared_special : 1;
-
- /* True if pointed to from purespace and hence can't be GC'd. */
- bool_bf pinned : 1;
-
- /* The symbol's name, as a Lisp string. */
- Lisp_Object name;
-
- /* Value of the symbol or Qunbound if unbound. Which alternative of the
- union is used depends on the `redirect' field above. */
- union {
- Lisp_Object value;
- struct Lisp_Symbol *alias;
- struct Lisp_Buffer_Local_Value *blv;
- union Lisp_Fwd *fwd;
- } val;
-
- /* Function value of the symbol or Qnil if not fboundp. */
- Lisp_Object function;
+ union
+ {
+ struct
+ {
+ bool_bf gcmarkbit : 1;
+
+ /* Indicates where the value can be found:
+ 0 : it's a plain var, the value is in the `value' field.
+ 1 : it's a varalias, the value is really in the `alias' symbol.
+ 2 : it's a localized var, the value is in the `blv' object.
+ 3 : it's a forwarding variable, the value is in `forward'. */
+ ENUM_BF (symbol_redirect) redirect : 3;
+
+ /* 0 : normal case, just set the value
+ 1 : constant, cannot set, e.g. nil, t, :keywords.
+ 2 : trap the write, call watcher functions. */
+ ENUM_BF (symbol_trapped_write) trapped_write : 2;
+
+ /* Interned state of the symbol. This is an enumerator from
+ enum symbol_interned. */
+ unsigned interned : 2;
+
+ /* True means that this variable has been explicitly declared
+ special (with `defvar' etc), and shouldn't be lexically bound. */
+ bool_bf declared_special : 1;
+
+ /* True if pointed to from purespace and hence can't be GC'd. */
+ bool_bf pinned : 1;
+
+ /* The symbol's name, as a Lisp string. */
+ Lisp_Object name;
+
+ /* Value of the symbol or Qunbound if unbound. Which alternative of the
+ union is used depends on the `redirect' field above. */
+ union {
+ Lisp_Object value;
+ struct Lisp_Symbol *alias;
+ struct Lisp_Buffer_Local_Value *blv;
+ union Lisp_Fwd *fwd;
+ } val;
+
+ /* Function value of the symbol or Qnil if not fboundp. */
+ Lisp_Object function;
- /* The symbol's property list. */
- Lisp_Object plist;
+ /* The symbol's property list. */
+ Lisp_Object plist;
- /* Next symbol in obarray bucket, if the symbol is interned. */
- struct Lisp_Symbol *next;
+ /* Next symbol in obarray bucket, if the symbol is interned. */
+ struct Lisp_Symbol *next;
+ } s;
+ char alignas (GCALIGNMENT) gcaligned;
+ } u;
};
+verify (alignof (struct Lisp_Symbol) % GCALIGNMENT == 0);
/* Declare a Lisp-callable function. The MAXARGS parameter has the same
meaning as in the DEFUN macro, and is used to construct a prototype. */
@@ -795,13 +791,13 @@ struct Lisp_Symbol
/* Header of vector-like objects. This documents the layout constraints on
vectors and pseudovectors (objects of PVEC_xxx subtype). It also prevents
compilers from being fooled by Emacs's type punning: XSETPSEUDOVECTOR
- and PSEUDOVECTORP cast their pointers to struct vectorlike_header *,
+ and PSEUDOVECTORP cast their pointers to union vectorlike_header *,
because when two such pointers potentially alias, a compiler won't
incorrectly reorder loads and stores to their size fields. See
Bug#8546. */
-struct vectorlike_header
+union vectorlike_header
{
- /* The only field contains various pieces of information:
+ /* The main member contains various pieces of information:
- The MSB (ARRAY_MARK_FLAG) holds the gcmarkbit.
- The next bit (PSEUDOVECTOR_FLAG) indicates whether this is a plain
vector (0) or a pseudovector (1).
@@ -821,7 +817,9 @@ struct vectorlike_header
Current layout limits the pseudovectors to 63 PVEC_xxx subtypes,
4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots. */
ptrdiff_t size;
+ char alignas (GCALIGNMENT) gcaligned;
};
+verify (alignof (union vectorlike_header) % GCALIGNMENT == 0);
INLINE bool
(SYMBOLP) (Lisp_Object x)
@@ -853,7 +851,7 @@ make_lisp_symbol (struct Lisp_Symbol *sym)
INLINE Lisp_Object
builtin_lisp_symbol (int index)
{
- return make_lisp_symbol (&lispsym[index].s);
+ return make_lisp_symbol (&lispsym[index]);
}
INLINE void
@@ -1093,10 +1091,10 @@ INLINE bool
| ((restsize) << PSEUDOVECTOR_SIZE_BITS) \
| (lispsize)))
-/* The cast to struct vectorlike_header * avoids aliasing issues. */
+/* The cast to union vectorlike_header * avoids aliasing issues. */
#define XSETPSEUDOVECTOR(a, b, code) \
XSETTYPED_PSEUDOVECTOR (a, b, \
- (((struct vectorlike_header *) \
+ (((union vectorlike_header *) \
XUNTAG (a, Lisp_Vectorlike)) \
->size), \
code)
@@ -1143,20 +1141,28 @@ make_pointer_integer (void *p)
typedef struct interval *INTERVAL;
-struct GCALIGNED Lisp_Cons
+struct Lisp_Cons
+{
+ union
{
- /* Car of this cons cell. */
- Lisp_Object car;
-
- union
+ struct
{
- /* Cdr of this cons cell. */
- Lisp_Object cdr;
-
- /* Used to chain conses on a free list. */
- struct Lisp_Cons *chain;
- } u;
- };
+ /* Car of this cons cell. */
+ Lisp_Object car;
+
+ union
+ {
+ /* Cdr of this cons cell. */
+ Lisp_Object cdr;
+
+ /* Used to chain conses on a free list. */
+ struct Lisp_Cons *chain;
+ } u;
+ } s;
+ char alignas (GCALIGNMENT) gcaligned;
+ } u;
+};
+verify (alignof (struct Lisp_Cons) % GCALIGNMENT == 0);
INLINE bool
(NILP) (Lisp_Object x)
@@ -1192,12 +1198,12 @@ INLINE struct Lisp_Cons *
INLINE Lisp_Object *
xcar_addr (Lisp_Object c)
{
- return &XCONS (c)->car;
+ return &XCONS (c)->u.s.car;
}
INLINE Lisp_Object *
xcdr_addr (Lisp_Object c)
{
- return &XCONS (c)->u.cdr;
+ return &XCONS (c)->u.s.u.cdr;
}
/* Use these from normal code. */
@@ -1261,15 +1267,24 @@ CDR_SAFE (Lisp_Object c)
return CONSP (c) ? XCDR (c) : Qnil;
}
-/* In a string or vector, the sign bit of the `size' is the gc mark bit. */
+/* In a string or vector, the sign bit of u.s.size is the gc mark bit. */
-struct GCALIGNED Lisp_String
+struct Lisp_String
+{
+ union
{
- ptrdiff_t size;
- ptrdiff_t size_byte;
- INTERVAL intervals; /* Text properties in this string. */
- unsigned char *data;
- };
+ struct
+ {
+ ptrdiff_t size;
+ ptrdiff_t size_byte;
+ INTERVAL intervals; /* Text properties in this string. */
+ unsigned char *data;
+ } s;
+ struct Lisp_String *next;
+ char alignas (GCALIGNMENT) gcaligned;
+ } u;
+};
+verify (alignof (struct Lisp_String) % GCALIGNMENT == 0);
INLINE bool
STRINGP (Lisp_Object x)
@@ -1294,7 +1309,7 @@ XSTRING (Lisp_Object a)
INLINE bool
STRING_MULTIBYTE (Lisp_Object str)
{
- return 0 <= XSTRING (str)->size_byte;
+ return 0 <= XSTRING (str)->u.s.size_byte;
}
/* An upper bound on the number of bytes in a Lisp string, not
@@ -1316,20 +1331,20 @@ STRING_MULTIBYTE (Lisp_Object str)
/* Mark STR as a unibyte string. */
#define STRING_SET_UNIBYTE(STR) \
do { \
- if (XSTRING (STR)->size == 0) \
+ if (XSTRING (STR)->u.s.size == 0) \
(STR) = empty_unibyte_string; \
else \
- XSTRING (STR)->size_byte = -1; \
+ XSTRING (STR)->u.s.size_byte = -1; \
} while (false)
/* Mark STR as a multibyte string. Assure that STR contains only
ASCII characters in advance. */
#define STRING_SET_MULTIBYTE(STR) \
do { \
- if (XSTRING (STR)->size == 0) \
+ if (XSTRING (STR)->u.s.size == 0) \
(STR) = empty_multibyte_string; \
else \
- XSTRING (STR)->size_byte = XSTRING (STR)->size; \
+ XSTRING (STR)->u.s.size_byte = XSTRING (STR)->u.s.size; \
} while (false)
/* Convenience functions for dealing with Lisp strings. */
@@ -1337,7 +1352,7 @@ STRING_MULTIBYTE (Lisp_Object str)
INLINE unsigned char *
SDATA (Lisp_Object string)
{
- return XSTRING (string)->data;
+ return XSTRING (string)->u.s.data;
}
INLINE char *
SSDATA (Lisp_Object string)
@@ -1358,7 +1373,7 @@ SSET (Lisp_Object string, ptrdiff_t index, unsigned char
new)
INLINE ptrdiff_t
SCHARS (Lisp_Object string)
{
- ptrdiff_t nchars = XSTRING (string)->size;
+ ptrdiff_t nchars = XSTRING (string)->u.s.size;
eassume (0 <= nchars);
return nchars;
}
@@ -1372,7 +1387,7 @@ STRING_BYTES (struct Lisp_String *s)
#ifdef GC_CHECK_STRING_BYTES
ptrdiff_t nbytes = string_bytes (s);
#else
- ptrdiff_t nbytes = s->size_byte < 0 ? s->size : s->size_byte;
+ ptrdiff_t nbytes = s->u.s.size_byte < 0 ? s->u.s.size : s->u.s.size_byte;
#endif
eassume (0 <= nbytes);
return nbytes;
@@ -1391,14 +1406,14 @@ STRING_SET_CHARS (Lisp_Object string, ptrdiff_t newsize)
eassert (STRING_MULTIBYTE (string)
? 0 <= newsize && newsize <= SBYTES (string)
: newsize == SCHARS (string));
- XSTRING (string)->size = newsize;
+ XSTRING (string)->u.s.size = newsize;
}
/* A regular vector is just a header plus an array of Lisp_Objects. */
struct Lisp_Vector
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object contents[FLEXIBLE_ARRAY_MEMBER];
};
@@ -1455,7 +1470,7 @@ PSEUDOVECTOR_TYPE (struct Lisp_Vector *v)
/* Can't be used with PVEC_NORMAL_VECTOR. */
INLINE bool
-PSEUDOVECTOR_TYPEP (struct vectorlike_header *a, enum pvec_type code)
+PSEUDOVECTOR_TYPEP (union vectorlike_header *a, enum pvec_type code)
{
/* We don't use PSEUDOVECTOR_TYPE here so as to avoid a shift
* operation when `code' is known. */
@@ -1471,8 +1486,8 @@ PSEUDOVECTORP (Lisp_Object a, int code)
return false;
else
{
- /* Converting to struct vectorlike_header * avoids aliasing issues. */
- struct vectorlike_header *h = XUNTAG (a, Lisp_Vectorlike);
+ /* Converting to union vectorlike_header * avoids aliasing issues. */
+ union vectorlike_header *h = XUNTAG (a, Lisp_Vectorlike);
return PSEUDOVECTOR_TYPEP (h, code);
}
}
@@ -1483,7 +1498,7 @@ struct Lisp_Bool_Vector
{
/* HEADER.SIZE is the vector's size field. It doesn't have the real size,
just the subtype information. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* This is the size in bits. */
EMACS_INT size;
/* The actual bits, packed into bytes.
@@ -1696,7 +1711,7 @@ struct Lisp_Char_Table
pseudovector type information. It holds the size, too.
The size counts the defalt, parent, purpose, ascii,
contents, and extras slots. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* This holds a default value,
which is used whenever the value for a specific character is nil. */
@@ -1738,7 +1753,7 @@ struct Lisp_Sub_Char_Table
{
/* HEADER.SIZE is the vector's size field, which also holds the
pseudovector type information. It holds the size, too. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Depth of this sub char-table. It should be 1, 2, or 3. A sub
char-table of depth 1 contains 16 elements, and each element
@@ -1813,7 +1828,7 @@ CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Object val)
struct Lisp_Subr
{
- struct vectorlike_header header;
+ union vectorlike_header header;
union {
Lisp_Object (*a0) (void);
Lisp_Object (*a1) (Lisp_Object);
@@ -1909,20 +1924,20 @@ INLINE Lisp_Object
INLINE struct Lisp_Symbol *
SYMBOL_ALIAS (struct Lisp_Symbol *sym)
{
- eassume (sym->redirect == SYMBOL_VARALIAS && sym->val.alias);
- return sym->val.alias;
+ eassume (sym->u.s.redirect == SYMBOL_VARALIAS && sym->u.s.val.alias);
+ return sym->u.s.val.alias;
}
INLINE struct Lisp_Buffer_Local_Value *
SYMBOL_BLV (struct Lisp_Symbol *sym)
{
- eassume (sym->redirect == SYMBOL_LOCALIZED && sym->val.blv);
- return sym->val.blv;
+ eassume (sym->u.s.redirect == SYMBOL_LOCALIZED && sym->u.s.val.blv);
+ return sym->u.s.val.blv;
}
INLINE union Lisp_Fwd *
SYMBOL_FWD (struct Lisp_Symbol *sym)
{
- eassume (sym->redirect == SYMBOL_FORWARDED && sym->val.fwd);
- return sym->val.fwd;
+ eassume (sym->u.s.redirect == SYMBOL_FORWARDED && sym->u.s.val.fwd);
+ return sym->u.s.val.fwd;
}
INLINE void
@@ -1934,26 +1949,26 @@ INLINE void
INLINE void
SET_SYMBOL_ALIAS (struct Lisp_Symbol *sym, struct Lisp_Symbol *v)
{
- eassume (sym->redirect == SYMBOL_VARALIAS && v);
- sym->val.alias = v;
+ eassume (sym->u.s.redirect == SYMBOL_VARALIAS && v);
+ sym->u.s.val.alias = v;
}
INLINE void
SET_SYMBOL_BLV (struct Lisp_Symbol *sym, struct Lisp_Buffer_Local_Value *v)
{
- eassume (sym->redirect == SYMBOL_LOCALIZED && v);
- sym->val.blv = v;
+ eassume (sym->u.s.redirect == SYMBOL_LOCALIZED && v);
+ sym->u.s.val.blv = v;
}
INLINE void
SET_SYMBOL_FWD (struct Lisp_Symbol *sym, union Lisp_Fwd *v)
{
- eassume (sym->redirect == SYMBOL_FORWARDED && v);
- sym->val.fwd = v;
+ eassume (sym->u.s.redirect == SYMBOL_FORWARDED && v);
+ sym->u.s.val.fwd = v;
}
INLINE Lisp_Object
SYMBOL_NAME (Lisp_Object sym)
{
- return XSYMBOL (sym)->name;
+ return XSYMBOL (sym)->u.s.name;
}
/* Value is true if SYM is an interned symbol. */
@@ -1961,7 +1976,7 @@ SYMBOL_NAME (Lisp_Object sym)
INLINE bool
SYMBOL_INTERNED_P (Lisp_Object sym)
{
- return XSYMBOL (sym)->interned != SYMBOL_UNINTERNED;
+ return XSYMBOL (sym)->u.s.interned != SYMBOL_UNINTERNED;
}
/* Value is true if SYM is interned in initial_obarray. */
@@ -1969,7 +1984,7 @@ SYMBOL_INTERNED_P (Lisp_Object sym)
INLINE bool
SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (Lisp_Object sym)
{
- return XSYMBOL (sym)->interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
+ return XSYMBOL (sym)->u.s.interned == SYMBOL_INTERNED_IN_INITIAL_OBARRAY;
}
/* Value is non-zero if symbol cannot be changed through a simple set,
@@ -2025,7 +2040,7 @@ struct hash_table_test
struct Lisp_Hash_Table
{
/* This is for Lisp; the hash table code does not refer to it. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Nil if table is non-weak. Otherwise a symbol describing the
weakness of the table. */
@@ -2945,7 +2960,7 @@ CHECK_NUMBER_CDR (Lisp_Object x)
/* This version of DEFUN declares a function prototype with the right
arguments, so we can catch errors with maxargs at compile-time. */
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
- static struct GCALIGNED Lisp_Subr sname = \
+ static struct Lisp_Subr sname = \
{ { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },
\
{ .a ## maxargs = fnname }, \
minargs, maxargs, lname, intspec, 0}; \
@@ -3212,25 +3227,25 @@ set_hash_value_slot (struct Lisp_Hash_Table *h,
ptrdiff_t idx, Lisp_Object val)
INLINE void
set_symbol_function (Lisp_Object sym, Lisp_Object function)
{
- XSYMBOL (sym)->function = function;
+ XSYMBOL (sym)->u.s.function = function;
}
INLINE void
set_symbol_plist (Lisp_Object sym, Lisp_Object plist)
{
- XSYMBOL (sym)->plist = plist;
+ XSYMBOL (sym)->u.s.plist = plist;
}
INLINE void
set_symbol_next (Lisp_Object sym, struct Lisp_Symbol *next)
{
- XSYMBOL (sym)->next = next;
+ XSYMBOL (sym)->u.s.next = next;
}
INLINE void
make_symbol_constant (Lisp_Object sym)
{
- XSYMBOL (sym)->trapped_write = SYMBOL_NOWRITE;
+ XSYMBOL (sym)->u.s.trapped_write = SYMBOL_NOWRITE;
}
/* Buffer-local variable access functions. */
@@ -3255,7 +3270,7 @@ set_overlay_plist (Lisp_Object overlay, Lisp_Object plist)
INLINE INTERVAL
string_intervals (Lisp_Object s)
{
- return XSTRING (s)->intervals;
+ return XSTRING (s)->u.s.intervals;
}
/* Set text properties of S to I. */
@@ -3263,7 +3278,7 @@ string_intervals (Lisp_Object s)
INLINE void
set_string_intervals (Lisp_Object s, INTERVAL i)
{
- XSTRING (s)->intervals = i;
+ XSTRING (s)->u.s.intervals = i;
}
/* Set a Lisp slot in TABLE to VAL. Most code should use this instead
@@ -3917,7 +3932,7 @@ typedef emacs_value (*emacs_subr) (emacs_env *, ptrdiff_t,
struct Lisp_Module_Function
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Fields traced by GC; these must come first. */
Lisp_Object documentation;
@@ -4588,20 +4603,6 @@ enum { defined_GC_CHECK_STRING_BYTES = true };
enum { defined_GC_CHECK_STRING_BYTES = false };
#endif
-/* Struct inside unions that are typically no larger and aligned enough. */
-
-union Aligned_Cons
-{
- struct Lisp_Cons s;
- double d; intmax_t i; void *p;
-};
-
-union Aligned_String
-{
- struct Lisp_String s;
- double d; intmax_t i; void *p;
-};
-
/* True for stack-based cons and string implementations, respectively.
Use stack-based strings only if stack-based cons also works.
Otherwise, STACK_CONS would create heap-based cons cells that
@@ -4609,18 +4610,16 @@ union Aligned_String
enum
{
- USE_STACK_CONS = (USE_STACK_LISP_OBJECTS
- && alignof (union Aligned_Cons) % GCALIGNMENT == 0),
+ USE_STACK_CONS = USE_STACK_LISP_OBJECTS,
USE_STACK_STRING = (USE_STACK_CONS
- && !defined_GC_CHECK_STRING_BYTES
- && alignof (union Aligned_String) % GCALIGNMENT == 0)
+ && !defined_GC_CHECK_STRING_BYTES)
};
/* Auxiliary macros used for auto allocation of Lisp objects. Please
use these only in macros like AUTO_CONS that declare a local
variable whose lifetime will be clear to the programmer. */
#define STACK_CONS(a, b) \
- make_lisp_ptr (&((union Aligned_Cons) { { a, { b } } }).s, Lisp_Cons)
+ make_lisp_ptr (&((struct Lisp_Cons) {{{a, {b}}}}), Lisp_Cons)
#define AUTO_CONS_EXPR(a, b) \
(USE_STACK_CONS ? STACK_CONS (a, b) : Fcons (a, b))
@@ -4666,7 +4665,7 @@ enum
Lisp_Object name = \
(USE_STACK_STRING \
? (make_lisp_ptr \
- ((&((union Aligned_String) {{len, -1, 0, (unsigned char *) (str)}}).s),
\
+ ((&(struct Lisp_String) {{{len, -1, 0, (unsigned char *) (str)}}}), \
Lisp_String)) \
: make_unibyte_string (str, len))
diff --git a/src/lread.c b/src/lread.c
index 19ed072..17463f4 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4043,14 +4043,14 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray,
Lisp_Object index)
{
Lisp_Object *ptr;
- XSYMBOL (sym)->interned = (EQ (obarray, initial_obarray)
- ? SYMBOL_INTERNED_IN_INITIAL_OBARRAY
- : SYMBOL_INTERNED);
+ XSYMBOL (sym)->u.s.interned = (EQ (obarray, initial_obarray)
+ ? SYMBOL_INTERNED_IN_INITIAL_OBARRAY
+ : SYMBOL_INTERNED);
if (SREF (SYMBOL_NAME (sym), 0) == ':' && EQ (obarray, initial_obarray))
{
make_symbol_constant (sym);
- XSYMBOL (sym)->redirect = SYMBOL_PLAINVAL;
+ XSYMBOL (sym)->u.s.redirect = SYMBOL_PLAINVAL;
SET_SYMBOL_VAL (XSYMBOL (sym), sym);
}
@@ -4203,16 +4203,16 @@ usage: (unintern NAME OBARRAY) */)
/* if (EQ (tem, Qnil) || EQ (tem, Qt))
error ("Attempt to unintern t or nil"); */
- XSYMBOL (tem)->interned = SYMBOL_UNINTERNED;
+ XSYMBOL (tem)->u.s.interned = SYMBOL_UNINTERNED;
hash = oblookup_last_bucket_number;
if (EQ (AREF (obarray, hash), tem))
{
- if (XSYMBOL (tem)->next)
+ if (XSYMBOL (tem)->u.s.next)
{
Lisp_Object sym;
- XSETSYMBOL (sym, XSYMBOL (tem)->next);
+ XSETSYMBOL (sym, XSYMBOL (tem)->u.s.next);
ASET (obarray, hash, sym);
}
else
@@ -4223,13 +4223,13 @@ usage: (unintern NAME OBARRAY) */)
Lisp_Object tail, following;
for (tail = AREF (obarray, hash);
- XSYMBOL (tail)->next;
+ XSYMBOL (tail)->u.s.next;
tail = following)
{
- XSETSYMBOL (following, XSYMBOL (tail)->next);
+ XSETSYMBOL (following, XSYMBOL (tail)->u.s.next);
if (EQ (following, tem))
{
- set_symbol_next (tail, XSYMBOL (following)->next);
+ set_symbol_next (tail, XSYMBOL (following)->u.s.next);
break;
}
}
@@ -4264,13 +4264,13 @@ oblookup (Lisp_Object obarray, register const char
*ptr, ptrdiff_t size, ptrdiff
else if (!SYMBOLP (bucket))
error ("Bad data in guts of obarray"); /* Like CADR error message. */
else
- for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->next))
+ for (tail = bucket; ; XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next))
{
if (SBYTES (SYMBOL_NAME (tail)) == size_byte
&& SCHARS (SYMBOL_NAME (tail)) == size
&& !memcmp (SDATA (SYMBOL_NAME (tail)), ptr, size_byte))
return tail;
- else if (XSYMBOL (tail)->next == 0)
+ else if (XSYMBOL (tail)->u.s.next == 0)
break;
}
XSETINT (tem, hash);
@@ -4290,9 +4290,9 @@ map_obarray (Lisp_Object obarray, void (*fn)
(Lisp_Object, Lisp_Object), Lisp_Ob
while (1)
{
(*fn) (tail, arg);
- if (XSYMBOL (tail)->next == 0)
+ if (XSYMBOL (tail)->u.s.next == 0)
break;
- XSETSYMBOL (tail, XSYMBOL (tail)->next);
+ XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next);
}
}
}
@@ -4332,12 +4332,12 @@ init_obarray (void)
DEFSYM (Qnil, "nil");
SET_SYMBOL_VAL (XSYMBOL (Qnil), Qnil);
make_symbol_constant (Qnil);
- XSYMBOL (Qnil)->declared_special = true;
+ XSYMBOL (Qnil)->u.s.declared_special = true;
DEFSYM (Qt, "t");
SET_SYMBOL_VAL (XSYMBOL (Qt), Qt);
make_symbol_constant (Qt);
- XSYMBOL (Qt)->declared_special = true;
+ XSYMBOL (Qt)->u.s.declared_special = true;
/* Qt is correct even if CANNOT_DUMP. loadup.el will set to nil at end. */
Vpurify_flag = Qt;
@@ -4361,7 +4361,7 @@ defalias (struct Lisp_Subr *sname, char *string)
{
Lisp_Object sym;
sym = intern (string);
- XSETSUBR (XSYMBOL (sym)->function, sname);
+ XSETSUBR (XSYMBOL (sym)->u.s.function, sname);
}
#endif /* NOTDEF */
@@ -4376,8 +4376,8 @@ defvar_int (struct Lisp_Intfwd *i_fwd,
sym = intern_c_string (namestring);
i_fwd->type = Lisp_Fwd_Int;
i_fwd->intvar = address;
- XSYMBOL (sym)->declared_special = 1;
- XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+ XSYMBOL (sym)->u.s.declared_special = true;
+ XSYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)i_fwd);
}
@@ -4391,8 +4391,8 @@ defvar_bool (struct Lisp_Boolfwd *b_fwd,
sym = intern_c_string (namestring);
b_fwd->type = Lisp_Fwd_Bool;
b_fwd->boolvar = address;
- XSYMBOL (sym)->declared_special = 1;
- XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+ XSYMBOL (sym)->u.s.declared_special = true;
+ XSYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)b_fwd);
Vbyte_boolean_vars = Fcons (sym, Vbyte_boolean_vars);
}
@@ -4410,8 +4410,8 @@ defvar_lisp_nopro (struct Lisp_Objfwd *o_fwd,
sym = intern_c_string (namestring);
o_fwd->type = Lisp_Fwd_Obj;
o_fwd->objvar = address;
- XSYMBOL (sym)->declared_special = 1;
- XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+ XSYMBOL (sym)->u.s.declared_special = true;
+ XSYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)o_fwd);
}
@@ -4434,8 +4434,8 @@ defvar_kboard (struct Lisp_Kboard_Objfwd *ko_fwd,
sym = intern_c_string (namestring);
ko_fwd->type = Lisp_Fwd_Kboard_Obj;
ko_fwd->offset = offset;
- XSYMBOL (sym)->declared_special = 1;
- XSYMBOL (sym)->redirect = SYMBOL_FORWARDED;
+ XSYMBOL (sym)->u.s.declared_special = true;
+ XSYMBOL (sym)->u.s.redirect = SYMBOL_FORWARDED;
SET_SYMBOL_FWD (XSYMBOL (sym), (union Lisp_Fwd *)ko_fwd);
}
@@ -4769,7 +4769,7 @@ to find all the symbols in an obarray, use `mapatoms'.
*/);
DEFVAR_LISP ("values", Vvalues,
doc: /* List of values of all expressions which were read,
evaluated and printed.
Order is reverse chronological. */);
- XSYMBOL (intern ("values"))->declared_special = 0;
+ XSYMBOL (intern ("values"))->u.s.declared_special = true;
DEFVAR_LISP ("standard-input", Vstandard_input,
doc: /* Stream for read to get input from.
diff --git a/src/minibuf.c b/src/minibuf.c
index a2f3324..913c930 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1280,8 +1280,8 @@ is used to further constrain the set of candidates. */)
error ("Bad data in guts of obarray");
elt = bucket;
eltstring = elt;
- if (XSYMBOL (bucket)->next)
- XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
+ if (XSYMBOL (bucket)->u.s.next)
+ XSETSYMBOL (bucket, XSYMBOL (bucket)->u.s.next);
else
XSETFASTINT (bucket, 0);
}
@@ -1533,8 +1533,8 @@ with a space are ignored unless STRING itself starts with
a space. */)
error ("Bad data in guts of obarray");
elt = bucket;
eltstring = elt;
- if (XSYMBOL (bucket)->next)
- XSETSYMBOL (bucket, XSYMBOL (bucket)->next);
+ if (XSYMBOL (bucket)->u.s.next)
+ XSETSYMBOL (bucket, XSYMBOL (bucket)->u.s.next);
else
XSETFASTINT (bucket, 0);
}
@@ -1754,9 +1754,9 @@ the values STRING, PREDICATE and `lambda'. */)
tem = tail;
break;
}
- if (XSYMBOL (tail)->next == 0)
+ if (XSYMBOL (tail)->u.s.next == 0)
break;
- XSETSYMBOL (tail, XSYMBOL (tail)->next);
+ XSETSYMBOL (tail, XSYMBOL (tail)->u.s.next);
}
}
}
diff --git a/src/process.h b/src/process.h
index 5a044f6..5670f44 100644
--- a/src/process.h
+++ b/src/process.h
@@ -41,7 +41,7 @@ enum { PROCESS_OPEN_FDS = 6 };
struct Lisp_Process
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Name of subprocess terminal. */
Lisp_Object tty_name;
diff --git a/src/termhooks.h b/src/termhooks.h
index dd6044a..fe4e993 100644
--- a/src/termhooks.h
+++ b/src/termhooks.h
@@ -373,7 +373,7 @@ extern struct tty_display_info *gpm_tty;
struct terminal
{
/* This is for Lisp; the terminal code does not refer to it. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Parameter alist of this terminal. */
Lisp_Object param_alist;
diff --git a/src/thread.c b/src/thread.c
index 7335833..c03cdda 100644
--- a/src/thread.c
+++ b/src/thread.c
@@ -26,7 +26,7 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include "coding.h"
#include "syssignal.h"
-static struct GCALIGNED thread_state main_thread;
+static struct thread_state main_thread;
struct thread_state *current_thread = &main_thread;
diff --git a/src/thread.h b/src/thread.h
index 19baafb..1845974 100644
--- a/src/thread.h
+++ b/src/thread.h
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
struct thread_state
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The buffer in which the last search was performed, or
Qt if the last search was done in a string;
@@ -230,7 +230,7 @@ typedef struct
/* A mutex as a lisp object. */
struct Lisp_Mutex
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The name of the mutex, or nil. */
Lisp_Object name;
@@ -261,7 +261,7 @@ XMUTEX (Lisp_Object a)
/* A condition variable as a lisp object. */
struct Lisp_CondVar
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The associated mutex. */
Lisp_Object mutex;
diff --git a/src/w32term.h b/src/w32term.h
index 8d08ca0..de234cb 100644
--- a/src/w32term.h
+++ b/src/w32term.h
@@ -431,7 +431,7 @@ extern struct w32_output w32term_display;
struct scroll_bar {
/* This field is shared by all vectors. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The window we're a scroll bar for. */
Lisp_Object window;
diff --git a/src/window.c b/src/window.c
index cc1d2a7..7f47252 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3733,8 +3733,8 @@ make_parent_window (Lisp_Object window, bool horflag)
o = XWINDOW (window);
p = allocate_window ();
- memcpy ((char *) p + sizeof (struct vectorlike_header),
- (char *) o + sizeof (struct vectorlike_header),
+ memcpy ((char *) p + sizeof (union vectorlike_header),
+ (char *) o + sizeof (union vectorlike_header),
word_size * VECSIZE (struct window));
/* P's buffer slot may change from nil to a buffer... */
adjust_window_count (p, 1);
@@ -6232,7 +6232,7 @@ from the top of the window. */)
struct save_window_data
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object selected_frame;
Lisp_Object current_window;
Lisp_Object f_current_buffer;
@@ -6260,7 +6260,7 @@ struct save_window_data
/* This is saved as a Lisp_Vector. */
struct saved_window
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object window, buffer, start, pointm, old_pointm;
Lisp_Object pixel_left, pixel_top, pixel_height, pixel_width;
diff --git a/src/window.h b/src/window.h
index df7c23f..25c9686 100644
--- a/src/window.h
+++ b/src/window.h
@@ -88,7 +88,7 @@ struct cursor_pos
struct window
{
/* This is for Lisp; the terminal code does not refer to it. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The frame this window is on. */
Lisp_Object frame;
diff --git a/src/xterm.c b/src/xterm.c
index e11cde7..28abfae 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -231,7 +231,7 @@ static void x_sync_with_move (struct frame *, int, int,
bool);
static int handle_one_xevent (struct x_display_info *,
const XEvent *, int *,
struct input_event *);
-#if ! (defined USE_X_TOOLKIT || defined USE_MOTIF)
+#if ! (defined USE_X_TOOLKIT || defined USE_MOTIF) && defined USE_GTK
static int x_dispatch_event (XEvent *, Display *);
#endif
static void x_wm_set_window_state (struct frame *, int);
@@ -9047,6 +9047,8 @@ handle_one_xevent (struct x_display_info *dpyinfo,
return count;
}
+#if defined USE_X_TOOLKIT || defined USE_MOTIF || defined USE_GTK
+
/* Handles the XEvent EVENT on display DISPLAY.
This is used for event loops outside the normal event handling,
i.e. looping while a popup menu or a dialog is posted.
@@ -9065,6 +9067,7 @@ x_dispatch_event (XEvent *event, Display *display)
return finish;
}
+#endif
/* Read events coming from the X server.
Return as soon as there are no more events to be read.
@@ -12512,7 +12515,7 @@ x_term_init (Lisp_Object display_name, char
*xrm_option, char *resource_name)
{
terminal->kboard = allocate_kboard (Qx);
- if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->function, Qunbound))
+ if (!EQ (XSYMBOL (Qvendor_specific_keysyms)->u.s.function, Qunbound))
{
char *vendor = ServerVendor (dpy);
diff --git a/src/xterm.h b/src/xterm.h
index 6274630..7ab20ba 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -887,7 +887,7 @@ extern void x_mark_frame_dirty (struct frame *f);
struct scroll_bar
{
/* These fields are shared by all vectors. */
- struct vectorlike_header header;
+ union vectorlike_header header;
/* The window we're a scroll bar for. */
Lisp_Object window;
diff --git a/src/xwidget.h b/src/xwidget.h
index 22a8eb3..02a0453d 100644
--- a/src/xwidget.h
+++ b/src/xwidget.h
@@ -33,7 +33,7 @@ struct window;
struct xwidget
{
- struct vectorlike_header header;
+ union vectorlike_header header;
/* Auxiliary data. */
Lisp_Object plist;
@@ -62,7 +62,7 @@ struct xwidget
struct xwidget_view
{
- struct vectorlike_header header;
+ union vectorlike_header header;
Lisp_Object model;
Lisp_Object w;
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 5a7134f..7a7cf93 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1878,7 +1878,7 @@ This checks also `file-name-as-directory',
`file-name-directory',
"Check `copy-file'."
(skip-unless (tramp--test-enabled))
- ;; TODO: The quoted case does not work.
+ ;; TODO: The quoted case does not work. Copy local file to remote.
;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
(let (quoted)
(let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
@@ -2921,7 +2921,188 @@ This tests also `make-symbolic-link', `file-truename'
and `add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-file tmp-name))))))
-(ert-deftest tramp-test24-file-name-completion ()
+(ert-deftest tramp-test24-file-acl ()
+ "Check that `file-acl' and `set-file-acl' work proper."
+ (skip-unless (tramp--test-enabled))
+ (skip-unless (file-acl tramp-test-temporary-file-directory))
+
+ ;; TODO: The quoted case does not work. Copy local file to remote.
+ ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
+ (let (quoted)
+ (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
+ (tmp-name2 (tramp--test-make-temp-name nil quoted))
+ (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
+ ;; Both files are remote.
+ (unwind-protect
+ (progn
+ ;; Two files with same ACLs.
+ (write-region "foo" nil tmp-name1)
+ (should (file-exists-p tmp-name1))
+ (should (file-acl tmp-name1))
+ (copy-file tmp-name1 tmp-name2)
+ (should (file-acl tmp-name2))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name2)))
+ ;; Different permissions mean different ACLs.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name2 #o444)
+ (should-not
+ (string-equal (file-acl tmp-name1) (file-acl tmp-name2)))
+ ;; Copy ACL.
+ (should (set-file-acl tmp-name2 (file-acl tmp-name1)))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name2)))
+ ;; An invalid ACL does not harm.
+ (should-not (set-file-acl tmp-name2 "foo")))
+
+ ;; Cleanup.
+ (ignore-errors (delete-file tmp-name1))
+ (ignore-errors (delete-file tmp-name2)))
+
+ ;; Remote and local file.
+ (unwind-protect
+ (when (and (file-acl temporary-file-directory)
+ (not (tramp--test-windows-nt-or-smb-p)))
+ ;; Two files with same ACLs.
+ (write-region "foo" nil tmp-name1)
+ (should (file-exists-p tmp-name1))
+ (should (file-acl tmp-name1))
+ (copy-file tmp-name1 tmp-name3)
+ (should (file-acl tmp-name3))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3)))
+ ;; Different permissions mean different ACLs.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name3 #o444)
+ (should-not
+ (string-equal (file-acl tmp-name1) (file-acl tmp-name3)))
+ ;; Copy ACL.
+ (set-file-acl tmp-name3 (file-acl tmp-name1))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3)))
+
+ ;; Two files with same ACLs.
+ (delete-file tmp-name1)
+ (copy-file tmp-name3 tmp-name1)
+ (should (file-acl tmp-name1))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3)))
+ ;; Different permissions mean different ACLs.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name3 #o444)
+ (should-not
+ (string-equal (file-acl tmp-name1) (file-acl tmp-name3)))
+ ;; Copy ACL.
+ (set-file-acl tmp-name1 (file-acl tmp-name3))
+ (should (string-equal (file-acl tmp-name1) (file-acl tmp-name3))))
+
+ ;; Cleanup.
+ (ignore-errors (delete-file tmp-name1))
+ (ignore-errors (delete-file tmp-name3))))))
+
+;; TODO: This test didn't run in reality yet. Pls report if it
+;; doesn't work as expected.
+(ert-deftest tramp-test25-file-selinux ()
+ "Check `file-selinux-context' and `set-file-selinux-context'."
+ (skip-unless (tramp--test-enabled))
+ (skip-unless
+ (not (equal (file-selinux-context tramp-test-temporary-file-directory)
+ '(nil nil nil nil))))
+
+ ;; TODO: The quoted case does not work. Copy local file to remote.
+ ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil)))
+ (let (quoted)
+ (let ((tmp-name1 (tramp--test-make-temp-name nil quoted))
+ (tmp-name2 (tramp--test-make-temp-name nil quoted))
+ (tmp-name3 (tramp--test-make-temp-name 'local quoted)))
+ ;; Both files are remote.
+ (unwind-protect
+ (progn
+ ;; Two files with same SELINUX context.
+ (write-region "foo" nil tmp-name1)
+ (should (file-exists-p tmp-name1))
+ (should (file-selinux-context tmp-name1))
+ (copy-file tmp-name1 tmp-name2)
+ (should (file-selinux-context tmp-name2))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name2)))
+ ;; Different permissions mean different SELINUX context.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name2 #o444)
+ (should-not
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name2)))
+ ;; Copy SELINUX context.
+ (should
+ (set-file-selinux-context
+ tmp-name2 (file-selinux-context tmp-name1)))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name2)))
+ ;; An invalid SELINUX context does not harm.
+ (should-not (set-file-selinux-context tmp-name2 "foo")))
+
+ ;; Cleanup.
+ (ignore-errors (delete-file tmp-name1))
+ (ignore-errors (delete-file tmp-name2)))
+
+ ;; Remote and local file.
+ (unwind-protect
+ (when (not (or (equal (file-selinux-context temporary-file-directory)
+ '(nil nil nil nil))
+ (tramp--test-windows-nt-or-smb-p)))
+ ;; Two files with same SELINUX context.
+ (write-region "foo" nil tmp-name1)
+ (should (file-exists-p tmp-name1))
+ (should (file-selinux-context tmp-name1))
+ (copy-file tmp-name1 tmp-name3)
+ (should (file-selinux-context tmp-name3))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3)))
+ ;; Different permissions mean different SELINUX context.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name3 #o444)
+ (should-not
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3)))
+ ;; Copy SELINUX context.
+ (set-file-selinux-context
+ tmp-name3 (file-selinux-context tmp-name1))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3)))
+
+ ;; Two files with same SELINUX context.
+ (delete-file tmp-name1)
+ (copy-file tmp-name3 tmp-name1)
+ (should (file-selinux-context tmp-name1))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3)))
+ ;; Different permissions mean different SELINUX context.
+ (set-file-modes tmp-name1 #o777)
+ (set-file-modes tmp-name3 #o444)
+ (should-not
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3)))
+ ;; Copy SELINUX context.
+ (set-file-selinux-context
+ tmp-name1 (file-selinux-context tmp-name2))
+ (should
+ (equal
+ (file-selinux-context tmp-name1)
+ (file-selinux-context tmp-name3))))
+
+ ;; Cleanup.
+ (ignore-errors (delete-file tmp-name1))
+ (ignore-errors (delete-file tmp-name3))))))
+
+(ert-deftest tramp-test26-file-name-completion ()
"Check `file-name-completion' and `file-name-all-completions'."
(skip-unless (tramp--test-enabled))
@@ -3046,7 +3227,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-directory tmp-name 'recursive)))))))
-(ert-deftest tramp-test25-load ()
+(ert-deftest tramp-test27-load ()
"Check `load'."
(skip-unless (tramp--test-enabled))
@@ -3069,7 +3250,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(and (featurep 'tramp-test-load) (unload-feature 'tramp-test-load))
(delete-file tmp-name))))))
-(ert-deftest tramp-test26-process-file ()
+(ert-deftest tramp-test28-process-file ()
"Check `process-file'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3115,7 +3296,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-file tmp-name))))))
-(ert-deftest tramp-test27-start-file-process ()
+(ert-deftest tramp-test29-start-file-process ()
"Check `start-file-process'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3180,7 +3361,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-process proc))))))
-(ert-deftest tramp-test28-interrupt-process ()
+(ert-deftest tramp-test30-interrupt-process ()
"Check `interrupt-process'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3207,7 +3388,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-process proc)))))
-(ert-deftest tramp-test29-shell-command ()
+(ert-deftest tramp-test31-shell-command ()
"Check `shell-command'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3311,7 +3492,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(buffer-substring-no-properties (point-min) (point-max))))
;; This test is inspired by Bug#23952.
-(ert-deftest tramp-test30-environment-variables ()
+(ert-deftest tramp-test32-environment-variables ()
"Check that remote processes set / unset environment variables properly."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3389,7 +3570,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(funcall this-shell-command-to-string "set")))))))))
;; This test is inspired by Bug#27009.
-(ert-deftest tramp-test30-environment-variables-and-port-numbers ()
+(ert-deftest tramp-test32-environment-variables-and-port-numbers ()
"Check that two connections with separate ports are different."
(skip-unless (tramp--test-enabled))
;; We test it only for the mock-up connection; otherwise there might
@@ -3428,7 +3609,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(tramp-cleanup-connection (tramp-dissect-file-name dir)))))
;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-test31-explicit-shell-file-name ()
+(ert-deftest tramp-test33-explicit-shell-file-name ()
"Check that connection-local `explicit-shell-file-name' is set."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3472,7 +3653,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(put 'explicit-shell-file-name 'permanent-local nil)
(kill-buffer "*shell*"))))
-(ert-deftest tramp-test32-vc-registered ()
+(ert-deftest tramp-test34-vc-registered ()
"Check `vc-registered'."
:tags '(:expensive-test)
(skip-unless (tramp--test-enabled))
@@ -3544,7 +3725,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
;; Cleanup.
(ignore-errors (delete-directory tmp-name1 'recursive))))))
-(ert-deftest tramp-test33-make-auto-save-file-name ()
+(ert-deftest tramp-test35-make-auto-save-file-name ()
"Check `make-auto-save-file-name'."
(skip-unless (tramp--test-enabled))
@@ -3638,7 +3819,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(ignore-errors (delete-file tmp-name1))
(ignore-errors (delete-directory tmp-name2 'recursive))))))
-(ert-deftest tramp-test34-find-backup-file-name ()
+(ert-deftest tramp-test36-find-backup-file-name ()
"Check `find-backup-file-name'."
(skip-unless (tramp--test-enabled))
@@ -3734,7 +3915,7 @@ This tests also `make-symbolic-link', `file-truename' and
`add-name-to-file'."
(ignore-errors (delete-directory tmp-name2 'recursive))))))
;; The functions were introduced in Emacs 26.1.
-(ert-deftest tramp-test35-make-nearby-temp-file ()
+(ert-deftest tramp-test37-make-nearby-temp-file ()
"Check `make-nearby-temp-file' and `temporary-file-directory'."
(skip-unless (tramp--test-enabled))
;; Since Emacs 26.1.
@@ -3999,7 +4180,7 @@ This requires restrictions of file name syntax."
(ignore-errors (delete-directory tmp-name2 'recursive))))))
(defun tramp--test-special-characters ()
- "Perform the test in `tramp-test36-special-characters*'."
+ "Perform the test in `tramp-test38-special-characters*'."
;; Newlines, slashes and backslashes in file names are not
;; supported. So we don't test. And we don't test the tab
;; character on Windows or Cygwin, because the backslash is
@@ -4042,7 +4223,7 @@ This requires restrictions of file name syntax."
"{foo}bar{baz}"))
;; These tests are inspired by Bug#17238.
-(ert-deftest tramp-test36-special-characters ()
+(ert-deftest tramp-test38-special-characters ()
"Check special characters in file names."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-rsync-p)))
@@ -4050,7 +4231,7 @@ This requires restrictions of file name syntax."
(tramp--test-special-characters))
-(ert-deftest tramp-test36-special-characters-with-stat ()
+(ert-deftest tramp-test38-special-characters-with-stat ()
"Check special characters in file names.
Use the `stat' command."
:tags '(:expensive-test)
@@ -4068,7 +4249,7 @@ Use the `stat' command."
tramp-connection-properties)))
(tramp--test-special-characters)))
-(ert-deftest tramp-test36-special-characters-with-perl ()
+(ert-deftest tramp-test38-special-characters-with-perl ()
"Check special characters in file names.
Use the `perl' command."
:tags '(:expensive-test)
@@ -4089,7 +4270,7 @@ Use the `perl' command."
tramp-connection-properties)))
(tramp--test-special-characters)))
-(ert-deftest tramp-test36-special-characters-with-ls ()
+(ert-deftest tramp-test38-special-characters-with-ls ()
"Check special characters in file names.
Use the `ls' command."
:tags '(:expensive-test)
@@ -4112,7 +4293,7 @@ Use the `ls' command."
(tramp--test-special-characters)))
(defun tramp--test-utf8 ()
- "Perform the test in `tramp-test37-utf8*'."
+ "Perform the test in `tramp-test39-utf8*'."
(let* ((utf8 (if (and (eq system-type 'darwin)
(memq 'utf-8-hfs (coding-system-list)))
'utf-8-hfs 'utf-8))
@@ -4127,7 +4308,7 @@ Use the `ls' command."
"银河系漫游指南系列"
"Автостопом по гала́ктике")))
-(ert-deftest tramp-test37-utf8 ()
+(ert-deftest tramp-test39-utf8 ()
"Check UTF8 encoding in file names and file contents."
(skip-unless (tramp--test-enabled))
(skip-unless (not (tramp--test-docker-p)))
@@ -4137,7 +4318,7 @@ Use the `ls' command."
(tramp--test-utf8))
-(ert-deftest tramp-test37-utf8-with-stat ()
+(ert-deftest tramp-test39-utf8-with-stat ()
"Check UTF8 encoding in file names and file contents.
Use the `stat' command."
:tags '(:expensive-test)
@@ -4157,7 +4338,7 @@ Use the `stat' command."
tramp-connection-properties)))
(tramp--test-utf8)))
-(ert-deftest tramp-test37-utf8-with-perl ()
+(ert-deftest tramp-test39-utf8-with-perl ()
"Check UTF8 encoding in file names and file contents.
Use the `perl' command."
:tags '(:expensive-test)
@@ -4180,7 +4361,7 @@ Use the `perl' command."
tramp-connection-properties)))
(tramp--test-utf8)))
-(ert-deftest tramp-test37-utf8-with-ls ()
+(ert-deftest tramp-test39-utf8-with-ls ()
"Check UTF8 encoding in file names and file contents.
Use the `ls' command."
:tags '(:expensive-test)
@@ -4203,7 +4384,7 @@ Use the `ls' command."
tramp-connection-properties)))
(tramp--test-utf8)))
-(ert-deftest tramp-test38-file-system-info ()
+(ert-deftest tramp-test40-file-system-info ()
"Check that `file-system-info' returns proper values."
(skip-unless (tramp--test-enabled))
;; Since Emacs 27.1.
@@ -4225,7 +4406,7 @@ Use the `ls' command."
(ert-fail (format "`%s' timed out" (ert-test-name (ert-running-test)))))
;; This test is inspired by Bug#16928.
-(ert-deftest tramp-test39-asynchronous-requests ()
+(ert-deftest tramp-test41-asynchronous-requests ()
"Check parallel asynchronous requests.
Such requests could arrive from timers, process filters and
process sentinels. They shall not disturb each other."
@@ -4382,7 +4563,7 @@ process sentinels. They shall not disturb each other."
(ignore-errors (cancel-timer timer))
(ignore-errors (delete-directory tmp-name 'recursive)))))))
-(ert-deftest tramp-test40-recursive-load ()
+(ert-deftest tramp-test42-recursive-load ()
"Check that Tramp does not fail due to recursive load."
(skip-unless (tramp--test-enabled))
@@ -4405,7 +4586,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code))))))))
-(ert-deftest tramp-test41-remote-load-path ()
+(ert-deftest tramp-test43-remote-load-path ()
"Check that Tramp autoloads its packages with remote `load-path'."
;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el.
;; It shall still work, when a remote file name is in the
@@ -4428,7 +4609,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument code)))))))
-(ert-deftest tramp-test42-delay-load ()
+(ert-deftest tramp-test44-delay-load ()
"Check that Tramp is loaded lazily, only when needed."
;; Tramp is neither loaded at Emacs startup, nor when completing a
;; non-Tramp file name like "/foo". Completing a Tramp-alike file
@@ -4454,7 +4635,7 @@ process sentinels. They shall not disturb each other."
(mapconcat 'shell-quote-argument load-path " -L ")
(shell-quote-argument (format code tm)))))))))
-(ert-deftest tramp-test43-unload ()
+(ert-deftest tramp-test45-unload ()
"Check that Tramp and its subpackages unload completely.
Since it unloads Tramp, it shall be the last test to run."
:tags '(:expensive-test)
@@ -4504,18 +4685,14 @@ Since it unloads Tramp, it shall be the last test to
run."
;; * dired-compress-file
;; * dired-uncache
-;; * file-acl
;; * file-name-case-insensitive-p
-;; * file-selinux-context
-;; * set-file-acl
-;; * set-file-selinux-context
;; * Work on skipped tests. Make a comment, when it is impossible.
;; * Fix `tramp-test05-expand-file-name-relative' in `expand-file-name'.
;; * Fix `tramp-test06-directory-file-name' for `ftp'.
-;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
-;; * Fix `tramp-test28-interrupt-process', timeout doesn't work reliably.
-;; * Fix Bug#16928 in `tramp-test39-asynchronous-requests'.
+;; * Fix `tramp-test29-start-file-process' on MS Windows (`process-send-eof'?).
+;; * Fix `tramp-test30-interrupt-process', timeout doesn't work reliably.
+;; * Fix Bug#16928 in `tramp-test41-asynchronous-requests'.
(defun tramp-test-all (&optional interactive)
"Run all tests for \\[tramp]."
diff --git a/test/lisp/progmodes/flymake-tests.el
b/test/lisp/progmodes/flymake-tests.el
index 05214e7..8eb180a 100644
--- a/test/lisp/progmodes/flymake-tests.el
+++ b/test/lisp/progmodes/flymake-tests.el
@@ -124,7 +124,10 @@ SEVERITY-PREDICATE is used to setup
;; Some versions of ruby fail if HOME doesn't exist (bug#29187).
(let* ((tempdir (make-temp-file "flymake-tests-ruby" t))
(process-environment (cons (format "HOME=%s" tempdir)
- process-environment)))
+ process-environment))
+ ;; And see https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19657#20
+ ;; for this particular yuckiness
+ (abbreviated-home-dir nil))
(unwind-protect
(flymake-tests--with-flymake ("test.rb")
(flymake-goto-next-error)
@@ -333,6 +336,38 @@ SEVERITY-PREDICATE is used to setup
(should-error (flymake-goto-prev-error nil nil t))
)))))
+(ert-deftest eob-region-and-trailing-newline ()
+ "`flymake-diag-region' at eob with varying trailing newlines."
+ (cl-flet ((diag-region-substring
+ (line col)
+ (pcase-let
+ ((`(,a . ,b) (flymake-diag-region (current-buffer) line
col)))
+ (buffer-substring a b))))
+ (with-temp-buffer
+ (insert "beg\nmmm\nend")
+ (should (equal
+ (diag-region-substring 3 3)
+ "d"))
+ (should (equal
+ (diag-region-substring 3 nil)
+ "end"))
+ (insert "\n")
+ (should (equal
+ (diag-region-substring 4 1)
+ "end"))
+ (should (equal
+ (diag-region-substring 4 nil)
+ "end"))
+ (insert "\n")
+ (should (equal
+ (diag-region-substring 5 1)
+ "\n"))
+ (should (equal
+ (diag-region-substring 5 nil)
+ "\n")))))
+
+
+
(provide 'flymake-tests)
;;; flymake.el ends here