From patchwork Thu Oct 15 22:37:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 10072 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 BCABEBE905 for ; Thu, 15 Oct 2020 22:38:04 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 8590D610DD; Fri, 16 Oct 2020 00:38:04 +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="v67+ZtqV"; 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 D1573610C0 for ; Fri, 16 Oct 2020 00:37:59 +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 54651A42; Fri, 16 Oct 2020 00:37:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1602801479; bh=LSClShbT982AoXYBYL15w32WUSx2bAjx6qNPLuuZ4L8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v67+ZtqVQeUd126p8fxpPX90GVAPHoUHXRET8/TefYPwGSoLBE3PfXz5BQvttdIDS oa673PrkGqAS7huBtz4SJHlPuy+YJT37WRoVooi1IHVTpoC3q3+p+tGa6nHfi5bYHw S6CZ1W5NIOQABNnABKs4U1o9KnE+1b+MuN6GUkBw= From: Kieran Bingham To: libcamera devel 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 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', ]