public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jakub Jelinek <jakub@redhat.com>
To: Jonathan Yong <10walls@gmail.com>,
	Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Change gcc/ira-conflicts.cc build_conflict_bit_table to use size_t/%zu
Date: Thu, 1 Feb 2024 14:13:11 +0100	[thread overview]
Message-ID: <ZbuY5x5boQBoa+4T@tucnak> (raw)
In-Reply-To: <ZbuWHbFKWq62HtBX@tucnak>

On Thu, Feb 01, 2024 at 02:01:17PM +0100, Jakub Jelinek wrote:
> On Thu, Feb 01, 2024 at 12:45:31PM +0000, Jonathan Yong wrote:
> > Attached patch OK? Copied inline for review convenience.
> 
> No, I think e.g. AIX doesn't support the z modifier.
> I don't see %zd or %zu used anywhere except in gcc/jit/ which presumably
> doesn't work on AIX.

Or hwint.h could define PRIusize_t etc. macros and some corresponding type
to be used in casts, something like
#if SIZE_MAX == LONG_LONG_MAX
#define PRIusize_t HOST_LONG_LONG_FORMAT "u"
#define fmt_size_t unsigned long long
#elif SIZE_MAX == LONG_MAX
#define PRIusize_t HOST_LONG_FORMAT "u"
#define fmt_size_t unsigned long
#elif SIZE_MAX == INT_MAX
#define PRIusize_t "u"
#define fmt_size_t unsigned int
#else
#error "Unsupported size_t"
#endif

and then use
"... %" PRIusize_t " ... ", ... (fmt_size_t) (some_size_t_expr), ...

Or at configure time figure out which exact type size_t is say (unsigned
long long vs. unsigned long vs. unsigned int) using templates and
use that info to pick the right format modifier depending on that, then
the casts aren't needed.

	Jakub


  parent reply	other threads:[~2024-02-01 13:13 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 12:45 Jonathan Yong
2024-02-01 13:01 ` Jakub Jelinek
2024-02-01 13:06   ` Xi Ruoyao
2024-02-01 13:42     ` Jonathan Yong
2024-02-01 13:55       ` Jakub Jelinek
2024-02-01 14:33         ` Xi Ruoyao
2024-02-01 14:53           ` Jonathan Yong
2024-02-01 14:55             ` Jakub Jelinek
2024-02-01 15:25               ` Jakub Jelinek
2024-02-01 15:33                 ` Jonathan Yong
2024-02-02 23:43                   ` Jonathan Yong
2024-02-03  0:03                     ` Jakub Jelinek
2024-02-09 10:33                 ` Richard Biener
2024-02-01 13:13   ` Jakub Jelinek [this message]
2024-02-01 14:53     ` Jakub Jelinek

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=ZbuY5x5boQBoa+4T@tucnak \
    --to=jakub@redhat.com \
    --cc=10walls@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    /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).