aboutsummaryrefslogtreecommitdiffstats
path: root/src/pdumper.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdumper.c')
-rw-r--r--src/pdumper.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/pdumper.c b/src/pdumper.c
index 53bddf91f04..5f64d68e9d7 100644
--- a/src/pdumper.c
+++ b/src/pdumper.c
@@ -99,11 +99,11 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
99 are the same size and have the same layout, and where bytes have 99 are the same size and have the same layout, and where bytes have
100 eight bits --- that is, a general-purpose computer made after 1990. 100 eight bits --- that is, a general-purpose computer made after 1990.
101 Also require Lisp_Object to be at least as wide as pointers. */ 101 Also require Lisp_Object to be at least as wide as pointers. */
102verify (sizeof (ptrdiff_t) == sizeof (void *)); 102static_assert (sizeof (ptrdiff_t) == sizeof (void *));
103verify (sizeof (intptr_t) == sizeof (ptrdiff_t)); 103static_assert (sizeof (intptr_t) == sizeof (ptrdiff_t));
104verify (sizeof (void (*) (void)) == sizeof (void *)); 104static_assert (sizeof (void (*) (void)) == sizeof (void *));
105verify (sizeof (ptrdiff_t) <= sizeof (Lisp_Object)); 105static_assert (sizeof (ptrdiff_t) <= sizeof (Lisp_Object));
106verify (sizeof (ptrdiff_t) <= sizeof (EMACS_INT)); 106static_assert (sizeof (ptrdiff_t) <= sizeof (EMACS_INT));
107 107
108static size_t 108static size_t
109divide_round_up (size_t x, size_t y) 109divide_round_up (size_t x, size_t y)
@@ -276,15 +276,15 @@ enum
276 DUMP_RELOC_OFFSET_BITS = DUMP_OFF_WIDTH - DUMP_RELOC_TYPE_BITS 276 DUMP_RELOC_OFFSET_BITS = DUMP_OFF_WIDTH - DUMP_RELOC_TYPE_BITS
277 }; 277 };
278 278
279verify (RELOC_DUMP_TO_EMACS_LV + 8 < (1 << DUMP_RELOC_TYPE_BITS)); 279static_assert (RELOC_DUMP_TO_EMACS_LV + 8 < (1 << DUMP_RELOC_TYPE_BITS));
280verify (DUMP_ALIGNMENT >= GCALIGNMENT); 280static_assert (DUMP_ALIGNMENT >= GCALIGNMENT);
281 281
282struct dump_reloc 282struct dump_reloc
283{ 283{
284 unsigned int raw_offset : DUMP_RELOC_OFFSET_BITS; 284 unsigned int raw_offset : DUMP_RELOC_OFFSET_BITS;
285 ENUM_BF (dump_reloc_type) type : DUMP_RELOC_TYPE_BITS; 285 ENUM_BF (dump_reloc_type) type : DUMP_RELOC_TYPE_BITS;
286}; 286};
287verify (sizeof (struct dump_reloc) == sizeof (dump_off)); 287static_assert (sizeof (struct dump_reloc) == sizeof (dump_off));
288 288
289/* Set the type of a dump relocation. 289/* Set the type of a dump relocation.
290 290
@@ -2244,7 +2244,7 @@ dump_bignum (struct dump_context *ctx, Lisp_Object object)
2244#endif 2244#endif
2245 const struct Lisp_Bignum *bignum = XBIGNUM (object); 2245 const struct Lisp_Bignum *bignum = XBIGNUM (object);
2246 START_DUMP_PVEC (ctx, &bignum->header, struct Lisp_Bignum, out); 2246 START_DUMP_PVEC (ctx, &bignum->header, struct Lisp_Bignum, out);
2247 verify (sizeof (out->value) >= sizeof (struct bignum_reload_info)); 2247 static_assert (sizeof (out->value) >= sizeof (struct bignum_reload_info));
2248 dump_field_fixup_later (ctx, out, bignum, xbignum_val (object)); 2248 dump_field_fixup_later (ctx, out, bignum, xbignum_val (object));
2249 dump_off bignum_offset = finish_dump_pvec (ctx, &out->header); 2249 dump_off bignum_offset = finish_dump_pvec (ctx, &out->header);
2250 if (ctx->flags.dump_object_contents) 2250 if (ctx->flags.dump_object_contents)
@@ -4248,11 +4248,11 @@ types. */)
4248 O_RDWR | O_TRUNC | O_CREAT, 0666); 4248 O_RDWR | O_TRUNC | O_CREAT, 0666);
4249 if (ctx->fd < 0) 4249 if (ctx->fd < 0)
4250 report_file_error ("Opening dump output", filename); 4250 report_file_error ("Opening dump output", filename);
4251 verify (sizeof (ctx->header.magic) == sizeof (dump_magic)); 4251 static_assert (sizeof (ctx->header.magic) == sizeof (dump_magic));
4252 memcpy (&ctx->header.magic, dump_magic, sizeof (dump_magic)); 4252 memcpy (&ctx->header.magic, dump_magic, sizeof (dump_magic));
4253 ctx->header.magic[0] = '!'; /* Note that dump is incomplete. */ 4253 ctx->header.magic[0] = '!'; /* Note that dump is incomplete. */
4254 4254
4255 verify (sizeof (fingerprint) == sizeof (ctx->header.fingerprint)); 4255 static_assert (sizeof (fingerprint) == sizeof (ctx->header.fingerprint));
4256 for (int i = 0; i < sizeof fingerprint; i++) 4256 for (int i = 0; i < sizeof fingerprint; i++)
4257 ctx->header.fingerprint[i] = fingerprint[i]; 4257 ctx->header.fingerprint[i] = fingerprint[i];
4258 4258
@@ -5522,7 +5522,7 @@ dump_do_dump_relocation (const uintptr_t dump_base,
5522 { 5522 {
5523 struct Lisp_Bignum *bignum = dump_ptr (dump_base, reloc_offset); 5523 struct Lisp_Bignum *bignum = dump_ptr (dump_base, reloc_offset);
5524 struct bignum_reload_info reload_info; 5524 struct bignum_reload_info reload_info;
5525 verify (sizeof (reload_info) <= sizeof (*bignum_val (bignum))); 5525 static_assert (sizeof (reload_info) <= sizeof (*bignum_val (bignum)));
5526 memcpy (&reload_info, bignum_val (bignum), sizeof (reload_info)); 5526 memcpy (&reload_info, bignum_val (bignum), sizeof (reload_info));
5527 const mp_limb_t *limbs = 5527 const mp_limb_t *limbs =
5528 dump_ptr (dump_base, reload_info.data_location); 5528 dump_ptr (dump_base, reload_info.data_location);
@@ -5713,7 +5713,7 @@ pdumper_load (const char *dump_filename, char *argv0)
5713 } 5713 }
5714 5714
5715 err = PDUMPER_LOAD_VERSION_MISMATCH; 5715 err = PDUMPER_LOAD_VERSION_MISMATCH;
5716 verify (sizeof (header->fingerprint) == sizeof (fingerprint)); 5716 static_assert (sizeof (header->fingerprint) == sizeof (fingerprint));
5717 unsigned char desired[sizeof fingerprint]; 5717 unsigned char desired[sizeof fingerprint];
5718 for (int i = 0; i < sizeof fingerprint; i++) 5718 for (int i = 0; i < sizeof fingerprint; i++)
5719 desired[i] = fingerprint[i]; 5719 desired[i] = fingerprint[i];