{"id":10072,"url":"https://patchwork.libcamera.org/api/patches/10072/?format=json","web_url":"https://patchwork.libcamera.org/patch/10072/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20201015223750.58563-12-kieran.bingham@ideasonboard.com>","date":"2020-10-15T22:37:50","name":"[libcamera-devel,v2,11/11] meson: Enable shadowed variable warning","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"82b3b6f97c0f2c60b9440ae381c7af196b4cce87","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/?format=json","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10072/mbox/","series":[{"id":1376,"url":"https://patchwork.libcamera.org/api/series/1376/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1376","date":"2020-10-15T22:37:39","name":"Shadowed Variables","version":2,"mbox":"https://patchwork.libcamera.org/series/1376/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10072/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10072/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id BCABEBE905\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 15 Oct 2020 22:38:04 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8590D610DD;\n\tFri, 16 Oct 2020 00:38:04 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D1573610C0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 16 Oct 2020 00:37:59 +0200 (CEST)","from Q.local (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net\n\t[86.31.172.11])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 54651A42;\n\tFri, 16 Oct 2020 00:37:59 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"v67+ZtqV\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1602801479;\n\tbh=LSClShbT982AoXYBYL15w32WUSx2bAjx6qNPLuuZ4L8=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=v67+ZtqVQeUd126p8fxpPX90GVAPHoUHXRET8/TefYPwGSoLBE3PfXz5BQvttdIDS\n\toa673PrkGqAS7huBtz4SJHlPuy+YJT37WRoVooi1IHVTpoC3q3+p+tGa6nHfi5bYHw\n\tS6CZ1W5NIOQABNnABKs4U1o9KnE+1b+MuN6GUkBw=","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","To":"libcamera devel <libcamera-devel@lists.libcamera.org>","Date":"Thu, 15 Oct 2020 23:37:50 +0100","Message-Id":"<20201015223750.58563-12-kieran.bingham@ideasonboard.com>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20201015223750.58563-1-kieran.bingham@ideasonboard.com>","References":"<20201015223750.58563-1-kieran.bingham@ideasonboard.com>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH v2 11/11] meson: Enable shadowed variable\n\twarning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Shadowing variables can lead to unexpected bugs where a code path\nutilises a variable that may not have been intended by the developer,\nleading to hard to find bugs.\n\nEnable warnings for shadowed variables as defined at:\n  https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wshadow\n\nAs an effect of utilising -Werror, this will cause variable or type\nshadowing to become a build-time error.\n\nSuggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\nReviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n---\n\nThe reference here is that I lost around 2 hours digging into a bug that\nlooked like some other code path was calling a destructor or such, but\nwas because I had accidentally aliased a private member variable in the\nconstructor, so all my initialisation was lost after the constructor\ncompleted.\n\n meson.build | 1 +\n 1 file changed, 1 insertion(+)","diff":"diff --git a/meson.build b/meson.build\nindex de15cc16da81..10423f523ca5 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -38,6 +38,7 @@ if cc.has_header_symbol('stdlib.h', 'secure_getenv', prefix : '#define _GNU_SOUR\n endif\n \n common_arguments = [\n+    '-Wshadow',\n     '-include', 'config.h',\n ]\n \n","prefixes":["libcamera-devel","v2","11/11"]}