Skip to contentSkip to conversation

v4l-utils tpg GCC 11 fix

PATCH In review Gregor Jasny 3 participants 3 messages Mar 14, 2021 – Mar 15, 2021 2 messages not in the archive Media (V4L/DVB)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAJxGH0-c4eU0Tpwws+jpvf=_+3hJj-rSroQGb9xuZ5ii-KwR+Q@mail.gmail.com

#2 lore raw

PATCH 1/1 v4l-utils tpg GCC 11 fix

Hello Hans,

Quoted 7 lines · Gregor Jasny

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

#3 lore raw

Hi Gregor,

Quoted 10 lines · Gregor Jasny

Hello Hans,

Quoted 7 lines · Gregor Jasny

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>

Quoted 6 lines
Quoted 1 line

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

#4 lore raw
In reply to Gregor Jasny

Em Sun, 14 Mar 2021 22:51:41 +0100
Gregor Jasny <[email protected]> escreveu:

Quoted 10 lines

Hello Hans,

Quoted 7 lines · Gregor Jasny

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>

Quoted 6 lines
Quoted 1 line

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