From patchwork Tue Oct 13 15:12:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10047 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C7814BEEDF for ; Tue, 13 Oct 2020 15:12:49 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 86C8860CE6; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ggHC22kB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D54AE60D4B for ; Tue, 13 Oct 2020 17:12:46 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 66B0CBA9; Tue, 13 Oct 2020 17:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601966; bh=5cAqMH7H4oMMDzC8cVZvQ4YbqlGcPES8aYPfVwzJYYw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ggHC22kBL/3DO1Rh+NaI4+LrjdC+6LlFdHIa0cqIjsxRD42vWr8l39Uzjpt6Gjpur F+EKZevKPmDgTF7L9ApUDFo5uQKUPsJ1wD4lZhb1vo60yywLgvZ4Sc92A6Hgfu7c5c y/kQ6LeJzVbtuj633WMjawBhjhgNj6qAGGtcPhSU= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:32 +0100 Message-Id: <20201013151241.3557005-2-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 01/10] cam: options: Rename optional arg to prevent aliasing X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The parseValue function is given the optarg directly from the getopt library, but the function retains the same name. This causes an alias of the global optarg variable to be present in the parseValue function. While this is not harmful, rename it to work towards disabling aliases variables. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/cam/options.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cam/options.cpp b/src/cam/options.cpp index 358507eabf89..417c3ab49bc9 100644 --- a/src/cam/options.cpp +++ b/src/cam/options.cpp @@ -77,7 +77,7 @@ void OptionsBase::invalidate() template bool OptionsBase::parseValue(const T &opt, const Option &option, - const char *optarg) + const char *arg) { OptionValue value; @@ -88,9 +88,9 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, case OptionInteger: unsigned int integer; - if (optarg) { + if (arg) { char *endptr; - integer = strtoul(optarg, &endptr, 0); + integer = strtoul(arg, &endptr, 0); if (*endptr != '\0') return false; } else { @@ -101,12 +101,12 @@ bool OptionsBase::parseValue(const T &opt, const Option &option, break; case OptionString: - value = OptionValue(optarg ? optarg : ""); + value = OptionValue(arg ? arg : ""); break; case OptionKeyValue: KeyValueParser *kvParser = option.keyValueParser; - KeyValueParser::Options keyValues = kvParser->parse(optarg); + KeyValueParser::Options keyValues = kvParser->parse(arg); if (!keyValues.valid()) return false; From patchwork Tue Oct 13 15:12:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10048 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C93F7BEEDF for ; Tue, 13 Oct 2020 15:12:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E45A560E91; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="tvrJi/6A"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 334B060CE6 for ; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id BC175145A; Tue, 13 Oct 2020 17:12:46 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601966; bh=Jyfi7wYROCyEPQP7NodcAjHolsg4ukdOQ9yCEJWSNPo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tvrJi/6AyrfQ9ZclzV/RsmrubKXNVyS9BQ1Myw+SgDiOJihk0iHy5sekNHDtVGttU pOo+z9QTtOv8qtIRu6GpGui2wfHSoHp2PxmPwhXemx+zNOlvqYaEgusAvHJcori8/w 6k/BiU3QRkRcNK5AMLZlgRJng3arIdQ3FrdDtdok= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:33 +0100 Message-Id: <20201013151241.3557005-3-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/10] qcam: main_window: Re-use existing variable X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The queueRequest function creates FrameBuffer pointer which aliases the existing and passed in buffer pointer. When the captureRaw_ scope is executed, the original FrameBuffer *buffer is not used any more. Re-use it rather than creating a new variable with the same name. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/qcam/main_window.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp index 0cbdab9a6bce..0e50768aa386 100644 --- a/src/qcam/main_window.cpp +++ b/src/qcam/main_window.cpp @@ -769,7 +769,7 @@ void MainWindow::queueRequest(FrameBuffer *buffer) request->addBuffer(vfStream_, buffer); if (captureRaw_) { - FrameBuffer *buffer = nullptr; + buffer = nullptr; { QMutexLocker locker(&mutex_); From patchwork Tue Oct 13 15:12:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10049 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 5636FBEEE1 for ; Tue, 13 Oct 2020 15:12:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 4CFCA60E8A; Tue, 13 Oct 2020 17:12:50 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="MC83o4dl"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 77FED60CE6 for ; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1CC60B87; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601967; bh=tWt31P6uv237PuiVO5cQMJpVSWUDGrxaoD3rm/8SIAE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MC83o4dliC3JghtX4/UA6Jmj9Q+7bBlRvy2uXFVA96MHMRBo/j71M6o3THqjHOzKh 4IXffMk2OpuSYfvPopo74OjfBLkOM5gYfnAb9bPK9izP7q5dnhLJiEInFY1UGti2jy KLSz4GWoZOfILSwBJgqubelJmPG2snSkLnxy7eUQ= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:34 +0100 Message-Id: <20201013151241.3557005-4-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 03/10] libcamera: thread: Prevent aliasing of signal name X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The Thread::wait() function creates a boolean flag 'finished' which aliases the internal member signal of the same name. Rename the boolean flag to prevent confusion and aliasing of the signal. Signed-off-by: Kieran Bingham Reviewed-by: Laurent Pinchart Reviewed-by: Niklas Söderlund --- src/libcamera/thread.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/thread.cpp b/src/libcamera/thread.cpp index 87006a9c4301..b5d7103ad341 100644 --- a/src/libcamera/thread.cpp +++ b/src/libcamera/thread.cpp @@ -374,7 +374,7 @@ void Thread::exit(int code) */ bool Thread::wait(utils::duration duration) { - bool finished = true; + bool hasFinished = true; { MutexLocker locker(data_->mutex_); @@ -382,14 +382,14 @@ bool Thread::wait(utils::duration duration) if (duration == utils::duration::max()) data_->cv_.wait(locker, [&]() { return !data_->running_; }); else - finished = data_->cv_.wait_for(locker, duration, - [&]() { return !data_->running_; }); + hasFinished = data_->cv_.wait_for(locker, duration, + [&]() { return !data_->running_; }); } if (thread_.joinable()) thread_.join(); - return finished; + return hasFinished; } /** From patchwork Tue Oct 13 15:12:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10050 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id CA4B9BEEDF for ; Tue, 13 Oct 2020 15:12:53 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9BFAC60F2A; Tue, 13 Oct 2020 17:12:53 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="rEubadKS"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DBE7060E66 for ; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 6E9CDBA9; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601967; bh=EdfYt/6nzPtXVmt7VxkKXUrrxHaH6IAUchYBuxcNe54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rEubadKS1pcKalisqf6ud6PQGPJYkE7k8XMBBydU8FQVWcQUypHfYfw/rm1K2VC1f RVDpmO/XHeh2RRGXXXYdNT+iHtLvMm32n8TrJndjsBb1K3VGw7EOMMUMo5/MQEbAjC P3/ht/Y0WJuepbA/iA8cUpKWtZvVKS/4jO5r20TQ= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:35 +0100 Message-Id: <20201013151241.3557005-5-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 04/10] libcamera: pipeline: Prevent variable aliasing X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Remove variable aliasing within the pipeline handler implementations. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 6 +++--- src/libcamera/pipeline/simple/converter.cpp | 8 ++++---- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- src/libcamera/pipeline/uvcvideo/uvcvideo.cpp | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 26dbd2573e04..85e0a1f26ab6 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -512,9 +512,9 @@ CameraConfiguration *PipelineHandlerRPi::generateConfiguration(Camera *camera, /* Translate the V4L2PixelFormat to PixelFormat. */ std::map> deviceFormats; for (const auto &format : fmts) { - PixelFormat pixelFormat = format.first.toPixelFormat(); - if (pixelFormat.isValid()) - deviceFormats[pixelFormat] = format.second; + PixelFormat pf = format.first.toPixelFormat(); + if (pf.isValid()) + deviceFormats[pf] = format.second; } /* Add the stream format based on the device node used for the use case. */ diff --git a/src/libcamera/pipeline/simple/converter.cpp b/src/libcamera/pipeline/simple/converter.cpp index 75fb297ebd58..2b541cd2bb3f 100644 --- a/src/libcamera/pipeline/simple/converter.cpp +++ b/src/libcamera/pipeline/simple/converter.cpp @@ -72,11 +72,11 @@ std::vector SimpleConverter::formats(PixelFormat input) * Set the format on the input side (V4L2 output) of the converter to * enumerate the conversion capabilities on its output (V4L2 capture). */ - V4L2DeviceFormat format; - format.fourcc = m2m_->output()->toV4L2PixelFormat(input); - format.size = { 1, 1 }; + V4L2DeviceFormat v4l2Format; + v4l2Format.fourcc = m2m_->output()->toV4L2PixelFormat(input); + v4l2Format.size = { 1, 1 }; - int ret = m2m_->output()->setFormat(&format); + int ret = m2m_->output()->setFormat(&v4l2Format); if (ret < 0) { LOG(SimplePipeline, Error) << "Failed to set format: " << strerror(-ret); diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 7adb17e2d1db..999c44515023 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -314,8 +314,8 @@ int SimpleCameraData::init() config.outputSizes = converter->sizes(format.size); - for (PixelFormat format : converter->formats(pixelFormat)) - formats_[format] = config; + for (PixelFormat fmt : converter->formats(pixelFormat)) + formats_[fmt] = config; } } diff --git a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp index 8ec0dac1e689..54ba1b87bb3e 100644 --- a/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp +++ b/src/libcamera/pipeline/uvcvideo/uvcvideo.cpp @@ -490,8 +490,8 @@ int UVCCameraData::init(MediaDevice *media) /* Locate and initialise the camera data with the default video node. */ const std::vector &entities = media->entities(); auto entity = std::find_if(entities.begin(), entities.end(), - [](MediaEntity *entity) { - return entity->flags() & MEDIA_ENT_FL_DEFAULT; + [](MediaEntity *e) { + return e->flags() & MEDIA_ENT_FL_DEFAULT; }); if (entity == entities.end()) { LOG(UVC, Error) << "Could not find a default video device"; From patchwork Tue Oct 13 15:12:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10051 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 379B9BEEE1 for ; Tue, 13 Oct 2020 15:12:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 0472560E80; Tue, 13 Oct 2020 17:12:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="PSbKKvnz"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3519160D4B for ; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C2026145A; Tue, 13 Oct 2020 17:12:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601967; bh=35VaZ733h0F7aXuhpf3Gu/W8zFekCjx+HoXGDhHTUTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PSbKKvnzsLlgWpTMAqSo0xB7kDVesVGTLflIDgAWSzzfyn3uvWZMeCkfpYZIAGeLr r/jWGEM0pujvGZsEfseDdVRBndDGLy1Hg+prLmdqdHaRKamtmOqRxw5oM7lLGoBdDV jhQY+Qz31eflGoxyec1WeXdlxlnEtc/ZcaC3sJgk= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:36 +0100 Message-Id: <20201013151241.3557005-6-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] libcamera: pipeline: Use existing variable definitions X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Prevent variable aliasing by removing the redeclaration of variables with the same name (and type) where the existing variable can be reused. Signed-off-by: Kieran Bingham --- src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 +- src/libcamera/pipeline/raspberrypi/rpi_stream.cpp | 2 +- src/libcamera/pipeline/simple/simple.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp index 85e0a1f26ab6..2d70d984a276 100644 --- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp +++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp @@ -1008,7 +1008,7 @@ int PipelineHandlerRPi::queueAllBuffers(Camera *camera) */ unsigned int i; for (i = 0; i < data->dropFrameCount_; i++) { - int ret = stream->queueBuffer(nullptr); + ret = stream->queueBuffer(nullptr); if (ret) return ret; } diff --git a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp index 1a42cc17bcba..17e38924d653 100644 --- a/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp +++ b/src/libcamera/pipeline/raspberrypi/rpi_stream.cpp @@ -163,7 +163,7 @@ void Stream::returnBuffer(FrameBuffer *buffer) * If so, do it now as availableBuffers_ will not be empty. */ while (!requestBuffers_.empty()) { - FrameBuffer *buffer = requestBuffers_.front(); + buffer = requestBuffers_.front(); if (!buffer) { /* diff --git a/src/libcamera/pipeline/simple/simple.cpp b/src/libcamera/pipeline/simple/simple.cpp index 999c44515023..33daa2fb1b7b 100644 --- a/src/libcamera/pipeline/simple/simple.cpp +++ b/src/libcamera/pipeline/simple/simple.cpp @@ -612,8 +612,8 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c) useConverter_ = config->needConversion(); if (useConverter_) { - int ret = converter_->configure(pipeConfig.pixelFormat, - pipeConfig.captureSize, &cfg); + ret = converter_->configure(pipeConfig.pixelFormat, + pipeConfig.captureSize, &cfg); if (ret < 0) { LOG(SimplePipeline, Error) << "Unable to configure converter"; From patchwork Tue Oct 13 15:12:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10052 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id B2EE7BEEDF for ; Tue, 13 Oct 2020 15:12:54 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 7E78C60E88; Tue, 13 Oct 2020 17:12:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="i+GIsCnj"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 872E460E80 for ; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 1F62D18B6; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601968; bh=ZZUwCfpXniT+0vCCWQbxSMtwFSjSo2vMgh7C34i63Kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=i+GIsCnjQ3+2YjFZBOKh20tuVJQXMnee38V+MdH924UJIMvwcwllbCQL2ikDA0ef+ ELTvLPgcYasfHgLpRCW00g/a9iH1hTbzwOBA4zK9eBqAx/XCf34O2UnaV065va1ZcY BWKpxpWFDoELFwB+skHK1yG3dOZXwY5dygOs/G98= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:37 +0100 Message-Id: <20201013151241.3557005-7-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 06/10] libcamera: v4l2_videodevice: Prevent aliasing of V4L2BufferCache members X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The members free, and lastUsed were not following the libcamera coding style, and were producing an aliased parameter on the construction. Rename them to be marked as member variables with the _ postfix accordingly. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- include/libcamera/internal/v4l2_videodevice.h | 4 ++-- src/libcamera/v4l2_videodevice.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h index 40ed87e17cfa..53f6a2d5515b 100644 --- a/include/libcamera/internal/v4l2_videodevice.h +++ b/include/libcamera/internal/v4l2_videodevice.h @@ -127,8 +127,8 @@ private: bool operator==(const FrameBuffer &buffer) const; - bool free; - uint64_t lastUsed; + bool free_; + uint64_t lastUsed_; private: struct Plane { diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 508522ef42bb..96952b26c634 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -212,7 +212,7 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) for (unsigned int index = 0; index < cache_.size(); index++) { const Entry &entry = cache_[index]; - if (!entry.free) + if (!entry.free_) continue; /* Try to find a cache hit by comparing the planes. */ @@ -222,9 +222,9 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) break; } - if (entry.lastUsed < oldest) { + if (entry.lastUsed_ < oldest) { use = index; - oldest = entry.lastUsed; + oldest = entry.lastUsed_; } } @@ -248,16 +248,16 @@ int V4L2BufferCache::get(const FrameBuffer &buffer) void V4L2BufferCache::put(unsigned int index) { ASSERT(index < cache_.size()); - cache_[index].free = true; + cache_[index].free_ = true; } V4L2BufferCache::Entry::Entry() - : free(true), lastUsed(0) + : free_(true), lastUsed_(0) { } -V4L2BufferCache::Entry::Entry(bool free, uint64_t lastUsed, const FrameBuffer &buffer) - : free(free), lastUsed(lastUsed) +V4L2BufferCache::Entry::Entry(bool free, uint64_t age, const FrameBuffer &buffer) + : free_(free), lastUsed_(age) { for (const FrameBuffer::Plane &plane : buffer.planes()) planes_.emplace_back(plane); From patchwork Tue Oct 13 15:12:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10053 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 3CF0BBEEDF for ; Tue, 13 Oct 2020 15:12:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EA04060E93; Tue, 13 Oct 2020 17:12:54 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="r22LUIrB"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D514660E13 for ; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7115C18F8; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601968; bh=3GOR7MMzan0eYYBTrnO/IS1f+CR4RYMhZGua83FZLpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r22LUIrBjisw5ar4bX90AKZJwuIj4pkot7Qym8OsyxvAJZGg8ebJTHCcyYlbIVC6R +Qe8U1faxNHDqIlsYfTZLPRjOnSBYmMsNF1LhyirnFUOXIhqICzKDDKJeFZCRscRNz StgkHgywEiMRXZlg3tW1x0L+njJnJcdPiNJVRKvE= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:38 +0100 Message-Id: <20201013151241.3557005-8-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 07/10] test: v4l2_videodevice: Prevent variable aliasing of format X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Rename the scoped usage of the variable format while iterating the formats as it aliases the outer scoped format which is used for specific testing. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- test/v4l2_videodevice/formats.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/v4l2_videodevice/formats.cpp b/test/v4l2_videodevice/formats.cpp index 043732dcaba1..e3283cf92bff 100644 --- a/test/v4l2_videodevice/formats.cpp +++ b/test/v4l2_videodevice/formats.cpp @@ -55,10 +55,10 @@ protected: { V4L2_PIX_FMT_Y16_BE, "Y16 -BE" } }; - for (const auto &format : formats) { - if (V4L2PixelFormat(format.first).toString() != format.second) { + for (const auto &fmt : formats) { + if (V4L2PixelFormat(fmt.first).toString() != fmt.second) { cerr << "Failed to convert V4L2PixelFormat" - << utils::hex(format.first) << "to string" + << utils::hex(fmt.first) << "to string" << endl; return TestFail; } From patchwork Tue Oct 13 15:12:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10054 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id AFE27BEEE1 for ; Tue, 13 Oct 2020 15:12:55 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 74AFB60F1E; Tue, 13 Oct 2020 17:12:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Iv1hY+KA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 3154D60DFD for ; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id C209ABA9; Tue, 13 Oct 2020 17:12:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601968; bh=/3amyfmBVl40XA4/zUIT/CuQHwQ9kzpA0dfssbxbI7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Iv1hY+KAahrvaHodaPHE7p+czmUZR7GfZDQXPOwPyROekXJbSgHfHATp0dw05OTZb x+RvuYNmH9QG4N5jKaDF0K0rP+cBxQx8Xy0YqD2EOQXYcy2t9oos0DwuUGa/YDb8G5 wsQPkyrhIfyLr5Lo9CVQAH8j11bcoOldPYZw5Y9M= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:39 +0100 Message-Id: <20201013151241.3557005-9-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 08/10] ipa: raspberrypi: Re-use iterator variable X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The function gauss_seidel2_SOR() makes use of a function scoped iterator 'i', for several loops, and has a precedence of re-using the function scoped iterator declaration, but then proceeds to alias the iterator with a new declaration in one of the later loops. Re-use the existing iterator variable for consistency, and to prevent variable aliasing. Signed-off-by: Kieran Bingham Reviewed-by: David Plowman --- src/ipa/raspberrypi/controller/rpi/alsc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ipa/raspberrypi/controller/rpi/alsc.cpp b/src/ipa/raspberrypi/controller/rpi/alsc.cpp index 42fbc8a476ad..8447f8bec18b 100644 --- a/src/ipa/raspberrypi/controller/rpi/alsc.cpp +++ b/src/ipa/raspberrypi/controller/rpi/alsc.cpp @@ -628,7 +628,7 @@ static double gauss_seidel2_SOR(double const M[XY][4], double omega, lambda[i] = compute_lambda_bottom(i, M, lambda); lambda[0] = compute_lambda_bottom_start(0, M, lambda); double max_diff = 0; - for (int i = 0; i < XY; i++) { + for (i = 0; i < XY; i++) { lambda[i] = old_lambda[i] + (lambda[i] - old_lambda[i]) * omega; if (fabs(lambda[i] - old_lambda[i]) > fabs(max_diff)) max_diff = lambda[i] - old_lambda[i]; From patchwork Tue Oct 13 15:12:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10055 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 2A43EBEEDF for ; Tue, 13 Oct 2020 15:12:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EE0446100A; Tue, 13 Oct 2020 17:12:55 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="uAS/TJiY"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 87EDC60E86 for ; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 21E17192C; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601969; bh=xsOYFh06ERxj69NBq90KyxIuHU/o74gNLK564ZJBcJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uAS/TJiYEsbYm8Ku1LbS3VEA/Yl7/KL7IaPgvh+72vRH1vKX27q0WhKHxT0YlzbWu aQxxukx6vKRiELfj8ZAlgm9Pn4+V5GpjnT1yG5fVVZpN2xMYu9s8aECtrDSTnIOBOB RmNLctsSdROUkZbGT6Vz6bp0qaqwkwTueg95/TXQ= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:40 +0100 Message-Id: <20201013151241.3557005-10-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 09/10] android: metadata: Prevent variable aliasing X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" The validate_camera_metadata_structure() call uses two instances of a variable named aligned_ptr(). Reuse the first instance which is not otherwise re-used for the second scoped usage. Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund --- *** This is in android metadata library code *** This is only here as a temporary repair. Ideally we shouldn't make changes to this code base. disabling the warning on this library component is likely a better choice. src/android/metadata/camera_metadata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/android/metadata/camera_metadata.c b/src/android/metadata/camera_metadata.c index b86586a7e685..129d1e92ece1 100644 --- a/src/android/metadata/camera_metadata.c +++ b/src/android/metadata/camera_metadata.c @@ -433,7 +433,7 @@ int validate_camera_metadata_structure(const camera_metadata_t *metadata, }; for (size_t i = 0; i < sizeof(alignments)/sizeof(alignments[0]); ++i) { - uintptr_t aligned_ptr = ALIGN_TO((uintptr_t) metadata + alignmentOffset, + aligned_ptr = ALIGN_TO((uintptr_t) metadata + alignmentOffset, alignments[i].alignment); if ((uintptr_t)metadata + alignmentOffset != aligned_ptr) { From patchwork Tue Oct 13 15:12:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10056 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 9B8E6BEEE1 for ; Tue, 13 Oct 2020 15:12:56 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5FB5C60F23; Tue, 13 Oct 2020 17:12:56 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="fL2tRdH9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id E7E7860E93 for ; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) Received: from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 743A4B87; Tue, 13 Oct 2020 17:12:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602601969; bh=Qb0y0wA4CM9Ublmc76aHkTODF0WRJjLWfxGy9vHQtOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fL2tRdH9+s63BhTTue6T2nFBN+ZfVUFT/R+uKV3vaUz8X3hsBKRQrBrUJ31aZ66zt ZaMUodq9CD/KVDVKdJ7HIBUC5Zwvgil4H6RAt1V4aHmCOtQOdT0+WrTr9eLRSbyZeZ WmNMGHd81kqRsfxIzIkrsYGIXmYENwS+WdSN162o= From: Kieran Bingham To: libcamera devel Date: Tue, 13 Oct 2020 16:12:41 +0100 Message-Id: <20201013151241.3557005-11-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> References: <20201013151241.3557005-1-kieran.bingham@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 10/10] meson: Enable shadowed variable warning X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Shadowing variables can lead to unexpected bugs where a code path utilises a variable that may not have been intended by the developer, leading to hard to find bugs. Enable warnings for shadowed variables as defined at: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow As an effect of utilising -Werror, this will cause variable or type shadowing to become a build-time error. Suggested-by: Laurent Pinchart Signed-off-by: Kieran Bingham Reviewed-by: Niklas Söderlund Reviewed-by: Laurent Pinchart --- The reference here is that I lost around 2 hours digging into a bug that looked like some other code path was calling a destructor or such, but was because I had accidentally aliased a private member variable in the constructor, so all my initialisation was lost after the constructor completed. meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index de15cc16da81..10423f523ca5 100644 --- a/meson.build +++ b/meson.build @@ -38,6 +38,7 @@ if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOUR endif common_arguments = [ + '-Wshadow', '-include', 'config.h', ]