All of lore.kernel.org
 help / color / mirror / Atom feed
From: 'Tejun Heo' <tj@kernel.org>
To: David Laight <David.Laight@aculab.com>
Cc: Jiri Slaby <jirislaby@kernel.org>,
	Christoph Hellwig <hch@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Martin Liska <mliska@suse.cz>, Josef Bacik <josef@toxicpanda.com>,
	Jens Axboe <axboe@kernel.dk>,
	"cgroups@vger.kernel.org" <cgroups@vger.kernel.org>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>
Subject: Re: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints
Date: Wed, 2 Nov 2022 06:43:42 -1000	[thread overview]
Message-ID: <Y2KePvYRRMOrqzOe@slm.duckdns.org> (raw)
In-Reply-To: <Y2Kaghnu/sPvl0+g@slm.duckdns.org>

On Wed, Nov 02, 2022 at 06:27:46AM -1000, 'Tejun Heo' wrote:
> On Wed, Nov 02, 2022 at 08:35:34AM +0000, David Laight wrote:
> > I think the enums have to be split.
> > There will be other side effects of promoting the constants to 64bit
> > that are much more difficult to detect than the warnings from printf.
> 
> idk, I think I can just add LLU to everything and it should be fine.
> 
> > I'm also not sure whether the type is even consistent for 32bit
> > and 64bit builds.
> > Casts are (sort of) horrid.
> 
> Yeah, I don't think casts are the solution either. Lemme add LLU to
> everything and see how it works.

So adding LLU to initializers don't make the specific enum's type follow
suit. I guess type determination is really based on the value range. Oh man,
what a mess.

If we end up having to split the enum defs, that's what we'll do but this
doesn't sense to me. It's one thing to make one time adjustment when we
adopt -std=g2x. That's fine, but it makes no sense for the compiler to
change type behavior underneath existing code bases in a way that prevents
the same code to mean the same thing in adjacent and recent compiler
versions. Even if gcc goes for that for whatever reason, there gotta be an
option to keep the original behavior, right?

If so, my suggestion is just sticking with the old behavior until we switch
to --std=g2x and then make one time adjustment at that point.

Thanks.

-- 
tejun

WARNING: multiple messages have this Message-ID (diff)
From: 'Tejun Heo' <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: David Laight <David.Laight-JxhZ9S5GRejQT0dZR+AlfA@public.gmane.org>
Cc: Jiri Slaby <jirislaby-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	Martin Liska <mliska-AlSwsSmVLrQ@public.gmane.org>,
	Josef Bacik <josef-DigfWCa+lFGyeJad7bwFQA@public.gmane.org>,
	Jens Axboe <axboe-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org>,
	"cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints
Date: Wed, 2 Nov 2022 06:43:42 -1000	[thread overview]
Message-ID: <Y2KePvYRRMOrqzOe@slm.duckdns.org> (raw)
In-Reply-To: <Y2Kaghnu/sPvl0+g-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>

On Wed, Nov 02, 2022 at 06:27:46AM -1000, 'Tejun Heo' wrote:
> On Wed, Nov 02, 2022 at 08:35:34AM +0000, David Laight wrote:
> > I think the enums have to be split.
> > There will be other side effects of promoting the constants to 64bit
> > that are much more difficult to detect than the warnings from printf.
> 
> idk, I think I can just add LLU to everything and it should be fine.
> 
> > I'm also not sure whether the type is even consistent for 32bit
> > and 64bit builds.
> > Casts are (sort of) horrid.
> 
> Yeah, I don't think casts are the solution either. Lemme add LLU to
> everything and see how it works.

So adding LLU to initializers don't make the specific enum's type follow
suit. I guess type determination is really based on the value range. Oh man,
what a mess.

If we end up having to split the enum defs, that's what we'll do but this
doesn't sense to me. It's one thing to make one time adjustment when we
adopt -std=g2x. That's fine, but it makes no sense for the compiler to
change type behavior underneath existing code bases in a way that prevents
the same code to mean the same thing in adjacent and recent compiler
versions. Even if gcc goes for that for whatever reason, there gotta be an
option to keep the original behavior, right?

If so, my suggestion is just sticking with the old behavior until we switch
to --std=g2x and then make one time adjustment at that point.

Thanks.

-- 
tejun

  reply	other threads:[~2022-11-02 16:47 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-31 11:45 [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints Jiri Slaby (SUSE)
2022-10-31 11:45 ` Jiri Slaby (SUSE)
2022-10-31 12:24 ` Christoph Hellwig
2022-10-31 12:24   ` Christoph Hellwig
2022-10-31 17:57   ` Tejun Heo
2022-11-01  5:46     ` Jiri Slaby
2022-11-01  5:46       ` Jiri Slaby
2022-11-01 16:46       ` Tejun Heo
2022-11-01 16:46         ` Tejun Heo
2022-11-02  8:35         ` David Laight
2022-11-02 16:27           ` 'Tejun Heo'
2022-11-02 16:43             ` 'Tejun Heo' [this message]
2022-11-02 16:43               ` 'Tejun Heo'
2022-12-12 12:14               ` Jiri Slaby
2022-12-12 12:14                 ` Jiri Slaby
2022-12-12 21:46                 ` 'Tejun Heo'
2022-12-13  8:30                   ` David Laight
2022-12-13 11:15                     ` Jiri Slaby
2022-12-13 11:15                       ` Jiri Slaby
2022-12-13 11:50                       ` David Laight
2022-12-13 11:50                         ` David Laight
2022-12-13 12:05                         ` Jiri Slaby
2022-12-13 12:05                           ` Jiri Slaby
2022-12-13 12:58                           ` David Laight
2022-12-13 12:58                             ` David Laight

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=Y2KePvYRRMOrqzOe@slm.duckdns.org \
    --to=tj@kernel.org \
    --cc=David.Laight@aculab.com \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.org \
    --cc=hch@infradead.org \
    --cc=jirislaby@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mliska@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.