From e44ff2de819ead77b00c7fb4ede75ada685ff099 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Apr 2019 15:42:10 -0700 Subject: Remove assumption of uint64_t etc. in portable code C11 doesn’t guarantee the existence of types like uint64_t, so avoid these types in portable code, as it’s easy to do so. There’s no need to avoid the types in w32-specific code, since w32 is guaranteed to have them. * lib-src/make-fingerprint.c (main): * src/fingerprint-dummy.c: * src/fingerprint.h: * src/pdumper.c (dump_fingerprint, struct dump_header): Prefer unsigned char to uint8_t in portable code, as either will do. Put an "#include " in fingerprint.c files, so that the corresponding .o file is rebuilt after ./configure is run. * lib-src/make-fingerprint.c (main): Simplify loop. * src/Makefile.in (fingerprint.c): Update atomically. * src/pdumper.c: Omit unnecessary check that off_t is the same size as int32_t or int64_t, as the code does not rely on this assumption. (dump_off): Use int_least32_t, not int32_t. (struct dump_reloc): Use unsigned int, not uint32_t. (dump_anonymous_allocate_w32, dump_anonymous_allocate_posix) (dump_anonymous_allocate, dump_map_file_w32, dump_map_file_posix) (dump_map_file: Do the sanity checks at compile time, not at run-time, to avoid usage of uint64_t etc. on non-w32 platforms. --- lib-src/make-fingerprint.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib-src') diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c index d310366442d..4bfeaa0742c 100644 --- a/lib-src/make-fingerprint.c +++ b/lib-src/make-fingerprint.c @@ -89,7 +89,7 @@ main (int argc, char **argv) fclose (f); } - uint8_t digest[32]; + unsigned char digest[32]; sha256_finish_ctx (&ctx, digest); if (raw) @@ -99,12 +99,12 @@ main (int argc, char **argv) } else { - printf ("#include \"fingerprint.h\"\n"); - printf ("\n"); - printf ("const uint8_t fingerprint[32] = { "); + puts ("#include \n" + "#include \"fingerprint.h\"\n" + "unsigned char const fingerprint[] = {"); for (int i = 0; i < 32; ++i) - printf ("%s0x%02X", i ? ", " : "", digest[i]); - printf (" };\n"); + printf ("\t0x%02X,\n", digest[i]); + puts ("};"); } return EXIT_SUCCESS; -- cgit v1.2.1 From d82603747564063f908c9c877449c827a9808528 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 9 Apr 2019 15:42:10 -0700 Subject: Remove the need for temacs.in Instead of building a file temacs.in used only to compute a fingerprint, compute the fingerprint directly from the .o and .a files that go into temacs.in. This speeds up the build by avoiding the need to link temacs twice, once with a dummy fingerprint. * lib-src/make-fingerprint.c (main): No need to generate a fingerprint file that includes config.h, now that fingerprint.c depends on all the .o files. * src/Makefile.in ($(libsrc)/make-fingerprint$(EXEEXT)): Use the same rule as $(libsrc)/make-docfile$(EXEEXT). * src/fingerprint-dummy.c: Remove. * src/Makefile.in (${charsets}, $(libsrc)/make-docfile$(EXEEXT)) ($(LIBEGNU_ARCHIVE), $(lwlibdir)/liblw.a, $(oldXMenudir)/libXMenu11.a) (../config.status, ${ETAGS}, ../lisp/TAGS, $(lwlibdir)/TAGS) ($(lispsource)/loaddefs.el): Prefer ‘$(MAKE) -C $(dir $@)’ to ‘${MAKE} -C SOMESTRING’ when either will do, as the former is more regular and lets us coalesce rules better. (EMACS_DEPS_PRE, EMACS_DEPS_POST, BUILD_EMACS_PRE) (BUILD_EMACS_POST, temacs.in$(EXEEXT)): Remove. (FINGERPRINTED): New macro. (fingerprint.c): Use it instead of temacs.in$(EXEEXT), to avoid the need to build temacs.in at all. (temacs$(EXEEXT)): No need to depend on other .o files now; fingerprint.o is enough, since it depends on the rest. Spell out what used to be in BUILD_EMACS_PRE and BUILD_EMACS_POST. (mostlyclean): No need to remove temacs.in. --- lib-src/make-fingerprint.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib-src') diff --git a/lib-src/make-fingerprint.c b/lib-src/make-fingerprint.c index 4bfeaa0742c..35bb8b98a00 100644 --- a/lib-src/make-fingerprint.c +++ b/lib-src/make-fingerprint.c @@ -99,9 +99,9 @@ main (int argc, char **argv) } else { - puts ("#include \n" - "#include \"fingerprint.h\"\n" - "unsigned char const fingerprint[] = {"); + puts ("#include \"fingerprint.h\"\n" + "unsigned char const fingerprint[] =\n" + "{"); for (int i = 0; i < 32; ++i) printf ("\t0x%02X,\n", digest[i]); puts ("};"); -- cgit v1.2.1