diff options
| author | Glenn Morris | 2019-06-01 12:04:42 -0700 |
|---|---|---|
| committer | Glenn Morris | 2019-06-01 12:04:42 -0700 |
| commit | 7e911d007d25df9a483eaad54956a4273405574e (patch) | |
| tree | ce1e4b0eda6c940634922e71a726b5c8aa5270b4 | |
| parent | f17e0e93bd8dbe3b069029585dc5d2dda57c1e1e (diff) | |
| parent | 134edc10367a8434167656e631865c85b5f10c42 (diff) | |
| download | emacs-7e911d007d25df9a483eaad54956a4273405574e.tar.gz emacs-7e911d007d25df9a483eaad54956a4273405574e.zip | |
Merge from origin/emacs-26
134edc1 Warn about wrong number of args for subrs (Bug#35767)
5f01af6 Use plain symbols for eieio type descriptors (Bug#29220)
4b24b01 Pacify GCC 9 -Wredundant-decls
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio-core.el | 11 | ||||
| -rw-r--r-- | lisp/emacs-lisp/eieio.el | 3 | ||||
| -rw-r--r-- | src/gmalloc.c | 9 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 14 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el | 28 |
6 files changed, 48 insertions, 19 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index ce348ed3131..dfbda8d43e3 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1401,7 +1401,7 @@ when printing the error message." | |||
| 1401 | (defun byte-compile-callargs-warn (form) | 1401 | (defun byte-compile-callargs-warn (form) |
| 1402 | (let* ((def (or (byte-compile-fdefinition (car form) nil) | 1402 | (let* ((def (or (byte-compile-fdefinition (car form) nil) |
| 1403 | (byte-compile-fdefinition (car form) t))) | 1403 | (byte-compile-fdefinition (car form) t))) |
| 1404 | (sig (byte-compile--function-signature def)) | 1404 | (sig (byte-compile--function-signature (or def (car form)))) |
| 1405 | (ncall (length (cdr form)))) | 1405 | (ncall (length (cdr form)))) |
| 1406 | ;; Check many or unevalled from subr-arity. | 1406 | ;; Check many or unevalled from subr-arity. |
| 1407 | (if (and (cdr-safe sig) | 1407 | (if (and (cdr-safe sig) |
diff --git a/lisp/emacs-lisp/eieio-core.el b/lisp/emacs-lisp/eieio-core.el index 31ee6c5bfd4..30445f9e645 100644 --- a/lisp/emacs-lisp/eieio-core.el +++ b/lisp/emacs-lisp/eieio-core.el | |||
| @@ -117,9 +117,6 @@ Currently under control of this var: | |||
| 117 | (defsubst eieio--object-class-tag (obj) | 117 | (defsubst eieio--object-class-tag (obj) |
| 118 | (aref obj 0)) | 118 | (aref obj 0)) |
| 119 | 119 | ||
| 120 | (defsubst eieio--object-class (obj) | ||
| 121 | (eieio--object-class-tag obj)) | ||
| 122 | |||
| 123 | 120 | ||
| 124 | ;;; Important macros used internally in eieio. | 121 | ;;; Important macros used internally in eieio. |
| 125 | 122 | ||
| @@ -132,6 +129,12 @@ Currently under control of this var: | |||
| 132 | (or (cl--find-class class) class) | 129 | (or (cl--find-class class) class) |
| 133 | class)) | 130 | class)) |
| 134 | 131 | ||
| 132 | (defsubst eieio--object-class (obj) | ||
| 133 | (let ((tag (eieio--object-class-tag obj))) | ||
| 134 | (if eieio-backward-compatibility | ||
| 135 | (eieio--class-object tag) | ||
| 136 | tag))) | ||
| 137 | |||
| 135 | (defun class-p (x) | 138 | (defun class-p (x) |
| 136 | "Return non-nil if X is a valid class vector. | 139 | "Return non-nil if X is a valid class vector. |
| 137 | X can also be is a symbol." | 140 | X can also be is a symbol." |
| @@ -163,7 +166,7 @@ Return nil if that option doesn't exist." | |||
| 163 | (defun eieio-object-p (obj) | 166 | (defun eieio-object-p (obj) |
| 164 | "Return non-nil if OBJ is an EIEIO object." | 167 | "Return non-nil if OBJ is an EIEIO object." |
| 165 | (and (recordp obj) | 168 | (and (recordp obj) |
| 166 | (eieio--class-p (eieio--object-class-tag obj)))) | 169 | (eieio--class-p (eieio--object-class obj)))) |
| 167 | 170 | ||
| 168 | (define-obsolete-function-alias 'object-p 'eieio-object-p "25.1") | 171 | (define-obsolete-function-alias 'object-p 'eieio-object-p "25.1") |
| 169 | 172 | ||
diff --git a/lisp/emacs-lisp/eieio.el b/lisp/emacs-lisp/eieio.el index b6ec191e2ba..7ad44b6d26c 100644 --- a/lisp/emacs-lisp/eieio.el +++ b/lisp/emacs-lisp/eieio.el | |||
| @@ -710,6 +710,9 @@ calls `initialize-instance' on that object." | |||
| 710 | ;; Call the initialize method on the new object with the slots | 710 | ;; Call the initialize method on the new object with the slots |
| 711 | ;; that were passed down to us. | 711 | ;; that were passed down to us. |
| 712 | (initialize-instance new-object slots) | 712 | (initialize-instance new-object slots) |
| 713 | (when eieio-backward-compatibility | ||
| 714 | ;; Use symbol as type descriptor, for backwards compatibility. | ||
| 715 | (aset new-object 0 class)) | ||
| 713 | ;; Return the created object. | 716 | ;; Return the created object. |
| 714 | new-object)) | 717 | new-object)) |
| 715 | 718 | ||
diff --git a/src/gmalloc.c b/src/gmalloc.c index b6a96d55727..779cdb36d67 100644 --- a/src/gmalloc.c +++ b/src/gmalloc.c | |||
| @@ -181,7 +181,7 @@ struct list | |||
| 181 | }; | 181 | }; |
| 182 | 182 | ||
| 183 | /* Free list headers for each fragment size. */ | 183 | /* Free list headers for each fragment size. */ |
| 184 | extern struct list _fraghead[]; | 184 | static struct list _fraghead[BLOCKLOG]; |
| 185 | 185 | ||
| 186 | /* List of blocks allocated with aligned_alloc and friends. */ | 186 | /* List of blocks allocated with aligned_alloc and friends. */ |
| 187 | struct alignlist | 187 | struct alignlist |
| @@ -339,9 +339,6 @@ size_t _heapindex; | |||
| 339 | /* Limit of valid info table indices. */ | 339 | /* Limit of valid info table indices. */ |
| 340 | size_t _heaplimit; | 340 | size_t _heaplimit; |
| 341 | 341 | ||
| 342 | /* Free lists for each fragment size. */ | ||
| 343 | struct list _fraghead[BLOCKLOG]; | ||
| 344 | |||
| 345 | /* Instrumentation. */ | 342 | /* Instrumentation. */ |
| 346 | size_t _chunks_used; | 343 | size_t _chunks_used; |
| 347 | size_t _bytes_used; | 344 | size_t _bytes_used; |
| @@ -351,10 +348,6 @@ size_t _bytes_free; | |||
| 351 | /* Are you experienced? */ | 348 | /* Are you experienced? */ |
| 352 | int __malloc_initialized; | 349 | int __malloc_initialized; |
| 353 | 350 | ||
| 354 | #else | ||
| 355 | |||
| 356 | static struct list _fraghead[BLOCKLOG]; | ||
| 357 | |||
| 358 | #endif /* HYBRID_MALLOC */ | 351 | #endif /* HYBRID_MALLOC */ |
| 359 | 352 | ||
| 360 | /* Number of extra blocks to get each time we ask for more core. | 353 | /* Number of extra blocks to get each time we ask for more core. |
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index ed100020def..f45c9209c14 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -456,6 +456,20 @@ Subtests signal errors if something goes wrong." | |||
| 456 | ;; Should not warn that mt--test2 is not known to be defined. | 456 | ;; Should not warn that mt--test2 is not known to be defined. |
| 457 | (should-not (re-search-forward "my--test2" nil t)))) | 457 | (should-not (re-search-forward "my--test2" nil t)))) |
| 458 | 458 | ||
| 459 | (ert-deftest bytecomp-warn-wrong-args () | ||
| 460 | (with-current-buffer (get-buffer-create "*Compile-Log*") | ||
| 461 | (let ((inhibit-read-only t)) (erase-buffer)) | ||
| 462 | (byte-compile '(remq 1 2 3)) | ||
| 463 | (ert-info ((buffer-string) :prefix "buffer: ") | ||
| 464 | (should (re-search-forward "remq.*3.*2"))))) | ||
| 465 | |||
| 466 | (ert-deftest bytecomp-warn-wrong-args-subr () | ||
| 467 | (with-current-buffer (get-buffer-create "*Compile-Log*") | ||
| 468 | (let ((inhibit-read-only t)) (erase-buffer)) | ||
| 469 | (byte-compile '(safe-length 1 2 3)) | ||
| 470 | (ert-info ((buffer-string) :prefix "buffer: ") | ||
| 471 | (should (re-search-forward "safe-length.*3.*1"))))) | ||
| 472 | |||
| 459 | (ert-deftest test-eager-load-macro-expansion () | 473 | (ert-deftest test-eager-load-macro-expansion () |
| 460 | (test-byte-comp-compile-and-load nil | 474 | (test-byte-comp-compile-and-load nil |
| 461 | '(progn (defmacro abc (arg) 1) (defun def () (abc 2)))) | 475 | '(progn (defmacro abc (arg) 1) (defun def () (abc 2)))) |
diff --git a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el index e89d6bb5ec0..b105249c7c5 100644 --- a/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el +++ b/test/lisp/emacs-lisp/eieio-tests/eieio-test-persist.el | |||
| @@ -274,7 +274,7 @@ persistent class.") | |||
| 274 | :type vector | 274 | :type vector |
| 275 | :initarg :random-vector))) | 275 | :initarg :random-vector))) |
| 276 | 276 | ||
| 277 | (ert-deftest eieio-test-persist-hash-and-vector () | 277 | (defun eieio-test-persist-hash-and-vector () |
| 278 | (let* ((jane (make-instance 'person :name "Jane")) | 278 | (let* ((jane (make-instance 'person :name "Jane")) |
| 279 | (bob (make-instance 'person :name "Bob")) | 279 | (bob (make-instance 'person :name "Bob")) |
| 280 | (hans (make-instance 'person :name "Hans")) | 280 | (hans (make-instance 'person :name "Hans")) |
| @@ -294,10 +294,18 @@ persistent class.") | |||
| 294 | (aset (car (slot-value class 'janitors)) 1 hans) | 294 | (aset (car (slot-value class 'janitors)) 1 hans) |
| 295 | (aset (nth 1 (slot-value class 'janitors)) 1 dierdre) | 295 | (aset (nth 1 (slot-value class 'janitors)) 1 dierdre) |
| 296 | (unwind-protect | 296 | (unwind-protect |
| 297 | ;; FIXME: This should not error. | 297 | (persist-test-save-and-compare class) |
| 298 | (should-error (persist-test-save-and-compare class)) | ||
| 299 | (delete-file (oref class file))))) | 298 | (delete-file (oref class file))))) |
| 300 | 299 | ||
| 300 | (ert-deftest eieio-persist-hash-and-vector-backward-compatibility () | ||
| 301 | (let ((eieio-backward-compatibility t)) ; The default. | ||
| 302 | (eieio-test-persist-hash-and-vector))) | ||
| 303 | |||
| 304 | (ert-deftest eieio-persist-hash-and-vector-no-backward-compatibility () | ||
| 305 | :expected-result :failed ;; Bug#29220. | ||
| 306 | (let ((eieio-backward-compatibility nil)) | ||
| 307 | (eieio-test-persist-hash-and-vector))) | ||
| 308 | |||
| 301 | ;; Extra quotation of lists inside other objects (Gnus registry), also | 309 | ;; Extra quotation of lists inside other objects (Gnus registry), also |
| 302 | ;; bug#29220. | 310 | ;; bug#29220. |
| 303 | 311 | ||
| @@ -312,7 +320,7 @@ persistent class.") | |||
| 312 | :initarg :htab | 320 | :initarg :htab |
| 313 | :type hash-table))) | 321 | :type hash-table))) |
| 314 | 322 | ||
| 315 | (ert-deftest eieio-test-persist-interior-lists () | 323 | (defun eieio-test-persist-interior-lists () |
| 316 | (let* ((thing (make-instance | 324 | (let* ((thing (make-instance |
| 317 | 'eieio-container | 325 | 'eieio-container |
| 318 | :vec [nil] | 326 | :vec [nil] |
| @@ -332,8 +340,16 @@ persistent class.") | |||
| 332 | (setf (nth 2 (cadar alst)) john | 340 | (setf (nth 2 (cadar alst)) john |
| 333 | (nth 2 (cadadr alst)) alexie) | 341 | (nth 2 (cadadr alst)) alexie) |
| 334 | (unwind-protect | 342 | (unwind-protect |
| 335 | ;; FIXME: Should not error. | 343 | (persist-test-save-and-compare thing) |
| 336 | (should-error (persist-test-save-and-compare thing)) | ||
| 337 | (delete-file (slot-value thing 'file))))) | 344 | (delete-file (slot-value thing 'file))))) |
| 338 | 345 | ||
| 346 | (ert-deftest eieio-test-persist-interior-lists-backward-compatibility () | ||
| 347 | (let ((eieio-backward-compatibility t)) ; The default. | ||
| 348 | (eieio-test-persist-interior-lists))) | ||
| 349 | |||
| 350 | (ert-deftest eieio-test-persist-interior-lists-no-backward-compatibility () | ||
| 351 | :expected-result :failed ;; Bug#29220. | ||
| 352 | (let ((eieio-backward-compatibility nil)) | ||
| 353 | (eieio-test-persist-interior-lists))) | ||
| 354 | |||
| 339 | ;;; eieio-test-persist.el ends here | 355 | ;;; eieio-test-persist.el ends here |