All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Jiri Slaby (SUSE)" <jirislaby@kernel.org>
Cc: tj@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, linux-block@vger.kernel.org
Subject: Re: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints
Date: Mon, 31 Oct 2022 05:24:28 -0700	[thread overview]
Message-ID: <Y1++fLJXkeZgtXR2@infradead.org> (raw)
In-Reply-To: <20221031114520.10518-1-jirislaby@kernel.org>

On Mon, Oct 31, 2022 at 12:45:20PM +0100, Jiri Slaby (SUSE) wrote:
> Cast the enum members to int when printing them.
> 
> Alternatively, we can cast them to ulong (to silence gcc < 12) and use %lu.
> Alternatively, we can move VTIME_PER_SEC away from the enum.

Yes, either split the enum or just use a define.  But casts are a big
code smell and should be avoided if there is a reasonable alternative.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: "Jiri Slaby (SUSE)" <jirislaby-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A@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,
	linux-block-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH] block/blk-iocost (gcc13): cast enum members to int in prints
Date: Mon, 31 Oct 2022 05:24:28 -0700	[thread overview]
Message-ID: <Y1++fLJXkeZgtXR2@infradead.org> (raw)
In-Reply-To: <20221031114520.10518-1-jirislaby-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

On Mon, Oct 31, 2022 at 12:45:20PM +0100, Jiri Slaby (SUSE) wrote:
> Cast the enum members to int when printing them.
> 
> Alternatively, we can cast them to ulong (to silence gcc < 12) and use %lu.
> Alternatively, we can move VTIME_PER_SEC away from the enum.

Yes, either split the enum or just use a define.  But casts are a big
code smell and should be avoided if there is a reasonable alternative.

  reply	other threads:[~2022-10-31 12:24 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 [this message]
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'
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=Y1++fLJXkeZgtXR2@infradead.org \
    --to=hch@infradead.org \
    --cc=axboe@kernel.dk \
    --cc=cgroups@vger.kernel.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 \
    --cc=tj@kernel.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 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.