aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2020-08-11 18:35:44 -0700
committerPaul Eggert2020-08-11 18:36:37 -0700
commit4491a55ac3c4e85a64e47519c8670ba23ae8d2f6 (patch)
tree1227d24a600ffb6ecbe8b64509544d9b5d8726a2 /src
parentdb3a7dfccceb9498227ab06e981706199e1e0f1b (diff)
downloademacs-4491a55ac3c4e85a64e47519c8670ba23ae8d2f6.tar.gz
emacs-4491a55ac3c4e85a64e47519c8670ba23ae8d2f6.zip
Don’t warn about integer conversion in pdumper.c
Problem reported by Juanma Barranquero in: https://lists.gnu.org/r/emacs-devel/2020-08/msg00279.html and a similar glitch was reported by Eli Zaretskii (Bug#36597#67). * src/pdumper.c: Remove -Wconversion pragma. (ALLOW_IMPLICIT_CONVERSION, DISALLOW_IMPLICIT_CONVERSION): Remove. All uses removed. Although -Wconversion may have been helpful when writing pdumper.c it is now causing more trouble than it’s worth here (just as in the rest of Emacs). (dump_read_all): Avoid no-longer-necessary use of ‘size_t’ rather than ‘int’.
Diffstat (limited to 'src')
-rw-r--r--src/pdumper.c39
1 files changed, 3 insertions, 36 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index 7708bc892f8..bc41afc7c5a 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -71,17 +71,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
71#ifdef HAVE_PDUMPER 71#ifdef HAVE_PDUMPER
72 72
73#if GNUC_PREREQ (4, 7, 0) 73#if GNUC_PREREQ (4, 7, 0)
74# pragma GCC diagnostic error "-Wconversion"
75# pragma GCC diagnostic ignored "-Wsign-conversion"
76# pragma GCC diagnostic error "-Wshadow" 74# pragma GCC diagnostic error "-Wshadow"
77# define ALLOW_IMPLICIT_CONVERSION \
78 _Pragma ("GCC diagnostic push") \
79 _Pragma ("GCC diagnostic ignored \"-Wconversion\"")
80# define DISALLOW_IMPLICIT_CONVERSION \
81 _Pragma ("GCC diagnostic pop")
82#else
83# define ALLOW_IMPLICIT_CONVERSION ((void) 0)
84# define DISALLOW_IMPLICIT_CONVERSION ((void) 0)
85#endif 75#endif
86 76
87#define VM_POSIX 1 77#define VM_POSIX 1
@@ -316,9 +306,7 @@ static void
316dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset) 306dump_reloc_set_offset (struct dump_reloc *reloc, dump_off offset)
317{ 307{
318 eassert (offset >= 0); 308 eassert (offset >= 0);
319 ALLOW_IMPLICIT_CONVERSION;
320 reloc->raw_offset = offset >> DUMP_RELOC_ALIGNMENT_BITS; 309 reloc->raw_offset = offset >> DUMP_RELOC_ALIGNMENT_BITS;
321 DISALLOW_IMPLICIT_CONVERSION;
322 if (dump_reloc_get_offset (*reloc) != offset) 310 if (dump_reloc_get_offset (*reloc) != offset)
323 error ("dump relocation out of range"); 311 error ("dump relocation out of range");
324} 312}
@@ -744,10 +732,7 @@ dump_off_from_lisp (Lisp_Object value)
744{ 732{
745 intmax_t n = intmax_t_from_lisp (value); 733 intmax_t n = intmax_t_from_lisp (value);
746 eassert (DUMP_OFF_MIN <= n && n <= DUMP_OFF_MAX); 734 eassert (DUMP_OFF_MIN <= n && n <= DUMP_OFF_MAX);
747 ALLOW_IMPLICIT_CONVERSION; 735 return n;
748 dump_off converted = n;
749 DISALLOW_IMPLICIT_CONVERSION;
750 return converted;
751} 736}
752 737
753static Lisp_Object 738static Lisp_Object
@@ -1994,11 +1979,7 @@ static dump_off
1994finish_dump_pvec (struct dump_context *ctx, 1979finish_dump_pvec (struct dump_context *ctx,
1995 union vectorlike_header *out_hdr) 1980 union vectorlike_header *out_hdr)
1996{ 1981{
1997 ALLOW_IMPLICIT_CONVERSION; 1982 return dump_object_finish (ctx, out_hdr, vectorlike_nbytes (out_hdr));
1998 dump_off result = dump_object_finish (ctx, out_hdr,
1999 vectorlike_nbytes (out_hdr));
2000 DISALLOW_IMPLICIT_CONVERSION;
2001 return result;
2002} 1983}
2003 1984
2004static void 1985static void
@@ -2664,9 +2645,7 @@ static void
2664hash_table_thaw (Lisp_Object hash) 2645hash_table_thaw (Lisp_Object hash)
2665{ 2646{
2666 struct Lisp_Hash_Table *h = XHASH_TABLE (hash); 2647 struct Lisp_Hash_Table *h = XHASH_TABLE (hash);
2667 ALLOW_IMPLICIT_CONVERSION;
2668 h->hash = make_nil_vector (XFIXNUM (h->hash)); 2648 h->hash = make_nil_vector (XFIXNUM (h->hash));
2669 DISALLOW_IMPLICIT_CONVERSION;
2670 h->next = Fmake_vector (h->next, make_fixnum (-1)); 2649 h->next = Fmake_vector (h->next, make_fixnum (-1));
2671 h->index = Fmake_vector (h->index, make_fixnum (-1)); 2650 h->index = Fmake_vector (h->index, make_fixnum (-1));
2672 2651
@@ -3298,9 +3277,7 @@ static void
3298dump_cold_charset (struct dump_context *ctx, Lisp_Object data) 3277dump_cold_charset (struct dump_context *ctx, Lisp_Object data)
3299{ 3278{
3300 /* Dump charset lookup tables. */ 3279 /* Dump charset lookup tables. */
3301 ALLOW_IMPLICIT_CONVERSION;
3302 int cs_i = XFIXNUM (XCAR (data)); 3280 int cs_i = XFIXNUM (XCAR (data));
3303 DISALLOW_IMPLICIT_CONVERSION;
3304 dump_off cs_dump_offset = dump_off_from_lisp (XCDR (data)); 3281 dump_off cs_dump_offset = dump_off_from_lisp (XCDR (data));
3305 dump_remember_fixup_ptr_raw 3282 dump_remember_fixup_ptr_raw
3306 (ctx, 3283 (ctx,
@@ -3608,9 +3585,7 @@ static struct emacs_reloc
3608decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc) 3585decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
3609{ 3586{
3610 struct emacs_reloc reloc = {0}; 3587 struct emacs_reloc reloc = {0};
3611 ALLOW_IMPLICIT_CONVERSION;
3612 int type = XFIXNUM (dump_pop (&lreloc)); 3588 int type = XFIXNUM (dump_pop (&lreloc));
3613 DISALLOW_IMPLICIT_CONVERSION;
3614 reloc.emacs_offset = dump_off_from_lisp (dump_pop (&lreloc)); 3589 reloc.emacs_offset = dump_off_from_lisp (dump_pop (&lreloc));
3615 dump_check_emacs_off (reloc.emacs_offset); 3590 dump_check_emacs_off (reloc.emacs_offset);
3616 switch (type) 3591 switch (type)
@@ -3621,9 +3596,7 @@ decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
3621 reloc.u.dump_offset = dump_off_from_lisp (dump_pop (&lreloc)); 3596 reloc.u.dump_offset = dump_off_from_lisp (dump_pop (&lreloc));
3622 dump_check_dump_off (ctx, reloc.u.dump_offset); 3597 dump_check_dump_off (ctx, reloc.u.dump_offset);
3623 dump_off length = dump_off_from_lisp (dump_pop (&lreloc)); 3598 dump_off length = dump_off_from_lisp (dump_pop (&lreloc));
3624 ALLOW_IMPLICIT_CONVERSION;
3625 reloc.length = length; 3599 reloc.length = length;
3626 DISALLOW_IMPLICIT_CONVERSION;
3627 if (reloc.length != length) 3600 if (reloc.length != length)
3628 error ("relocation copy length too large"); 3601 error ("relocation copy length too large");
3629 } 3602 }
@@ -3634,9 +3607,7 @@ decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
3634 intmax_t value = intmax_t_from_lisp (dump_pop (&lreloc)); 3607 intmax_t value = intmax_t_from_lisp (dump_pop (&lreloc));
3635 dump_off size = dump_off_from_lisp (dump_pop (&lreloc)); 3608 dump_off size = dump_off_from_lisp (dump_pop (&lreloc));
3636 reloc.u.immediate = value; 3609 reloc.u.immediate = value;
3637 ALLOW_IMPLICIT_CONVERSION;
3638 reloc.length = size; 3610 reloc.length = size;
3639 DISALLOW_IMPLICIT_CONVERSION;
3640 eassert (reloc.length == size); 3611 eassert (reloc.length == size);
3641 } 3612 }
3642 break; 3613 break;
@@ -3661,9 +3632,7 @@ decode_emacs_reloc (struct dump_context *ctx, Lisp_Object lreloc)
3661 RELOC_EMACS_IMMEDIATE relocation instead. */ 3632 RELOC_EMACS_IMMEDIATE relocation instead. */
3662 eassert (!dump_object_self_representing_p (target_value)); 3633 eassert (!dump_object_self_representing_p (target_value));
3663 int tag_type = XTYPE (target_value); 3634 int tag_type = XTYPE (target_value);
3664 ALLOW_IMPLICIT_CONVERSION;
3665 reloc.length = tag_type; 3635 reloc.length = tag_type;
3666 DISALLOW_IMPLICIT_CONVERSION;
3667 eassert (reloc.length == tag_type); 3636 eassert (reloc.length == tag_type);
3668 3637
3669 if (type == RELOC_EMACS_EMACS_LV) 3638 if (type == RELOC_EMACS_EMACS_LV)
@@ -3738,9 +3707,7 @@ dump_merge_emacs_relocs (Lisp_Object lreloc_a, Lisp_Object lreloc_b)
3738 return Qnil; 3707 return Qnil;
3739 3708
3740 dump_off new_length = reloc_a.length + reloc_b.length; 3709 dump_off new_length = reloc_a.length + reloc_b.length;
3741 ALLOW_IMPLICIT_CONVERSION;
3742 reloc_a.length = new_length; 3710 reloc_a.length = new_length;
3743 DISALLOW_IMPLICIT_CONVERSION;
3744 if (reloc_a.length != new_length) 3711 if (reloc_a.length != new_length)
3745 return Qnil; /* Overflow */ 3712 return Qnil; /* Overflow */
3746 3713
@@ -5074,7 +5041,7 @@ dump_read_all (int fd, void *buf, size_t bytes_to_read)
5074 /* Some platforms accept only int-sized values to read. 5041 /* Some platforms accept only int-sized values to read.
5075 Round this down to a page size (see MAX_RW_COUNT in sysdep.c). */ 5042 Round this down to a page size (see MAX_RW_COUNT in sysdep.c). */
5076 int max_rw_count = INT_MAX >> 18 << 18; 5043 int max_rw_count = INT_MAX >> 18 << 18;
5077 size_t chunk_to_read = min (bytes_to_read - bytes_read, max_rw_count); 5044 int chunk_to_read = min (bytes_to_read - bytes_read, max_rw_count);
5078 ssize_t chunk = read (fd, (char *) buf + bytes_read, chunk_to_read); 5045 ssize_t chunk = read (fd, (char *) buf + bytes_read, chunk_to_read);
5079 if (chunk < 0) 5046 if (chunk < 0)
5080 return chunk; 5047 return chunk;