Re: [PATCH] v4l-utils tpg GCC 11 fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Em Sun, 14 Mar 2021 22:51:41 +0100
Gregor Jasny <gjasny@xxxxxxxxxxxxxx> 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



[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux