From: Tobias Burnus Date: Wed, 18 Sep 2019 08:27:39 +0000 (+0200) Subject: Use PRId64 if available X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e04901322aaf707053635ff4c2103c6b1a5d5afd;p=thirdparty%2Fgcc.git Use PRId64 if available libgomp/ 2019-09-18 Tobias Burnus * linux/gomp_print.c (gomp_print_integer): Use PRId64 if available, otherwise cast for %ld. (cherry picked from openacc-gcc-9-branch commit 8a8ebae1a419e1d3642d22874195acf6d5bae7d8) --- diff --git a/libgomp/ChangeLog.omp b/libgomp/ChangeLog.omp index 1006b8149c8b..db7f2a43b80f 100644 --- a/libgomp/ChangeLog.omp +++ b/libgomp/ChangeLog.omp @@ -1,3 +1,8 @@ +2019-09-18 Tobias Burnus + + * linux/gomp_print.c (gomp_print_integer): Use PRId64 if available, + otherwise cast for %ld. + 2019-09-17 Julian Brown * 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 811bdd6e9a93..8b2e383440f3 100644 --- a/libgomp/config/linux/gomp_print.c +++ b/libgomp/config/linux/gomp_print.c @@ -1,6 +1,11 @@ #include #include +#include "config.h" /* For HAVE_INTTYPES_H. */ +#ifdef HAVE_INTTYPES_H +# include /* 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