Merge from origin/emacs-27
366a97c980
(origin/emacs-27) Avoid crashes when trying to load bad GI...7938713105
C++ Mode: handle comma separated brace initializers.2b95300cf8
* lisp/display-fill-column-indicator.el: Fix bug#41145
This commit is contained in:
commit
482fa0d9ed
5 changed files with 67 additions and 30 deletions
|
@ -99,7 +99,7 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
|
|||
(setq name (intern name)))
|
||||
(condition-case nil
|
||||
(while (re-search-forward
|
||||
"^(def\\(custom\\|face\\|group\\)" nil t)
|
||||
"^(def\\(custom\\|face\\|group\\|ine\\(?:-globalized\\)?-minor-mode\\)" nil t)
|
||||
(beginning-of-line)
|
||||
(let ((type (match-string 1))
|
||||
(expr (read (current-buffer))))
|
||||
|
|
|
@ -73,7 +73,9 @@ See Info node `Displaying Boundaries' for details."
|
|||
|
||||
;;;###autoload
|
||||
(define-globalized-minor-mode global-display-fill-column-indicator-mode
|
||||
display-fill-column-indicator-mode display-fill-column-indicator--turn-on)
|
||||
display-fill-column-indicator-mode display-fill-column-indicator--turn-on
|
||||
;; See bug#41145
|
||||
:group 'display-fill-column-indicator)
|
||||
|
||||
(provide 'display-fill-column-indicator)
|
||||
|
||||
|
|
|
@ -9102,7 +9102,7 @@ This function might do hidden buffer changes."
|
|||
(let
|
||||
((cdd-pos (point)) cdd-next-pos cdd-id-start cdd-id-end
|
||||
cdd-decl-res cdd-got-func cdd-got-type cdd-got-init
|
||||
c-last-identifier-range cdd-exhausted)
|
||||
c-last-identifier-range cdd-exhausted cdd-after-block)
|
||||
|
||||
;; The following `while' applies `cdd-function' to a single declarator id
|
||||
;; each time round. It loops only when CDD-LIST is non-nil.
|
||||
|
@ -9155,23 +9155,25 @@ This function might do hidden buffer changes."
|
|||
(c-forward-syntactic-ws cdd-limit)
|
||||
(setq cdd-exhausted t))) ; unbalanced parens
|
||||
|
||||
(cdd-got-init ; "=" sign OR opening "(", "[", or "{"
|
||||
;; Skip an initializer expression. If we're at a '='
|
||||
;; then accept a brace list directly after it to cope
|
||||
;; with array initializers. Otherwise stop at braces
|
||||
;; to avoid going past full function and class blocks.
|
||||
(if (and (if (and (eq cdd-got-init ?=)
|
||||
(= (c-forward-token-2 1 nil cdd-limit) 0)
|
||||
(looking-at "{"))
|
||||
(c-go-list-forward (point) cdd-limit)
|
||||
t)
|
||||
;; FIXME: Should look for c-decl-end markers here;
|
||||
;; we might go far into the following declarations
|
||||
;; in e.g. ObjC mode (see e.g. methods-4.m).
|
||||
(c-syntactic-re-search-forward "[;,{]" cdd-limit 'move t))
|
||||
(cdd-got-init ; "=" sign OR opening "(", "[", or "("
|
||||
;; Skip an initializer expression in braces, whether or not (in
|
||||
;; C++ Mode) preceded by an "=". Be careful that the brace list
|
||||
;; isn't a code block or a struct (etc.) block.
|
||||
(cond
|
||||
((and (eq cdd-got-init ?=)
|
||||
(zerop (c-forward-token-2 1 nil cdd-limit))
|
||||
(eq (char-after) ?{)
|
||||
(c-go-list-forward (point) cdd-limit)))
|
||||
((and (eq cdd-got-init ?{)
|
||||
c-recognize-bare-brace-inits
|
||||
(setq cdd-after-block
|
||||
(save-excursion
|
||||
(c-go-list-forward (point) cdd-limit)))
|
||||
(not (c-looking-at-statement-block)))
|
||||
(goto-char cdd-after-block)))
|
||||
(if (c-syntactic-re-search-forward "[;,{]" cdd-limit 'move t)
|
||||
(backward-char)
|
||||
(setq cdd-exhausted t)
|
||||
))
|
||||
(setq cdd-exhausted t)))
|
||||
|
||||
(t (c-forward-syntactic-ws cdd-limit)))
|
||||
|
||||
|
@ -11749,7 +11751,22 @@ comment at the start of cc-engine.el for more info."
|
|||
(save-excursion (c-backward-syntactic-ws) (point))
|
||||
nil nil))
|
||||
(and (consp res)
|
||||
(eq (car res) after-type-id-pos))))))
|
||||
(cond
|
||||
((eq (car res) after-type-id-pos))
|
||||
((> (car res) after-type-id-pos) nil)
|
||||
(t
|
||||
(catch 'find-decl
|
||||
(save-excursion
|
||||
(goto-char (car res))
|
||||
(c-do-declarators
|
||||
(point-max) t nil nil
|
||||
(lambda (id-start id-end tok not-top func init)
|
||||
(cond
|
||||
((> id-start after-type-id-pos)
|
||||
(throw 'find-decl nil))
|
||||
((eq id-start after-type-id-pos)
|
||||
(throw 'find-decl t)))))
|
||||
nil)))))))))
|
||||
(cons bufpos (or in-paren inexpr-brace-list)))
|
||||
((or (eq (char-after) ?\;)
|
||||
;; Brace lists can't contain a semicolon, so we're done.
|
||||
|
|
|
@ -3701,6 +3701,20 @@ Foo bar = gnu;"
|
|||
c++ t)
|
||||
(c-lang-defvar c-recognize-paren-inits (c-lang-const c-recognize-paren-inits))
|
||||
|
||||
(c-lang-defconst c-recognize-bare-brace-inits
|
||||
"Non-nil means that brace initializers without \"=\" exist,
|
||||
i.e. constructs like
|
||||
|
||||
int foo[] {1, 2, 3};
|
||||
|
||||
in addition to the more classic
|
||||
|
||||
int foo[] = {1, 2, 3};"
|
||||
t nil
|
||||
c++ t)
|
||||
(c-lang-defvar c-recognize-bare-brace-inits
|
||||
(c-lang-const c-recognize-bare-brace-inits))
|
||||
|
||||
(c-lang-defconst c-recognize-paren-inexpr-blocks
|
||||
"Non-nil to recognize gcc style in-expression blocks,
|
||||
i.e. compound statements surrounded by parentheses inside expressions."
|
||||
|
|
24
src/image.c
24
src/image.c
|
@ -8276,11 +8276,13 @@ gif_load (struct frame *f, struct image *img)
|
|||
if (gif == NULL)
|
||||
{
|
||||
#if HAVE_GIFERRORSTRING
|
||||
image_error ("Cannot open `%s': %s",
|
||||
file, build_string (GifErrorString (gif_err)));
|
||||
#else
|
||||
image_error ("Cannot open `%s'", file);
|
||||
const char *errstr = GifErrorString (gif_err);
|
||||
if (errstr)
|
||||
image_error ("Cannot open `%s': %s", file, build_string (errstr));
|
||||
else
|
||||
#endif
|
||||
image_error ("Cannot open `%s'", file);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -8306,11 +8308,13 @@ gif_load (struct frame *f, struct image *img)
|
|||
if (!gif)
|
||||
{
|
||||
#if HAVE_GIFERRORSTRING
|
||||
image_error ("Cannot open memory source `%s': %s",
|
||||
img->spec, build_string (GifErrorString (gif_err)));
|
||||
#else
|
||||
image_error ("Cannot open memory source `%s'", img->spec);
|
||||
const char *errstr = GifErrorString (gif_err);
|
||||
if (errstr)
|
||||
image_error ("Cannot open memory source `%s': %s",
|
||||
img->spec, build_string (errstr));
|
||||
else
|
||||
#endif
|
||||
image_error ("Cannot open memory source `%s'", img->spec);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -8593,9 +8597,9 @@ gif_load (struct frame *f, struct image *img)
|
|||
if (error_text)
|
||||
image_error ("Error closing `%s': %s",
|
||||
img->spec, build_string (error_text));
|
||||
#else
|
||||
image_error ("Error closing `%s'", img->spec);
|
||||
else
|
||||
#endif
|
||||
image_error ("Error closing `%s'", img->spec);
|
||||
}
|
||||
|
||||
/* Maybe fill in the background field while we have ximg handy. */
|
||||
|
|
Loading…
Add table
Reference in a new issue