[libcamera-devel] [PATCH 0/5] libcamera: Switch to C++17

Laurent Pinchart laurent.pinchart at ideasonboard.com
Sat Aug 22 22:00:32 CEST 2020


Hello,

In response to a popular request, this patch series moves libcamera from
C++14 to C++17. This allows new features of the language (such as
[[maybe_unused]]) and the standard library (such as std::clamp()). gcc 5
and gcc 6 can't be supported anymore, which isn't considered as an issue
given that all major distributions that we're targetting ship a recent
enough compiler.

Patch 1/5 switches to C++17. If you're using an existing build
directory, you will need to set the cpp_std option with

	meson configure -Dcpp_std=c++17

Patches 2/5 and 3/5 then update the code base to remove workarounds
needed by C++14 and older compilers. Patch 4/5 is a new attempt to drop
-Wno-unused-parameter, with the standard [[maybe_unused]] attribute this
time instead of commenting out the parameter name to the function. Patch
5/5 extends the usage of [[maybe_unused]] to remove void casts.

Laurent Pinchart (5):
  meson: Switch to C++17
  libcamera: Replace utils::clamp() with std::clamp()
  libcamera: Drop explicit construction of std::queue
  meson: Remove -Wno-unused-parameter
  ipa: raspberrypi: Replace void cast with [[maybe_unused]]

 include/libcamera/bound_method.h              |  2 +-
 include/libcamera/internal/utils.h            |  7 ------
 include/libcamera/signal.h                    |  2 +-
 include/libcamera/span.h                      |  4 ++--
 meson.build                                   |  3 +--
 src/android/camera3_hal.cpp                   | 11 +++++----
 src/android/camera_device.cpp                 |  5 ++--
 src/android/camera_ops.cpp                    |  5 ++--
 src/cam/main.cpp                              |  2 +-
 src/gstreamer/gstlibcamerapool.cpp            |  2 +-
 src/gstreamer/gstlibcameraprovider.cpp        |  2 +-
 src/gstreamer/gstlibcamerasrc.cpp             |  7 ++++--
 src/ipa/raspberrypi/controller/algorithm.cpp  | 16 +++++--------
 src/ipa/raspberrypi/controller/rpi/agc.cpp    |  3 ++-
 src/ipa/raspberrypi/controller/rpi/alsc.cpp   |  8 +++----
 .../raspberrypi/controller/rpi/contrast.cpp   |  4 ++--
 src/ipa/raspberrypi/controller/rpi/noise.cpp  |  5 ++--
 .../raspberrypi/controller/rpi/sharpen.cpp    |  5 ++--
 src/ipa/raspberrypi/raspberrypi.cpp           |  2 +-
 src/ipa/rkisp1/rkisp1.cpp                     | 24 ++++++++++---------
 src/ipa/vimc/vimc.cpp                         | 16 ++++++-------
 src/libcamera/device_enumerator_udev.cpp      |  2 +-
 src/libcamera/ipc_unixsocket.cpp              |  2 +-
 src/libcamera/pipeline/ipu3/cio2.cpp          |  4 +---
 src/libcamera/pipeline/ipu3/imgu.cpp          |  3 ++-
 src/libcamera/pipeline/ipu3/ipu3.cpp          | 12 +++++-----
 .../pipeline/raspberrypi/raspberrypi.cpp      | 10 ++++----
 src/libcamera/pipeline/rkisp1/rkisp1.cpp      |  2 +-
 src/libcamera/pipeline/rkisp1/timeline.cpp    |  2 +-
 src/libcamera/pipeline/vimc/vimc.cpp          |  2 +-
 src/libcamera/process.cpp                     |  2 +-
 src/libcamera/proxy/ipa_proxy_linux.cpp       | 23 ++++++++++--------
 src/libcamera/utils.cpp                       |  8 -------
 src/libcamera/v4l2_pixelformat.cpp            |  2 +-
 src/libcamera/v4l2_videodevice.cpp            |  4 ++--
 src/qcam/dng_writer.cpp                       |  5 ++--
 src/qcam/main.cpp                             |  2 +-
 src/v4l2/v4l2_camera.cpp                      |  2 +-
 test/camera/buffer_import.cpp                 |  3 ++-
 test/camera/capture.cpp                       |  3 ++-
 test/hotplug-cameras.cpp                      |  4 ++--
 test/ipa/ipa_wrappers_test.cpp                |  4 ++--
 test/libtest/test.h                           |  2 +-
 test/log/log_process.cpp                      |  3 ++-
 test/object-invoke.cpp                        |  2 +-
 test/process/process_test.cpp                 |  3 ++-
 test/timer-thread.cpp                         |  2 +-
 test/timer.cpp                                |  2 +-
 48 files changed, 122 insertions(+), 128 deletions(-)

-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list