[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f8d07fbeb3 3/3: Merge branch 'master' of git.sv.gnu.org:/srv/git/
From: |
Po Lu |
Subject: |
master f8d07fbeb3 3/3: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs |
Date: |
Tue, 31 May 2022 06:06:43 -0400 (EDT) |
branch: master
commit f8d07fbeb36cfae8b2b117c3050476f8984a515f
Merge: 2021835326 a55a0483c9
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
lib-src/etags.c | 16 ++++++++--------
src/buffer.c | 2 +-
src/ccl.c | 5 +++++
src/coding.c | 35 ++++++++++++++---------------------
src/doc.c | 2 ++
src/lisp.h | 16 +++++++---------
src/menu.c | 6 +++---
src/pdumper.c | 2 +-
src/xfns.c | 4 ++--
src/xrdb.c | 6 +-----
src/xterm.c | 9 +++++++--
11 files changed, 51 insertions(+), 52 deletions(-)
diff --git a/lib-src/etags.c b/lib-src/etags.c
index ea99ed9f39..f76dda7936 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -7248,8 +7248,8 @@ readline_internal (linebuffer *lbp, FILE *stream, char
const *filename)
{
/* We're at the end of linebuffer: expand it. */
xrnew (buffer, lbp->size, 2);
+ p = buffer + lbp->size;
lbp->size *= 2;
- p += buffer - lbp->buffer;
pend = buffer + lbp->size;
lbp->buffer = buffer;
}
@@ -7670,21 +7670,21 @@ relative_filename (char *file, char *dir)
{
char *fp, *dp, *afn, *res;
ptrdiff_t i;
+ char *dir_last_slash UNINIT;
/* Find the common root of file and dir (with a trailing slash). */
afn = absolute_filename (file, cwd);
fp = afn;
dp = dir;
while (*fp++ == *dp++)
- continue;
- fp--, dp--; /* back to the first differing char */
+ if (dp[-1] == '/')
+ dir_last_slash = dp - 1;
#ifdef DOS_NT
- if (fp == afn && afn[0] != '/') /* cannot build a relative name */
- return afn;
+ if (fp - 1 == afn && afn[0] != '/')
+ return afn; /* Cannot build a relative name. */
#endif
- do /* look at the equal chars until '/' */
- fp--, dp--;
- while (*fp != '/');
+ fp -= dp - dir_last_slash;
+ dp = dir_last_slash;
/* Build a sequence of "../" strings for the resulting relative file name. */
i = 0;
diff --git a/src/buffer.c b/src/buffer.c
index 548d7b1c65..d2b2f25575 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -4107,7 +4107,7 @@ buffer. */)
n_end = marker_position (OVERLAY_END (overlay));
/* If the overlay has changed buffers, do a thorough redisplay. */
- if (!EQ (buffer, obuffer))
+ if (!BASE_EQ (buffer, obuffer))
{
/* Redisplay where the overlay was. */
if (ob)
diff --git a/src/ccl.c b/src/ccl.c
index a3121f7278..1a4f73500a 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -35,6 +35,11 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include "coding.h"
#include "keyboard.h"
+/* Avoid GCC 12 bug <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105784>. */
+#if GNUC_PREREQ (12, 0, 0)
+# pragma GCC diagnostic ignored "-Wanalyzer-use-of-uninitialized-value"
+#endif
+
/* Table of registered CCL programs. Each element is a vector of
NAME, CCL_PROG, RESOLVEDP, and UPDATEDP, where NAME (symbol) is the
name of the program, CCL_PROG (vector) is the compiled code of the
diff --git a/src/coding.c b/src/coding.c
index 2bed293d57..aa32efc3f6 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6528,7 +6528,7 @@ detect_coding (struct coding_system *coding)
if (EQ (CODING_ATTR_TYPE (CODING_ID_ATTRS (coding->id)), Qundecided))
{
int c, i;
- struct coding_detection_info detect_info;
+ struct coding_detection_info detect_info = {0};
bool null_byte_found = 0, eight_bit_found = 0;
bool inhibit_nbd = inhibit_flag (coding->spec.undecided.inhibit_nbd,
inhibit_null_byte_detection);
@@ -6537,7 +6537,6 @@ detect_coding (struct coding_system *coding)
bool prefer_utf_8 = coding->spec.undecided.prefer_utf_8;
coding->head_ascii = 0;
- detect_info.checked = detect_info.found = detect_info.rejected = 0;
for (src = coding->source; src < src_end; src++)
{
c = *src;
@@ -6712,12 +6711,8 @@ detect_coding (struct coding_system *coding)
else if (XFIXNUM (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
== coding_category_utf_8_auto)
{
- Lisp_Object coding_systems;
- struct coding_detection_info detect_info;
-
- coding_systems
+ Lisp_Object coding_systems
= AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom);
- detect_info.found = detect_info.rejected = 0;
if (check_ascii (coding) == coding->src_bytes)
{
if (CONSP (coding_systems))
@@ -6725,6 +6720,7 @@ detect_coding (struct coding_system *coding)
}
else
{
+ struct coding_detection_info detect_info = {0};
if (CONSP (coding_systems)
&& detect_coding_utf_8 (coding, &detect_info))
{
@@ -6738,20 +6734,19 @@ detect_coding (struct coding_system *coding)
else if (XFIXNUM (CODING_ATTR_CATEGORY (CODING_ID_ATTRS (coding->id)))
== coding_category_utf_16_auto)
{
- Lisp_Object coding_systems;
- struct coding_detection_info detect_info;
-
- coding_systems
+ Lisp_Object coding_systems
= AREF (CODING_ID_ATTRS (coding->id), coding_attr_utf_bom);
- detect_info.found = detect_info.rejected = 0;
coding->head_ascii = 0;
- if (CONSP (coding_systems)
- && detect_coding_utf_16 (coding, &detect_info))
+ if (CONSP (coding_systems))
{
- if (detect_info.found & CATEGORY_MASK_UTF_16_LE)
- found = XCAR (coding_systems);
- else if (detect_info.found & CATEGORY_MASK_UTF_16_BE)
- found = XCDR (coding_systems);
+ struct coding_detection_info detect_info = {0};
+ if (detect_coding_utf_16 (coding, &detect_info))
+ {
+ if (detect_info.found & CATEGORY_MASK_UTF_16_LE)
+ found = XCAR (coding_systems);
+ else if (detect_info.found & CATEGORY_MASK_UTF_16_BE)
+ found = XCDR (coding_systems);
+ }
}
}
@@ -8639,7 +8634,7 @@ detect_coding_system (const unsigned char *src,
Lisp_Object val = Qnil;
struct coding_system coding;
ptrdiff_t id;
- struct coding_detection_info detect_info;
+ struct coding_detection_info detect_info = {0};
enum coding_category base_category;
bool null_byte_found = 0, eight_bit_found = 0;
@@ -8658,8 +8653,6 @@ detect_coding_system (const unsigned char *src,
coding.mode |= CODING_MODE_LAST_BLOCK;
coding.head_ascii = 0;
- detect_info.checked = detect_info.found = detect_info.rejected = 0;
-
/* At first, detect text-format if necessary. */
base_category = XFIXNUM (CODING_ATTR_CATEGORY (attrs));
if (base_category == coding_category_undecided)
diff --git a/src/doc.c b/src/doc.c
index 71e66853b0..14db3189f3 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -569,6 +569,8 @@ the same file name is found in the `doc-directory'. */)
if (p)
{
end = strchr (p, '\n');
+ if (!end)
+ error ("DOC file invalid at position %"pI"d", pos);
/* We used to skip files not in build_files, so that when a
function was defined several times in different files
diff --git a/src/lisp.h b/src/lisp.h
index 3578ca57b4..ff6f0aaf54 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2091,19 +2091,17 @@ XSUB_CHAR_TABLE (Lisp_Object a)
INLINE Lisp_Object
CHAR_TABLE_REF_ASCII (Lisp_Object ct, ptrdiff_t idx)
{
- struct Lisp_Char_Table *tbl = NULL;
- Lisp_Object val;
- do
+ for (struct Lisp_Char_Table *tbl = XCHAR_TABLE (ct); ;
+ tbl = XCHAR_TABLE (tbl->parent))
{
- tbl = tbl ? XCHAR_TABLE (tbl->parent) : XCHAR_TABLE (ct);
- val = (! SUB_CHAR_TABLE_P (tbl->ascii) ? tbl->ascii
- : XSUB_CHAR_TABLE (tbl->ascii)->contents[idx]);
+ Lisp_Object val = (SUB_CHAR_TABLE_P (tbl->ascii)
+ ? XSUB_CHAR_TABLE (tbl->ascii)->contents[idx]
+ : tbl->ascii);
if (NILP (val))
val = tbl->defalt;
+ if (!NILP (val) || NILP (tbl->parent))
+ return val;
}
- while (NILP (val) && ! NILP (tbl->parent));
-
- return val;
}
/* Almost equivalent to Faref (CT, IDX) with optimization for ASCII
diff --git a/src/menu.c b/src/menu.c
index 398bf9329f..eeb0c9a7e5 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1118,7 +1118,7 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
Lisp_Object title;
const char *error_name = NULL;
Lisp_Object selection = Qnil;
- struct frame *f = NULL;
+ struct frame *f;
Lisp_Object x, y, window;
int menuflags = 0;
specpdl_ref specpdl_count = SPECPDL_INDEX ();
@@ -1269,9 +1269,9 @@ x_popup_menu_1 (Lisp_Object position, Lisp_Object menu)
}
}
else
- /* ??? Not really clean; should be CHECK_WINDOW_OR_FRAME,
+ /* ??? Not really clean; should be Qwindow_or_framep
but I don't want to make one now. */
- CHECK_WINDOW (window);
+ wrong_type_argument (Qwindowp, window);
xpos += check_integer_range (x,
(xpos < INT_MIN - MOST_NEGATIVE_FIXNUM
diff --git a/src/pdumper.c b/src/pdumper.c
index 88e7b311a8..0efd5cfb0b 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -1069,7 +1069,7 @@ dump_queue_enqueue (struct dump_queue *dump_queue,
}
}
- if (!EQ (weights, orig_weights))
+ if (!BASE_EQ (weights, orig_weights))
Fputhash (object, weights, dump_queue->link_weights);
}
diff --git a/src/xfns.c b/src/xfns.c
index 259034861a..d696078440 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -8487,7 +8487,7 @@ Text larger than the specified size is clipped. */)
if (!NILP (tip_frame) && FRAME_LIVE_P (XFRAME (tip_frame)))
{
if (FRAME_VISIBLE_P (XFRAME (tip_frame))
- && EQ (frame, tip_last_frame)
+ && BASE_EQ (frame, tip_last_frame)
&& !NILP (Fequal_including_properties (tip_last_string, string))
&& !NILP (Fequal (tip_last_parms, parms)))
{
@@ -8508,7 +8508,7 @@ Text larger than the specified size is clipped. */)
goto start_timer;
}
- else if (tooltip_reuse_hidden_frame && EQ (frame, tip_last_frame))
+ else if (tooltip_reuse_hidden_frame && BASE_EQ (frame, tip_last_frame))
{
bool delete = false;
Lisp_Object tail, elt, parm, last;
diff --git a/src/xrdb.c b/src/xrdb.c
index aa79d719c8..faeea04a53 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -486,11 +486,7 @@ x_get_resource (XrmDatabase rdb, const char *name, const
char *class,
if (XrmQGetResource (rdb, namelist, classlist, &type, &value) == True
&& (type == expected_type))
{
- if (type == x_rm_string)
- ret_value->addr = (char *) value.addr;
- else
- memcpy (ret_value->addr, value.addr, ret_value->size);
-
+ *ret_value = value;
return value.size;
}
diff --git a/src/xterm.c b/src/xterm.c
index e9c38ae484..0ebabdccaf 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -22468,15 +22468,20 @@ x_get_current_wm_state (struct frame *f,
#ifdef USE_XCB
xcb_get_property_cookie_t prop_cookie;
xcb_get_property_reply_t *prop;
- xcb_atom_t *reply_data UNINIT;
+ typedef xcb_atom_t reply_data_object;
#else
Display *dpy = FRAME_X_DISPLAY (f);
unsigned long bytes_remaining;
int rc, actual_format;
Atom actual_type;
unsigned char *tmp_data = NULL;
- Atom *reply_data UNINIT;
+ typedef Atom reply_data_object;
#endif
+ reply_data_object *reply_data;
+# if defined GCC_LINT || defined lint
+ reply_data_object reply_data_dummy;
+ reply_data = &reply_data_dummy;
+# endif
*sticky = false;
*size_state = FULLSCREEN_NONE;