APPROVE COMMIT
NOTE: This patch has been committed
# HG changeset patch
# User Aidan Kehoe <kehoea(a)parhasard.net>
# Date 1506265489 -3600
# Sun Sep 24 16:04:49 2017 +0100
# Node ID 8ac369598a2ef9ce4785ffa64fc8945cce945ca5
# Parent 0d158ce025013acbf1023cfb86be2fde9c495a84
Silence compiler warnings, fix some bugs elicited by same, src/, lib-src/
src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* chartab.c (chartab_data_validate):
Silence an unused-variable compiler warning here.
* doprnt.c (bignum_to_string_1):
Fix a bug in this function, thank you clang++4.0.
* gc.c (KKCC_DO_CHECK_FREE):
Avoid an unused-variable warning when not ERROR_CHECK_GC.
* gccache-x.c (describe_gc_cache):
Fix a bug in this function, thank you clang++4.0.
* mule-charset.c (validate_charset_offset_or_size):
Be a bit more idiomatic in getting an external list length, and
silence a compiler warning while doing so.
* redisplay.c (create_text_block):
* redisplay.c (create_string_text_block):
Fix the same bug in these two functions, thank you clang++4.0.
* regex.c (re_compile_fastmap):
* regex.c (re_search_2):
* regex.c (re_match_2_internal):
Silence compiler warnings in this file, both when #define EMACS
and when not.
* text.c (copy_buffer_text_out):
Silence compiler warning here, add an assert to ensure the
approach is OK.
* unicode.c (free_precedence_array):
* unicode.c (recalculate_unicode_precedence):
Silence unused variable warnings in these two functions.
lib-src/ChangeLog addition:
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
* b2m.c (main):
* etags.c:
* etags.c (just_read_file):
* movemail.c (main):
* ootags.c (just_read_file):
Silence a few compiler warnings in these files.
diff -r 0d158ce02501 -r 8ac369598a2e lib-src/ChangeLog
--- a/lib-src/ChangeLog Sun Sep 24 10:43:32 2017 +0100
+++ b/lib-src/ChangeLog Sun Sep 24 16:04:49 2017 +0100
@@ -1,3 +1,12 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * b2m.c (main):
+ * etags.c:
+ * etags.c (just_read_file):
+ * movemail.c (main):
+ * ootags.c (just_read_file):
+ Silence a few compiler warnings in these files.
+
2017-03-15 Aidan Kehoe <kehoea(a)parhasard.net>
* make-docfile.c (scan_lisp_file):
diff -r 0d158ce02501 -r 8ac369598a2e lib-src/b2m.c
--- a/lib-src/b2m.c Sun Sep 24 10:43:32 2017 +0100
+++ b/lib-src/b2m.c Sun Sep 24 16:04:49 2017 +0100
@@ -95,7 +95,7 @@
logical labels_saved, printing, header, first, last_was_blank_line;
time_t ltoday;
struct tm *tm;
- char *labels, *p, *today;
+ char *labels = NULL, *p, *today;
struct linebuffer data;
#ifdef MSDOS
diff -r 0d158ce02501 -r 8ac369598a2e lib-src/etags.c
--- a/lib-src/etags.c Sun Sep 24 10:43:32 2017 +0100
+++ b/lib-src/etags.c Sun Sep 24 16:04:49 2017 +0100
@@ -4172,6 +4172,8 @@
LOOP_ON_INPUT_LINES (inf, lb, dummy)
continue;
+
+ (void) (dummy); /* Silence compiler warning. */
}
diff -r 0d158ce02501 -r 8ac369598a2e lib-src/movemail.c
--- a/lib-src/movemail.c Sun Sep 24 10:43:32 2017 +0100
+++ b/lib-src/movemail.c Sun Sep 24 16:04:49 2017 +0100
@@ -338,6 +338,8 @@
#ifndef WIN32_NATIVE
setuid (getuid ());
#endif
+#else /* MAIL_USE_POP */
+ (void) (poppass); /* Silence compiler warning. */
#endif /* MAIL_USE_POP */
#ifndef DISABLE_DIRECT_ACCESS
diff -r 0d158ce02501 -r 8ac369598a2e lib-src/ootags.c
--- a/lib-src/ootags.c Sun Sep 24 10:43:32 2017 +0100
+++ b/lib-src/ootags.c Sun Sep 24 16:04:49 2017 +0100
@@ -3465,6 +3465,8 @@
LOOP_ON_INPUT_LINES (inf, lb, dummy)
continue;
+
+ (void)(dummy); /* Silence compiler warning. */
}
/* Fortran parsing */
diff -r 0d158ce02501 -r 8ac369598a2e src/ChangeLog
--- a/src/ChangeLog Sun Sep 24 10:43:32 2017 +0100
+++ b/src/ChangeLog Sun Sep 24 16:04:49 2017 +0100
@@ -1,3 +1,31 @@
+2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
+
+ * chartab.c (chartab_data_validate):
+ Silence an unused-variable compiler warning here.
+ * doprnt.c (bignum_to_string_1):
+ Fix a bug in this function, thank you clang++4.0.
+ * gc.c (KKCC_DO_CHECK_FREE):
+ Avoid an unused-variable warning when not ERROR_CHECK_GC.
+ * gccache-x.c (describe_gc_cache):
+ Fix a bug in this function, thank you clang++4.0.
+ * mule-charset.c (validate_charset_offset_or_size):
+ Be a bit more idiomatic in getting an external list length, and
+ silence a compiler warning while doing so.
+ * redisplay.c (create_text_block):
+ * redisplay.c (create_string_text_block):
+ Fix the same bug in these two functions, thank you clang++4.0.
+ * regex.c (re_compile_fastmap):
+ * regex.c (re_search_2):
+ * regex.c (re_match_2_internal):
+ Silence compiler warnings in this file, both when #define EMACS
+ and when not.
+ * text.c (copy_buffer_text_out):
+ Silence compiler warning here, add an assert to ensure the
+ approach is OK.
+ * unicode.c (free_precedence_array):
+ * unicode.c (recalculate_unicode_precedence):
+ Silence unused variable warnings in these two functions.
+
2017-09-24 Aidan Kehoe <kehoea(a)parhasard.net>
Error when passed values that would overflow, #'make-vector,
diff -r 0d158ce02501 -r 8ac369598a2e src/chartab.c
--- a/src/chartab.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/chartab.c Sun Sep 24 16:04:49 2017 +0100
@@ -1960,6 +1960,7 @@
else if (CHARP (range))
continue;
sferror ("Invalid range format", range);
+ USED (data);
}
return 1;
diff -r 0d158ce02501 -r 8ac369598a2e src/doprnt.c
--- a/src/doprnt.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/doprnt.c Sun Sep 24 16:04:49 2017 +0100
@@ -364,10 +364,10 @@
bignum_to_string_1 (Ibyte **buf, Bytecount *size_inout, bignum bn,
EMACS_UINT radix, Lisp_Object table)
{
- Boolint minusp, heap_allocp = size_inout < 0;
- Ibyte *buf1 = *size_inout > -1 ? *buf :
+ Boolint minusp, heap_allocp = (*buf == NULL);
+ Ibyte *buf1 = heap_allocp ?
((*size_inout = 128 * MAX_ICHAR_LEN),
- (*buf = xnew_array (Ibyte, *size_inout)));
+ (*buf = xnew_array (Ibyte, *size_inout))) : *buf;
Ibyte *end = buf1 + *size_inout, *cursor = end, *this_digit = NULL;
Ibyte *ftmdata = XSTRING_DATA (table);
/* Since, in contrast with the fixnum code, we are repeatedly checking the
diff -r 0d158ce02501 -r 8ac369598a2e src/gc.c
--- a/src/gc.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/gc.c Sun Sep 24 16:04:49 2017 +0100
@@ -1358,7 +1358,7 @@
} \
} while (0)
#else
-#define KKCC_DO_CHECK_FREE(obj, allow_free) DO_NOTHING
+#define KKCC_DO_CHECK_FREE(obj, allow_free) (USED (allow_free))
#endif
static inline void
diff -r 0d158ce02501 -r 8ac369598a2e src/gccache-x.c
--- a/src/gccache-x.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/gccache-x.c Sun Sep 24 16:04:49 2017 +0100
@@ -294,7 +294,7 @@
int count = 0;
struct gc_cache_cell *cell = cache->head;
- if (! flags & DGCCFLAG_SUMMARY) return;
+ if (!(flags & DGCCFLAG_SUMMARY)) return;
stderr_out ("\nsize: %d", cache->size);
stderr_out ("\ncreated: %d", cache->create_count);
diff -r 0d158ce02501 -r 8ac369598a2e src/mule-charset.c
--- a/src/mule-charset.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/mule-charset.c Sun Sep 24 16:04:49 2017 +0100
@@ -589,12 +589,11 @@
}
else
{
- int len = 0;
+ Elemcount len = 0;
Lisp_Object tem;
- {
- EXTERNAL_LIST_LOOP_1 (value)
- len++;
- }
+
+ GET_EXTERNAL_LIST_LENGTH (value, len);
+
if (len < 1 || len > 2)
invalid_constant_2
("Invalid value for property (list of 1 or 2 integers)",
diff -r 0d158ce02501 -r 8ac369598a2e src/redisplay.c
--- a/src/redisplay.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/redisplay.c Sun Sep 24 16:04:49 2017 +0100
@@ -2933,7 +2933,7 @@
if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100
&& isspace (rb->object.chr.ch))
- && !rb->type == RUNE_BLANK)
+ && rb->type != RUNE_BLANK)
{
dl->bounds.right_white = rb->xpos + rb->width;
done = 1;
@@ -5185,7 +5185,7 @@
if (!(rb->type == RUNE_CHAR && rb->object.chr.ch < 0x100
&& isspace (rb->object.chr.ch))
- && !rb->type == RUNE_BLANK)
+ && rb->type != RUNE_BLANK)
{
dl->bounds.right_white = rb->xpos + rb->width;
done = 1;
diff -r 0d158ce02501 -r 8ac369598a2e src/regex.c
--- a/src/regex.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/regex.c Sun Sep 24 16:04:49 2017 +0100
@@ -4368,7 +4368,6 @@
case charset_mule:
{
int nentries;
- int i;
Bitbyte flags = *p++;
if (flags)
@@ -4957,9 +4956,7 @@
int depth;
#endif
#endif /* emacs */
-#if 1
int forward_search_p;
-#endif
/* Check for out-of-range STARTPOS. */
if (startpos < 0 || startpos > total_size)
@@ -4972,9 +4969,10 @@
else if (endpos > total_size)
range = total_size - startpos;
-#if 1
forward_search_p = range > 0;
-#endif
+
+ (void) (forward_search_p); /* This is only used with assertions, silence the
+ compiler warning when they're turned off. */
/* If the search isn't to be a backwards one, don't waste time in a
search for a pattern that must be anchored. */
@@ -5104,9 +5102,7 @@
INC_IBYTEPTR_FMT (d, fmt);
range -= d - orig_d;
startpos += d - orig_d;
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
else if (range < 0)
{
@@ -5175,9 +5171,7 @@
#endif /* MULE */
INC_IBYTEPTR_FMT (d, fmt);
range -= (d - old_d);
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
}
#ifdef MULE
@@ -5193,9 +5187,7 @@
break;
INC_IBYTEPTR_FMT (d, fmt);
range -= (d - old_d);
-#if 1
assert (!forward_search_p || range >= 0);
-#endif
}
}
#endif /* MULE */
@@ -5206,9 +5198,7 @@
re_char *old_d = d;
INC_IBYTEPTR (d);
range -= (d - old_d);
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
}
}
@@ -5288,9 +5278,7 @@
(startpos >= size1 ? string2 - size1 : string1) + startpos);
d_size = itext_ichar_len_fmt (d, fmt);
range -= d_size;
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
startpos += d_size;
}
else
@@ -5303,9 +5291,7 @@
DEC_IBYTEPTR_FMT (d, fmt);
d_size = itext_ichar_len_fmt (d, fmt);
range += d_size;
-#if 1
- assert (!forward_search_p || range >= 0);
-#endif
+ assert (!forward_search_p || range >= 0);
startpos -= d_size;
}
}
@@ -6677,6 +6663,7 @@
POP_FAILURE_POINT (sdummy, pdummy,
dummy_low_reg, dummy_high_reg,
reg_dummy, reg_dummy, reg_info_dummy);
+ USED (pdummy);
}
/* Note fall through. */
diff -r 0d158ce02501 -r 8ac369598a2e src/text.c
--- a/src/text.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/text.c Sun Sep 24 16:04:49 2017 +0100
@@ -2437,7 +2437,7 @@
{
BUFFER_TEXT_LOOP (buf, pos, len, runptr, runlen)
{
- Bytecount the_src_used, the_dst_used;
+ Bytecount the_src_used = -1, the_dst_used;
the_dst_used = copy_text_between_formats (runptr, runlen,
BUF_FORMAT (buf),
@@ -2446,7 +2446,10 @@
dstobj, &the_src_used);
dst_used += the_dst_used;
if (src_used)
- *src_used += the_src_used;
+ {
+ text_checking_assert (the_src_used >= 0);
+ *src_used += the_src_used;
+ }
if (dst)
{
dst += the_dst_used;
diff -r 0d158ce02501 -r 8ac369598a2e src/unicode.c
--- a/src/unicode.c Sun Sep 24 10:43:32 2017 +0100
+++ b/src/unicode.c Sun Sep 24 16:04:49 2017 +0100
@@ -1771,8 +1771,9 @@
/* We shouldn't be trying to free any precarray that's attached to a
buffer */
{
- ALIST_LOOP_3 (name, buf, Vbuffer_alist)
- assert (!EQ (precarray, XBUFFER (buf)->unicode_precedence_array));
+ LIST_LOOP_2 (elt, Vbuffer_alist)
+ assert (!EQ (precarray,
+ XBUFFER (XCDR (elt))->unicode_precedence_array));
}
assert (!EQ (precarray, Vdefault_unicode_precedence_array));
#endif /* ERROR_CHECK_TEXT */
@@ -1962,9 +1963,9 @@
recalculate_unicode_precedence_1 (Vdefault_unicode_precedence_list,
flags | RUP_MAKE_FULL_P);
{
- ALIST_LOOP_3 (name, buffer, Vbuffer_alist)
+ LIST_LOOP_2 (elt, Vbuffer_alist)
{
- struct buffer *buf = XBUFFER (buffer);
+ struct buffer *buf = XBUFFER (XCDR (elt));
buf->unicode_precedence_array =
recalculate_unicode_precedence_1 (buf->unicode_precedence_list,
flags);
--
‘As I sat looking up at the Guinness ad, I could never figure out /
How your man stayed up on the surfboard after forty pints of stout’
(C. Moore)