* [PATCH] v4l-utils tpg GCC 11 fix
[not found] ` <CAJxGH0-c4eU0Tpwws+jpvf=_+3hJj-rSroQGb9xuZ5ii-KwR+Q@mail.gmail.com>
@ 2021-03-14 21:51 ` Gregor Jasny
2021-03-15 7:21 ` Hans Verkuil
2021-03-15 9:53 ` Mauro Carvalho Chehab
0 siblings, 2 replies; 3+ messages in thread
From: Gregor Jasny @ 2021-03-14 21:51 UTC (permalink / raw)
To: Hans Verkuil; +Cc: linux-media
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/
Thanks,
Gregor
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] v4l-utils tpg GCC 11 fix
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
1 sibling, 0 replies; 3+ messages in thread
From: Hans Verkuil @ 2021-03-15 7:21 UTC (permalink / raw)
To: Gregor Jasny; +Cc: linux-media
Hi Gregor,
On 14/03/2021 22:51, Gregor Jasny wrote:
> 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/
This isn't right:
The changes to capture-win-gl.cpp are definitely wrong since this is openGL code,
so this should remain as-is.
The code from v4l2-tpg.patch can be simplified: the only place min and max is used
is in the min3 and max3 defines. So it is enough to rename the min/max defines to
tpg_min/max.
I've made that change to v4l-utils and pushed it. Please check if this resolves
the issue.
Regards,
Hans
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] v4l-utils tpg GCC 11 fix
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
1 sibling, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2021-03-15 9:53 UTC (permalink / raw)
To: Gregor Jasny; +Cc: Hans Verkuil, linux-media
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-15 9:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox