aboutsummaryrefslogtreecommitdiffstats
path: root/src/intervals.c
diff options
context:
space:
mode:
authorPaul Eggert2020-03-04 13:48:26 -0800
committerPaul Eggert2020-03-04 13:48:58 -0800
commitdc3006cf1419e5b22c35fa36d79ba029d0482df1 (patch)
treeef5581855ed15eafedc296c767f1addcd5f9c13a /src/intervals.c
parentd1bbd32dba392f2fb4548d892354e78ff8df4451 (diff)
downloademacs-dc3006cf1419e5b22c35fa36d79ba029d0482df1.tar.gz
emacs-dc3006cf1419e5b22c35fa36d79ba029d0482df1.zip
Pacify GCC 9.2.1 20190927 -O3
Original problem report by N. Jackson in: https://lists.gnu.org/r/emacs-devel/2020-03/msg00047.html I found some other warnings when I used gcc, and fixed them with this patch. * lib-src/etags.c: Include verify.h. (xnmalloc, xnrealloc): Tell the compiler that NITEMS is nononnegative and ITEM_SIZE is positive. * src/conf_post.h (__has_attribute_returns_nonnull) (ATTRIBUTE_RETURNS_NONNULL): New macros. * src/editfns.c (Fuser_full_name): Don’t assume Fuser_login_name returns non-nil. * src/intervals.c (rotate_right, rotate_left, update_interval): * src/intervals.h (LENGTH, LEFT_TOTAL_LENGTH, RIGHT_TOTAL_LENGTH): Use TOTAL_LENGTH0 or equivalent on intervals that might be null. * src/intervals.h (TOTAL_LENGTH): Assume arg is nonnull. (TOTAL_LENGTH0): New macro, with the old TOTAL_LENGTH meaning. (make_interval, split_interval_right): Add ATTRIBUTE_RETURNS_NONNULL. * src/pdumper.c (dump_check_dump_off): Now returns void, since no caller uses the return value. Redo assert to pacify GCC. (decode_emacs_reloc): Add a seemingly-random eassume to pacify GCC. Ugly, and I suspect due to a bug in GCC.
Diffstat (limited to 'src/intervals.c')
-rw-r--r--src/intervals.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/intervals.c b/src/intervals.c
index a66594ceea2..594d8924ebc 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -298,7 +298,7 @@ rotate_right (INTERVAL A)
298 set_interval_parent (c, A); 298 set_interval_parent (c, A);
299 299
300 /* A's total length is decreased by the length of B and its left child. */ 300 /* A's total length is decreased by the length of B and its left child. */
301 A->total_length -= B->total_length - TOTAL_LENGTH (c); 301 A->total_length -= TOTAL_LENGTH (B) - TOTAL_LENGTH0 (c);
302 eassert (TOTAL_LENGTH (A) > 0); 302 eassert (TOTAL_LENGTH (A) > 0);
303 eassert (LENGTH (A) > 0); 303 eassert (LENGTH (A) > 0);
304 304
@@ -349,7 +349,7 @@ rotate_left (INTERVAL A)
349 set_interval_parent (c, A); 349 set_interval_parent (c, A);
350 350
351 /* A's total length is decreased by the length of B and its right child. */ 351 /* A's total length is decreased by the length of B and its right child. */
352 A->total_length -= B->total_length - TOTAL_LENGTH (c); 352 A->total_length -= TOTAL_LENGTH (B) - TOTAL_LENGTH0 (c);
353 eassert (TOTAL_LENGTH (A) > 0); 353 eassert (TOTAL_LENGTH (A) > 0);
354 eassert (LENGTH (A) > 0); 354 eassert (LENGTH (A) > 0);
355 355
@@ -723,13 +723,13 @@ previous_interval (register INTERVAL interval)
723 i->position - LEFT_TOTAL_LENGTH (i) \ 723 i->position - LEFT_TOTAL_LENGTH (i) \
724 - LENGTH (INTERVAL_PARENT (i)) 724 - LENGTH (INTERVAL_PARENT (i))
725 725
726/* Find the interval containing POS, given some non-NULL INTERVAL in 726/* Find the interval containing POS, given some interval I in
727 the same tree. Note that we update interval->position in each 727 the same tree. Note that we update interval->position in each
728 interval we traverse, assuming it is already correctly set for the 728 interval we traverse, assuming it is already correctly set for the
729 argument I. We don't assume that any other interval already has a 729 argument I. We don't assume that any other interval already has a
730 correctly set ->position. */ 730 correctly set ->position. */
731INTERVAL 731INTERVAL
732update_interval (register INTERVAL i, ptrdiff_t pos) 732update_interval (INTERVAL i, ptrdiff_t pos)
733{ 733{
734 if (!i) 734 if (!i)
735 return NULL; 735 return NULL;
@@ -739,7 +739,7 @@ update_interval (register INTERVAL i, ptrdiff_t pos)
739 if (pos < i->position) 739 if (pos < i->position)
740 { 740 {
741 /* Move left. */ 741 /* Move left. */
742 if (pos >= i->position - TOTAL_LENGTH (i->left)) 742 if (pos >= i->position - LEFT_TOTAL_LENGTH (i))
743 { 743 {
744 i->left->position = i->position - TOTAL_LENGTH (i->left) 744 i->left->position = i->position - TOTAL_LENGTH (i->left)
745 + LEFT_TOTAL_LENGTH (i->left); 745 + LEFT_TOTAL_LENGTH (i->left);
@@ -757,7 +757,7 @@ update_interval (register INTERVAL i, ptrdiff_t pos)
757 else if (pos >= INTERVAL_LAST_POS (i)) 757 else if (pos >= INTERVAL_LAST_POS (i))
758 { 758 {
759 /* Move right. */ 759 /* Move right. */
760 if (pos < INTERVAL_LAST_POS (i) + TOTAL_LENGTH (i->right)) 760 if (pos < INTERVAL_LAST_POS (i) + RIGHT_TOTAL_LENGTH (i))
761 { 761 {
762 i->right->position = INTERVAL_LAST_POS (i) 762 i->right->position = INTERVAL_LAST_POS (i)
763 + LEFT_TOTAL_LENGTH (i->right); 763 + LEFT_TOTAL_LENGTH (i->right);