]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Use PRId64 if available
authorTobias Burnus <tobias@codesourcery.com>
Wed, 18 Sep 2019 08:27:39 +0000 (10:27 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Tue, 3 Mar 2020 11:51:25 +0000 (12:51 +0100)
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)

libgomp/ChangeLog.omp
libgomp/config/linux/gomp_print.c

index 1006b8149c8b9946645032611fdf64d1a0d813ad..db7f2a43b80ff1a77e402e152e7d288b339f9cbe 100644 (file)
@@ -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
index 811bdd6e9a934090b9d404d6fbe57779dba2b851..8b2e383440f3068030a89d8ca1cf2b6f5e2817b4 100644 (file)
@@ -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