diff options
Diffstat (limited to 'src/pdumper.c')
| -rw-r--r-- | src/pdumper.c | 26 |
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. */ |
| 102 | verify (sizeof (ptrdiff_t) == sizeof (void *)); | 102 | static_assert (sizeof (ptrdiff_t) == sizeof (void *)); |
| 103 | verify (sizeof (intptr_t) == sizeof (ptrdiff_t)); | 103 | static_assert (sizeof (intptr_t) == sizeof (ptrdiff_t)); |
| 104 | verify (sizeof (void (*) (void)) == sizeof (void *)); | 104 | static_assert (sizeof (void (*) (void)) == sizeof (void *)); |
| 105 | verify (sizeof (ptrdiff_t) <= sizeof (Lisp_Object)); | 105 | static_assert (sizeof (ptrdiff_t) <= sizeof (Lisp_Object)); |
| 106 | verify (sizeof (ptrdiff_t) <= sizeof (EMACS_INT)); | 106 | static_assert (sizeof (ptrdiff_t) <= sizeof (EMACS_INT)); |
| 107 | 107 | ||
| 108 | static size_t | 108 | static size_t |
| 109 | divide_round_up (size_t x, size_t y) | 109 | divide_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 | ||
| 279 | verify (RELOC_DUMP_TO_EMACS_LV + 8 < (1 << DUMP_RELOC_TYPE_BITS)); | 279 | static_assert (RELOC_DUMP_TO_EMACS_LV + 8 < (1 << DUMP_RELOC_TYPE_BITS)); |
| 280 | verify (DUMP_ALIGNMENT >= GCALIGNMENT); | 280 | static_assert (DUMP_ALIGNMENT >= GCALIGNMENT); |
| 281 | 281 | ||
| 282 | struct dump_reloc | 282 | struct 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 | }; |
| 287 | verify (sizeof (struct dump_reloc) == sizeof (dump_off)); | 287 | static_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]; |