diff options
| author | Paul Eggert | 2020-03-04 13:48:26 -0800 |
|---|---|---|
| committer | Paul Eggert | 2020-03-04 13:48:58 -0800 |
| commit | dc3006cf1419e5b22c35fa36d79ba029d0482df1 (patch) | |
| tree | ef5581855ed15eafedc296c767f1addcd5f9c13a /lib-src | |
| parent | d1bbd32dba392f2fb4548d892354e78ff8df4451 (diff) | |
| download | emacs-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 'lib-src')
| -rw-r--r-- | lib-src/etags.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib-src/etags.c b/lib-src/etags.c index 174c33a7a5f..eee2c596262 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -124,6 +124,7 @@ University of California, as described above. */ | |||
| 124 | #include <binary-io.h> | 124 | #include <binary-io.h> |
| 125 | #include <intprops.h> | 125 | #include <intprops.h> |
| 126 | #include <unlocked-io.h> | 126 | #include <unlocked-io.h> |
| 127 | #include <verify.h> | ||
| 127 | #include <c-ctype.h> | 128 | #include <c-ctype.h> |
| 128 | #include <c-strcase.h> | 129 | #include <c-strcase.h> |
| 129 | 130 | ||
| @@ -7310,6 +7311,8 @@ static void * | |||
| 7310 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) | 7311 | xnmalloc (ptrdiff_t nitems, ptrdiff_t item_size) |
| 7311 | { | 7312 | { |
| 7312 | ptrdiff_t nbytes; | 7313 | ptrdiff_t nbytes; |
| 7314 | assume (0 <= nitems); | ||
| 7315 | assume (0 < item_size); | ||
| 7313 | if (INT_MULTIPLY_WRAPV (nitems, item_size, &nbytes)) | 7316 | if (INT_MULTIPLY_WRAPV (nitems, item_size, &nbytes)) |
| 7314 | memory_full (); | 7317 | memory_full (); |
| 7315 | return xmalloc (nbytes); | 7318 | return xmalloc (nbytes); |
| @@ -7319,6 +7322,8 @@ static void * | |||
| 7319 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) | 7322 | xnrealloc (void *pa, ptrdiff_t nitems, ptrdiff_t item_size) |
| 7320 | { | 7323 | { |
| 7321 | ptrdiff_t nbytes; | 7324 | ptrdiff_t nbytes; |
| 7325 | assume (0 <= nitems); | ||
| 7326 | assume (0 < item_size); | ||
| 7322 | if (INT_MULTIPLY_WRAPV (nitems, item_size, &nbytes) || SIZE_MAX < nbytes) | 7327 | if (INT_MULTIPLY_WRAPV (nitems, item_size, &nbytes) || SIZE_MAX < nbytes) |
| 7323 | memory_full (); | 7328 | memory_full (); |
| 7324 | void *result = realloc (pa, nbytes); | 7329 | void *result = realloc (pa, nbytes); |