{"id":10197,"url":"https://patchwork.libcamera.org/api/1.1/patches/10197/?format=json","web_url":"https://patchwork.libcamera.org/patch/10197/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20201022081731.36217-4-tomi.valkeinen@iki.fi>","date":"2020-10-22T08:17:31","name":"[libcamera-devel,4/4] HACK: suppress clang-tidy warnings","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":false,"hash":"bcf1db7bf932d7bcf4999ea38009f728b31c8115","submitter":{"id":70,"url":"https://patchwork.libcamera.org/api/1.1/people/70/?format=json","name":"Tomi Valkeinen","email":"tomi.valkeinen@iki.fi"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/10197/mbox/","series":[{"id":1403,"url":"https://patchwork.libcamera.org/api/1.1/series/1403/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=1403","date":"2020-10-22T08:17:28","name":"[libcamera-devel,1/4] Add .clang-tidy","version":1,"mbox":"https://patchwork.libcamera.org/series/1403/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/10197/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/10197/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 9C7A8C3D3C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu, 22 Oct 2020 08:17:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 52AEA6145E;\n\tThu, 22 Oct 2020 10:17:55 +0200 (CEST)","from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com\n\t[IPv6:2a00:1450:4864:20::22e])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 13A6A610FD\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 10:17:52 +0200 (CEST)","by mail-lj1-x22e.google.com with SMTP id c21so955551ljn.13\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu, 22 Oct 2020 01:17:52 -0700 (PDT)","from deskari.lan (91-152-83-50.elisa-laajakaista.fi.\n\t[91.152.83.50]) by smtp.gmail.com with ESMTPSA id\n\tl3sm187007lji.36.2020.10.22.01.17.50\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tThu, 22 Oct 2020 01:17:50 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com;\n\tdkim=fail reason=\"signature verification failed\" (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"tC3kiCcg\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n\th=sender:from:to:cc:subject:date:message-id:in-reply-to:references\n\t:mime-version:content-transfer-encoding;\n\tbh=CNofFG72K/VFMDGmKHy1QkddTDq69y/CgSjwZQOhlRk=;\n\tb=tC3kiCcg/LncF/r6Qqi0qkAzcf6P3qJKAe8oBL2FR7pEtBJkDSTs/pxsQBNAtqRXR7\n\t6gVl1rIhONxoh9RbPu78z6IroTEHre00E0MG+M7dZmodyfYKgR5Xbmj8zKVJ3cVYTmWl\n\t1wMxu7xgRfylMMuZHYtTW+jpISUriVK1GYQgIpAGDAAr2jeadBXYOQDQjI4Y/4Xoc7Xf\n\tQv7eFyVEKIGbeM4msx5KMV9QZ9BPA6/2BQFJ8JSZEU1NaIQTA2Lpvvgro6UVIjCFnZ89\n\twGBkD43y5uHymynjB3OwTJBMslIblsGpWwVdgNsdzi05VrD0A0CnK3MfZcaHEl58HThF\n\tda7g==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:sender:from:to:cc:subject:date:message-id\n\t:in-reply-to:references:mime-version:content-transfer-encoding;\n\tbh=CNofFG72K/VFMDGmKHy1QkddTDq69y/CgSjwZQOhlRk=;\n\tb=aB+L57dclcv5LO4d0DEl+ZU+eHcRgWsindmCuixL80qj92rQY0UBtNVvgykDt4zYc2\n\tOeTRxWEDmveDSk1Ne2gCn6fujNHxD8C3FbSZbqUErInd76UK5jFwsoRQscF8bHxaGKuM\n\tDpskYJ6O0ZjwE6DkvdufuaK9xlKZbvHWf5Bq+6sNryPUqjcZvu2APMYzWnE7G6I+iWHd\n\tCnNPUN8HtOmQTvFU/Uou9QaLF0LAAjgk8TlAHVqnlR+BXxBqSbz3ljxXuDNP3I9LUXEn\n\tfj7S6od4kgHuV7vW7XAAxXtaK6xIGyc40mD+qV8Ta+tSZ0BIsyaeL5iNhcUX6lbmDKcm\n\tWvYg==","X-Gm-Message-State":"AOAM531yh4G8FHCpYptk2rsFODcirThHpBX0f0iUa5zSOu5ND31JUJwq\n\t8DislIRtYH3ujLHSn1GvfrOIB9izqn3M3g==","X-Google-Smtp-Source":"ABdhPJzT23WNeF0PKYOHEu0tEKyoMrkXnFYyuVEOMalqrIksoVfaxjc67bwArALU/lvzW7WhGucRXg==","X-Received":"by 2002:a05:651c:291:: with SMTP id\n\tb17mr571919ljo.177.1603354671298; \n\tThu, 22 Oct 2020 01:17:51 -0700 (PDT)","From":"Tomi Valkeinen <tomi.valkeinen@iki.fi>","To":"libcamera-devel@lists.libcamera.org","Date":"Thu, 22 Oct 2020 11:17:31 +0300","Message-Id":"<20201022081731.36217-4-tomi.valkeinen@iki.fi>","X-Mailer":"git-send-email 2.25.1","In-Reply-To":"<20201022081731.36217-1-tomi.valkeinen@iki.fi>","References":"<20201022081731.36217-1-tomi.valkeinen@iki.fi>","MIME-Version":"1.0","Subject":"[libcamera-devel] [PATCH 4/4] HACK: suppress clang-tidy warnings","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>","Cc":"Tomi Valkeinen <tomi.valkeinen@iki.fi>","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"These are quick hacks to silence clang-tidy warnings. The purpose of\nthis patch is just to highlight the warnings on the mailing list, and\nalso, if you want to try to fix some of the warnings, it may be nice to\nhave all the rest suppressed.\n\nAfaics, the thread->moveObject(this) warning is a false positive.\nProbably some of the others are too.\n\nNote that I used assert() there in a few places, just after ASSERT().\nThe reason being, ASSERT() just prints an error, while assert() aborts,\nso clang-tidy takes the assert() seriously.\n\nNot for merging.\n\nSigned-off-by: Tomi Valkeinen <tomi.valkeinen@iki.fi>\n---\n src/ipa/raspberrypi/controller/histogram.cpp       | 2 +-\n src/libcamera/object.cpp                           | 3 ++-\n src/libcamera/pipeline/ipu3/ipu3.cpp               | 1 +\n src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 2 ++\n src/libcamera/pipeline/rkisp1/rkisp1.cpp           | 2 ++\n src/libcamera/v4l2_device.cpp                      | 1 -\n src/libcamera/v4l2_pixelformat.cpp                 | 2 +-\n 7 files changed, 9 insertions(+), 4 deletions(-)","diff":"diff --git a/src/ipa/raspberrypi/controller/histogram.cpp b/src/ipa/raspberrypi/controller/histogram.cpp\nindex 9916b3ed..ac3f5c48 100644\n--- a/src/ipa/raspberrypi/controller/histogram.cpp\n+++ b/src/ipa/raspberrypi/controller/histogram.cpp\n@@ -51,7 +51,7 @@ double Histogram::InterQuantileMean(double q_lo, double q_hi) const\n \tdouble p_lo = Quantile(q_lo);\n \tdouble p_hi = Quantile(q_hi, (int)p_lo);\n \tdouble sum_bin_freq = 0, cumul_freq = 0;\n-\tfor (double p_next = floor(p_lo) + 1.0; p_next <= ceil(p_hi);\n+\tfor (double p_next = floor(p_lo) + 1.0; p_next <= ceil(p_hi); // NOLINT: Variable 'p_next' with floating point type 'double' should not be used as a loop counter [clang-analyzer-security.FloatLoopCounter]\n \t     p_lo = p_next, p_next += 1.0) {\n \t\tint bin = floor(p_lo);\n \t\tdouble freq = (cumulative_[bin + 1] - cumulative_[bin]) *\ndiff --git a/src/libcamera/object.cpp b/src/libcamera/object.cpp\nindex cd83c684..1b1775e6 100644\n--- a/src/libcamera/object.cpp\n+++ b/src/libcamera/object.cpp\n@@ -257,7 +257,8 @@ void Object::moveToThread(Thread *thread)\n \n \tnotifyThreadMove();\n \n-\tthread->moveObject(this);\n+\t// clang-tidy thinks that the thread can be deleted via DeferredDelete handling in notifyThreadMove()\n+\tthread->moveObject(this); // NOLINT: warning: Use of memory after it is freed [clang-analyzer-cplusplus.NewDelete]\n }\n \n void Object::notifyThreadMove()\ndiff --git a/src/libcamera/pipeline/ipu3/ipu3.cpp b/src/libcamera/pipeline/ipu3/ipu3.cpp\nindex af47739d..eac27153 100644\n--- a/src/libcamera/pipeline/ipu3/ipu3.cpp\n+++ b/src/libcamera/pipeline/ipu3/ipu3.cpp\n@@ -508,6 +508,7 @@ int PipelineHandlerIPU3::configure(Camera *camera, CameraConfiguration *c)\n \t * be at least one active stream in the configuration request).\n \t */\n \tif (!vfCfg) {\n+\t\tassert(mainCfg);\n \t\tret = imgu->configureViewfinder(*mainCfg, &outputFormat);\n \t\tif (ret)\n \t\t\treturn ret;\ndiff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\nindex aa8d9340..4544d606 100644\n--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp\n@@ -1290,6 +1290,7 @@ void RPiCameraData::unicamBufferDequeue(FrameBuffer *buffer)\n \n \t/* The buffer must belong to one of our streams. */\n \tASSERT(stream);\n+\tassert(stream);\n \n \tLOG(RPI, Debug) << \"Stream \" << stream->name() << \" buffer dequeue\"\n \t\t\t<< \", buffer id \" << index\n@@ -1358,6 +1359,7 @@ void RPiCameraData::ispOutputDequeue(FrameBuffer *buffer)\n \n \t/* The buffer must belong to one of our ISP output streams. */\n \tASSERT(stream);\n+\tassert(stream);\n \n \tLOG(RPI, Debug) << \"Stream \" << stream->name() << \" buffer complete\"\n \t\t\t<< \", buffer id \" << index\ndiff --git a/src/libcamera/pipeline/rkisp1/rkisp1.cpp b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\nindex c74a2e9b..be55c32f 100644\n--- a/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n+++ b/src/libcamera/pipeline/rkisp1/rkisp1.cpp\n@@ -379,6 +379,8 @@ protected:\n \t\tif (!info)\n \t\t\tLOG(RkISP1, Fatal) << \"Frame not known\";\n \n+\t\tassert(info);\n+\n \t\t/*\n \t\t * \\todo: If parameters are not filled a better method to handle\n \t\t * the situation than queuing a buffer with unknown content\ndiff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp\nindex 31d4dad0..f747ba79 100644\n--- a/src/libcamera/v4l2_device.cpp\n+++ b/src/libcamera/v4l2_device.cpp\n@@ -243,7 +243,6 @@ ControlList V4L2Device::getControls(const std::vector<uint32_t> &ids)\n \t\tLOG(V4L2, Error) << \"Unable to read control \" << errorIdx\n \t\t\t\t << \": \" << strerror(-ret);\n \t\tcount = errorIdx - 1;\n-\t\tret = errorIdx;\n \t}\n \n \tupdateControls(&ctrls, v4l2Ctrls, count);\ndiff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp\nindex 03ab085c..354136b7 100644\n--- a/src/libcamera/v4l2_pixelformat.cpp\n+++ b/src/libcamera/v4l2_pixelformat.cpp\n@@ -163,7 +163,7 @@ std::string V4L2PixelFormat::toString() const\n \t}\n \n \tif (fourcc_ & (1 << 31))\n-\t\tstrcat(ss, \"-BE\");\n+\t\tmemcpy(ss + 4, \"-BE\", 3);\n \n \treturn ss;\n }\n","prefixes":["libcamera-devel","4/4"]}