From: Tobias Burnus <tobias@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: Thomas Schwinge <thomas@codesourcery.com>,
Andrew Stubbs <ams@codesourcery.com>
Subject: [patch, committed] Use PRId64 in libgomp/config/linux
Date: Wed, 18 Sep 2019 08:33:00 -0000 [thread overview]
Message-ID: <6c679700-0cb8-0242-0738-9b217ad65cce@codesourcery.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
Use PRId64 if available, otherwise use a cast. For some reasons, it
failed during bootstrap with a -Werror even though %ld should be okay
with int64_t on x86_64-gnu-linux. Nonetheless, using PRId64 is better.
Committed after testing on x86_64-gnu-linux.
Tobias
[-- Attachment #2: og9.diff --]
[-- Type: text/x-patch, Size: 1582 bytes --]
commit 8a8ebae1a419e1d3642d22874195acf6d5bae7d8
Author: Tobias Burnus <tobias@codesourcery.com>
Date: Wed Sep 18 10:27:39 2019 +0200
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.
diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc
index 1006b8149c8..db7f2a43b80 100644
--- a/libgomp/ChangeLog.openacc
+++ b/libgomp/ChangeLog.openacc
@@ -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 811bdd6e9a9..8b2e383440f 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
reply other threads:[~2019-09-18 8:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6c679700-0cb8-0242-0738-9b217ad65cce@codesourcery.com \
--to=tobias@codesourcery.com \
--cc=ams@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=thomas@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).