[libcamera-devel,RFC?,00/10] Shadowed Variables
mbox series

Message ID 20201013151241.3557005-1-kieran.bingham@ideasonboard.com
Headers show
Series
  • Shadowed Variables
Related show

Message

Kieran Bingham Oct. 13, 2020, 3:12 p.m. UTC
Here's some patches I've had kicking around for too long, so I've
cleaned them up to get out and discuss (or integrate where possible).

During development, I hit an awkward issue with a variable being aliased
in the constructor, which caused horrendous pain debugging.

We can warn on shadowed variables to prevent this occuring, and this
series introduces that.

I hope most of this series isn't too contentious, however there is a
change to the src/android/metadata/camera_metadata.c which is directly
imported, and I didn't want to modify that. We'd have to remember that
change if we re-import that code again (Of course the compiler would
tell us). We can't disable the warning just on that file or import.


Kieran Bingham (10):
  cam: options: Rename optional arg to prevent aliasing
  qcam: main_window: Re-use existing variable
  libcamera: thread: Prevent aliasing of signal name
  libcamera: pipeline: Prevent variable aliasing
  libcamera: pipeline: Use existing variable definitions
  libcamera: v4l2_videodevice: Prevent aliasing of V4L2BufferCache
    members
  test: v4l2_videodevice: Prevent variable aliasing of format
  ipa: raspberrypi: Re-use iterator variable
  android: metadata: Prevent variable aliasing
  meson: Enable shadowed variable warning

 include/libcamera/internal/v4l2_videodevice.h      |  4 ++--
 meson.build                                        |  1 +
 src/android/metadata/camera_metadata.c             |  2 +-
 src/cam/options.cpp                                | 10 +++++-----
 src/ipa/raspberrypi/controller/rpi/alsc.cpp        |  2 +-
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp |  8 ++++----
 src/libcamera/pipeline/raspberrypi/rpi_stream.cpp  |  2 +-
 src/libcamera/pipeline/simple/converter.cpp        |  8 ++++----
 src/libcamera/pipeline/simple/simple.cpp           |  8 ++++----
 src/libcamera/pipeline/uvcvideo/uvcvideo.cpp       |  4 ++--
 src/libcamera/thread.cpp                           |  8 ++++----
 src/libcamera/v4l2_videodevice.cpp                 | 14 +++++++-------
 src/qcam/main_window.cpp                           |  2 +-
 test/v4l2_videodevice/formats.cpp                  |  6 +++---
 14 files changed, 40 insertions(+), 39 deletions(-)