From: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
To: Gregor Jasny <gjasny@googlemail.com>
Cc: Hans Verkuil <hverkuil@xs4all.nl>, linux-media@vger.kernel.org
Subject: Re: [PATCH] v4l-utils tpg GCC 11 fix
Date: Mon, 15 Mar 2021 10:53:15 +0100 [thread overview]
Message-ID: <20210315105315.18e07b09@coco.lan> (raw)
In-Reply-To: <8169ff5a-8dba-088b-e3b3-1901246d5aec@googlemail.com>
Em Sun, 14 Mar 2021 22:51:41 +0100
Gregor Jasny <gjasny@googlemail.com> escreveu:
> Hello Hans,
>
> On 04.03.21 17:25, Gregor Jasny wrote:
> > qv4l fails to build with GCC 11:
> > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=984381
> >
> > The reason is that min/max are defined as macros here:
> > https://git.linuxtv.org/v4l-utils.git/tree/utils/common/v4l2-tpg.patch#n200
> > <https://git.linuxtv.org/v4l-utils.git/tree/utils/common/v4l2-tpg.patch#n200>
> >
> > should I apply a fix which prefixes the min/max/3 macros with libv4l_?
>
> Could you please take a look at the patch below and tell me if I should
> apply it to v4l-utils master (or of cause, apply it yourself)?
>
> https://sources.debian.org/patches/v4l-utils/1.20.0-3/fix-gcc-11-ftbfs.diff/
My 2 cents:
I don't like the fix:
#ifndef libv4l_min
#define libv4l_min(a,b) ((a) < (b) ? (a) : (b))
#define libv4l_max(a,b) ((a) > (b) ? (a) : (b))
#endif /* !libv4l_min */
The #ifndef there is useless, as no other includes should ever
add it.
The culprit here is that the headers are expecting max() and
min() to be a macro, but on the build, it is using std::min and
std::max functions instead.
As v4l2-ctl-common.cpp has:
#include <algorithm>
This causes a problem.
IMHO, the right solution would be to move the #include
for it to be at utils/common/v4l2-tpg.h, and replace
min/max by std::min/std::max at the headers.
Thanks,
Mauro
prev parent reply other threads:[~2021-03-15 9:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <E1lHUCT-0000OM-9X@paradis.debian.org>
[not found] ` <CAJxGH0-c4eU0Tpwws+jpvf=_+3hJj-rSroQGb9xuZ5ii-KwR+Q@mail.gmail.com>
2021-03-14 21:51 ` [PATCH] v4l-utils tpg GCC 11 fix Gregor Jasny
2021-03-15 7:21 ` Hans Verkuil
2021-03-15 9:53 ` Mauro Carvalho Chehab [this message]
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=20210315105315.18e07b09@coco.lan \
--to=mchehab+huawei@kernel.org \
--cc=gjasny@googlemail.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox