[Gmp-commit] /var/hg/gmp: #include stdint.h even if we have inttypes.h

mercurial at gmplib.org mercurial at gmplib.org
Sun Jun 6 21:10:41 UTC 2021


details:   /var/hg/gmp/rev/37cee5a85875
changeset: 18223:37cee5a85875
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Sun Jun 06 23:10:03 2021 +0200
description:
#include stdint.h even if we have inttypes.h

It would be tempting to remove those includes from the files
that already include gmp-impl.h.

diffstat:

 ChangeLog               |  7 +++++++
 gmp-impl.h              |  9 +++++----
 printf/doprnt.c         |  7 +++----
 printf/repl-vsnprintf.c |  7 +++----
 scanf/doscan.c          |  7 +++----
 tests/misc/t-printf.c   |  7 +++----
 tests/misc/t-scanf.c    |  7 +++----
 7 files changed, 27 insertions(+), 24 deletions(-)

diffs (121 lines):

diff -r 4174a7fea068 -r 37cee5a85875 ChangeLog
--- a/ChangeLog	Sun Jun 06 22:53:16 2021 +0200
+++ b/ChangeLog	Sun Jun 06 23:10:03 2021 +0200
@@ -33,6 +33,13 @@
 	* rand/randsd.c: Likewise.
 	* rand/randsdui.c: Likewise.
 
+	* gmp-impl.h: Include stdint.h even if we have inttypes.h.
+	* printf/doprnt.c: Likewise.
+	* printf/repl-vsnprintf.c: Likewise.
+	* scanf/doscan.c: Likewise.
+	* tests/misc/t-printf.c: Likewise.
+	* tests/misc/t-scanf.c: Likewise.
+
 2021-06-03  Niels Möller  <nisse at lysator.liu.se>
 
 	* mpn/generic/div_qr_1n_pi1.c (mpn_div_qr_1n_pi1): Micro-optimize
diff -r 4174a7fea068 -r 37cee5a85875 gmp-impl.h
--- a/gmp-impl.h	Sun Jun 06 22:53:16 2021 +0200
+++ b/gmp-impl.h	Sun Jun 06 23:10:03 2021 +0200
@@ -154,10 +154,11 @@
 
 #if HAVE_INTTYPES_H      /* for uint_least32_t */
 # include <inttypes.h>
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+/* On some platforms inttypes.h exists but is incomplete
+   and we still need stdint.h. */
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #ifdef __cplusplus
diff -r 4174a7fea068 -r 37cee5a85875 printf/doprnt.c
--- a/printf/doprnt.c	Sun Jun 06 22:53:16 2021 +0200
+++ b/printf/doprnt.c	Sun Jun 06 23:10:03 2021 +0200
@@ -45,10 +45,9 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #if HAVE_LANGINFO_H
diff -r 4174a7fea068 -r 37cee5a85875 printf/repl-vsnprintf.c
--- a/printf/repl-vsnprintf.c	Sun Jun 06 22:53:16 2021 +0200
+++ b/printf/repl-vsnprintf.c	Sun Jun 06 23:10:03 2021 +0200
@@ -50,10 +50,9 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #if HAVE_SYS_TYPES_H
diff -r 4174a7fea068 -r 37cee5a85875 scanf/doscan.c
--- a/scanf/doscan.c	Sun Jun 06 22:53:16 2021 +0200
+++ b/scanf/doscan.c	Sun Jun 06 23:10:03 2021 +0200
@@ -53,10 +53,9 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #if HAVE_SYS_TYPES_H
diff -r 4174a7fea068 -r 37cee5a85875 tests/misc/t-printf.c
--- a/tests/misc/t-printf.c	Sun Jun 06 22:53:16 2021 +0200
+++ b/tests/misc/t-printf.c	Sun Jun 06 23:10:03 2021 +0200
@@ -41,10 +41,9 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #if HAVE_UNISTD_H
diff -r 4174a7fea068 -r 37cee5a85875 tests/misc/t-scanf.c
--- a/tests/misc/t-scanf.c	Sun Jun 06 22:53:16 2021 +0200
+++ b/tests/misc/t-scanf.c	Sun Jun 06 23:10:03 2021 +0200
@@ -39,10 +39,9 @@
 
 #if HAVE_INTTYPES_H
 # include <inttypes.h> /* for intmax_t */
-#else
-# if HAVE_STDINT_H
-#  include <stdint.h>
-# endif
+#endif
+#if HAVE_STDINT_H
+# include <stdint.h>
 #endif
 
 #if HAVE_UNISTD_H


More information about the gmp-commit mailing list