aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2019-09-18 10:27:39 +0200
committerThomas Schwinge <thomas@codesourcery.com>2020-03-03 12:51:25 +0100
commite04901322aaf707053635ff4c2103c6b1a5d5afd (patch)
treecf969a9d6b98665171f24ad790256f39f389c4e2
parent7ac0298e815b3056dbbb0571a420bc5f9d2832a5 (diff)
downloadgcc-e04901322aaf707053635ff4c2103c6b1a5d5afd.zip
gcc-e04901322aaf707053635ff4c2103c6b1a5d5afd.tar.gz
gcc-e04901322aaf707053635ff4c2103c6b1a5d5afd.tar.bz2
Use PRId64 if available
libgomp/ 2019-09-18 Tobias Burnus <tobias@codesourcery.com> * linux/gomp_print.c (gomp_print_integer): Use PRId64 if available, otherwise cast for %ld. (cherry picked from openacc-gcc-9-branch commit 8a8ebae1a419e1d3642d22874195acf6d5bae7d8)
-rw-r--r--libgomp/ChangeLog.omp5
-rw-r--r--libgomp/config/linux/gomp_print.c11
2 files changed, 15 insertions, 1 deletions
diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp
index 1006b81..db7f2a4 100644
--- a/libgomp/ChangeLog.omp
+++ b/libgomp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2019-09-18 Tobias Burnus <tobias@codesourcery.com>
+
+ * linux/gomp_print.c (gomp_print_integer): Use PRId64 if available,
+ otherwise cast for %ld.
+
2019-09-17 Julian Brown <julian@codesourcery.com>
* libgomp-plugin.h (GOMP_OFFLOAD_openacc_async_host2dev): Update
diff --git a/libgomp/config/linux/gomp_print.c b/libgomp/config/linux/gomp_print.c
index 811bdd6..8b2e383 100644
--- a/libgomp/config/linux/gomp_print.c
+++ b/libgomp/config/linux/gomp_print.c
@@ -1,6 +1,11 @@
#include <stdio.h>
#include <stdint.h>
+#include "config.h" /* For HAVE_INTTYPES_H. */
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h> /* For PRId64. */
+#endif
+
void
gomp_print_string (const char *msg, const char *value)
{
@@ -10,7 +15,11 @@ gomp_print_string (const char *msg, const char *value)
void
gomp_print_integer (const char *msg, int64_t value)
{
- printf ("%s%ld\n", msg, value);
+#ifdef HAVE_INTTYPES_H
+ printf ("%s%" PRId64 "\n", msg, value);
+#else
+ printf ("%s%ld\n", msg, (long) value);
+#endif
}
void