[libcamera-devel] [PATCH 3/3] libcamera: Declare empty virtual destructors as defaulted

Laurent Pinchart laurent.pinchart at ideasonboard.com
Fri Oct 23 21:52:23 CEST 2020


Hi Kieran,

On Fri, Oct 23, 2020 at 09:53:19AM +0100, Kieran Bingham wrote:
> On 23/10/2020 06:10, Laurent Pinchart wrote:
> > The base class of polymorphic classes is required to declare a
> > destructor. Several of these are empty, and can thus be declared as
> > defaulted.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> 
> What about these?:
> 
> src/ipa/raspberrypi/controller/algorithm.hpp:   virtual ~Algorithm() {}
> src/ipa/raspberrypi/md_parser.hpp:      virtual ~MdParser() {}
> 
> If you've intentionally left those out, or with those fixed:

That was intentional indeed as I was thinking about going through the
RPi IPA in the future to propose aligning it better with the coding
style, but now that you make me think about it, I don't see a good
reason not to address these two locations already. I'll thus fix it.

> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> > ---
> >  include/libcamera/bound_method.h               | 4 ++--
> >  include/libcamera/internal/control_validator.h | 2 +-
> >  include/libcamera/internal/ipa_proxy.h         | 2 +-
> >  include/libcamera/internal/media_object.h      | 2 +-
> >  include/libcamera/internal/pipeline_handler.h  | 4 ++--
> >  include/libcamera/ipa/ipa_interface.h          | 2 +-
> >  src/android/jpeg/encoder.h                     | 2 +-
> >  src/android/post_processor.h                   | 2 +-
> >  src/cam/options.h                              | 2 +-
> >  src/libcamera/pipeline/rkisp1/timeline.h       | 4 ++--
> >  src/qcam/viewfinder.h                          | 2 +-
> >  11 files changed, 14 insertions(+), 14 deletions(-)
> >
> > diff --git a/include/libcamera/bound_method.h b/include/libcamera/bound_method.h
> > index d1e4448304a9..95a956530877 100644
> > --- a/include/libcamera/bound_method.h
> > +++ b/include/libcamera/bound_method.h
> > @@ -26,7 +26,7 @@ enum ConnectionType {
> >  class BoundMethodPackBase
> >  {
> >  public:
> > -	virtual ~BoundMethodPackBase() {}
> > +	virtual ~BoundMethodPackBase() = default;
> >  };
> >  
> >  template<typename R, typename... Args>
> > @@ -61,7 +61,7 @@ public:
> >  		: obj_(obj), object_(object), connectionType_(type)
> >  	{
> >  	}
> > -	virtual ~BoundMethodBase() {}
> > +	virtual ~BoundMethodBase() = default;
> >  
> >  	template<typename T, typename std::enable_if_t<!std::is_same<Object, T>::value> * = nullptr>
> >  	bool match(T *obj) { return obj == obj_; }
> > diff --git a/include/libcamera/internal/control_validator.h b/include/libcamera/internal/control_validator.h
> > index 4a00b9b7f686..206006954cd9 100644
> > --- a/include/libcamera/internal/control_validator.h
> > +++ b/include/libcamera/internal/control_validator.h
> > @@ -16,7 +16,7 @@ class ControlId;
> >  class ControlValidator
> >  {
> >  public:
> > -	virtual ~ControlValidator() {}
> > +	virtual ~ControlValidator() = default;
> >  
> >  	virtual const std::string &name() const = 0;
> >  	virtual bool validate(unsigned int id) const = 0;
> > diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h
> > index b429ce5a68a3..49399f4eb856 100644
> > --- a/include/libcamera/internal/ipa_proxy.h
> > +++ b/include/libcamera/internal/ipa_proxy.h
> > @@ -42,7 +42,7 @@ class IPAProxyFactory
> >  {
> >  public:
> >  	IPAProxyFactory(const char *name);
> > -	virtual ~IPAProxyFactory() {}
> > +	virtual ~IPAProxyFactory() = default;
> >  
> >  	virtual std::unique_ptr<IPAProxy> create(IPAModule *ipam) = 0;
> >  
> > diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
> > index 54311c14895b..43a35bef8f35 100644
> > --- a/include/libcamera/internal/media_object.h
> > +++ b/include/libcamera/internal/media_object.h
> > @@ -31,7 +31,7 @@ protected:
> >  		: dev_(dev), id_(id)
> >  	{
> >  	}
> > -	virtual ~MediaObject() {}
> > +	virtual ~MediaObject() = default;
> >  
> >  	MediaDevice *dev_;
> >  	unsigned int id_;
> > diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
> > index a4e1b529c461..c12c8904858e 100644
> > --- a/include/libcamera/internal/pipeline_handler.h
> > +++ b/include/libcamera/internal/pipeline_handler.h
> > @@ -40,7 +40,7 @@ public:
> >  		: pipe_(pipe)
> >  	{
> >  	}
> > -	virtual ~CameraData() {}
> > +	virtual ~CameraData() = default;
> >  
> >  	Camera *camera_;
> >  	PipelineHandler *pipe_;
> > @@ -118,7 +118,7 @@ class PipelineHandlerFactory
> >  {
> >  public:
> >  	PipelineHandlerFactory(const char *name);
> > -	virtual ~PipelineHandlerFactory() {}
> > +	virtual ~PipelineHandlerFactory() = default;
> >  
> >  	std::shared_ptr<PipelineHandler> create(CameraManager *manager);
> >  
> > diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h
> > index 5016ec25ea9c..322b7079070e 100644
> > --- a/include/libcamera/ipa/ipa_interface.h
> > +++ b/include/libcamera/ipa/ipa_interface.h
> > @@ -150,7 +150,7 @@ struct CameraSensorInfo;
> >  class IPAInterface
> >  {
> >  public:
> > -	virtual ~IPAInterface() {}
> > +	virtual ~IPAInterface() = default;
> >  
> >  	virtual int init(const IPASettings &settings) = 0;
> >  	virtual int start() = 0;
> > diff --git a/src/android/jpeg/encoder.h b/src/android/jpeg/encoder.h
> > index 270ea6091798..0ca2ba38c528 100644
> > --- a/src/android/jpeg/encoder.h
> > +++ b/src/android/jpeg/encoder.h
> > @@ -14,7 +14,7 @@
> >  class Encoder
> >  {
> >  public:
> > -	virtual ~Encoder() {}
> > +	virtual ~Encoder() = default;
> >  
> >  	virtual int configure(const libcamera::StreamConfiguration &cfg) = 0;
> >  	virtual int encode(const libcamera::FrameBuffer &source,
> > diff --git a/src/android/post_processor.h b/src/android/post_processor.h
> > index 5f87a5d1bc30..e0f91880f0bf 100644
> > --- a/src/android/post_processor.h
> > +++ b/src/android/post_processor.h
> > @@ -16,7 +16,7 @@ class CameraMetadata;
> >  class PostProcessor
> >  {
> >  public:
> > -	virtual ~PostProcessor() {}
> > +	virtual ~PostProcessor() = default;
> >  
> >  	virtual int configure(const libcamera::StreamConfiguration &inCfg,
> >  			      const libcamera::StreamConfiguration &outCfg) = 0;
> > diff --git a/src/cam/options.h b/src/cam/options.h
> > index 184866195eef..f02eeca2eef9 100644
> > --- a/src/cam/options.h
> > +++ b/src/cam/options.h
> > @@ -73,7 +73,7 @@ public:
> >  	{
> >  	};
> >  
> > -	virtual ~KeyValueParser() {}
> > +	virtual ~KeyValueParser() = default;
> >  
> >  	bool addOption(const char *name, OptionType type, const char *help,
> >  		       OptionArgument argument = ArgumentNone);
> > diff --git a/src/libcamera/pipeline/rkisp1/timeline.h b/src/libcamera/pipeline/rkisp1/timeline.h
> > index 88f99329873d..0c37b06fa6df 100644
> > --- a/src/libcamera/pipeline/rkisp1/timeline.h
> > +++ b/src/libcamera/pipeline/rkisp1/timeline.h
> > @@ -22,7 +22,7 @@ public:
> >  	FrameAction(unsigned int frame, unsigned int type)
> >  		: frame_(frame), type_(type) {}
> >  
> > -	virtual ~FrameAction() {}
> > +	virtual ~FrameAction() = default;
> >  
> >  	unsigned int frame() const { return frame_; }
> >  	unsigned int type() const { return type_; }
> > @@ -38,7 +38,7 @@ class Timeline
> >  {
> >  public:
> >  	Timeline();
> > -	virtual ~Timeline() {}
> > +	virtual ~Timeline() = default;
> >  
> >  	virtual void reset();
> >  	virtual void scheduleAction(std::unique_ptr<FrameAction> action);
> > diff --git a/src/qcam/viewfinder.h b/src/qcam/viewfinder.h
> > index 67da1df26a0c..e33dc4525224 100644
> > --- a/src/qcam/viewfinder.h
> > +++ b/src/qcam/viewfinder.h
> > @@ -22,7 +22,7 @@ struct MappedBuffer {
> >  class ViewFinder
> >  {
> >  public:
> > -	virtual ~ViewFinder() {}
> > +	virtual ~ViewFinder() = default;
> >  
> >  	virtual const QList<libcamera::PixelFormat> &nativeFormats() const = 0;
> >  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list