[libcamera-devel] [PATCH] libcamera: pipeline: ipu3: Fix compilation on gcc 5 and 6

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Mar 27 21:10:59 CET 2020


Hi Niklas,

On Fri, Mar 27, 2020 at 09:01:42PM +0100, Niklas Söderlund wrote:
> On 2020-03-27 21:34:24 +0200, Laurent Pinchart wrote:
> > Commit 5e7c5d64a67f ("libcamera: ipu3: Do not unconditionally queue
> > buffers to CIO2") introduced usage of the std::queue default constructor
> > by using copy-list-initialization from {}. The default constructor was
> > explicit in C++11, which was fixed retroactively with a defect report
> > (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0935r0.html).
> > gcc 5 and 6 are unfortunately affected, requiring explicit usage of the
> > constructor.
> > 
> > Fixes: 5e7c5d64a67f ("libcamera: ipu3: Do not unconditionally queue buffers to CIO2")
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > ---
> >  src/libcamera/pipeline/ipu3/ipu3.cpp | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > index b490a801a9c4..1e114ca7ed10 100644
> > --- a/src/libcamera/pipeline/ipu3/ipu3.cpp
> > +++ b/src/libcamera/pipeline/ipu3/ipu3.cpp
> > @@ -1532,7 +1532,8 @@ int CIO2Device::allocateBuffers()
> >  
> >  void CIO2Device::freeBuffers()
> >  {
> > -	availableBuffers_ = {};
> > +	/* The default std::queue constructor is explicit with gcc 5 and 6. */
> 
> I'm not sure the comment is needed, no biggie. With or without it,

It's in the git log, but I've added it here to remind us that we could
simplify the code when we'll drop support for gcc 5 and 6 :-)

> Reviewed-by: Niklas Söderlund <niklas.soderlund at ragnatech.se>
> 
> > +	availableBuffers_ = std::queue<FrameBuffer *>{};
> >  
> >  	buffers_.clear();
> >  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list