From nobody Tue Jul 1 05:36:48 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1531504547300562.4612992917432; Fri, 13 Jul 2018 10:55:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 239261E31B; Fri, 13 Jul 2018 17:55:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E32C5BEDEB; Fri, 13 Jul 2018 17:55:44 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 1C02618037F2; Fri, 13 Jul 2018 17:55:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w6DHtgt9008363 for ; Fri, 13 Jul 2018 13:55:42 -0400 Received: by smtp.corp.redhat.com (Postfix) id 99407600C4; Fri, 13 Jul 2018 17:55:42 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 903F7600C0 for ; Fri, 13 Jul 2018 17:55:39 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 500303B564 for ; Fri, 13 Jul 2018 17:55:28 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id u16-v6so23031901pfh.3 for ; Fri, 13 Jul 2018 10:55:28 -0700 (PDT) Received: from centos.localdomain ([42.106.1.21]) by smtp.gmail.com with ESMTPSA id n5-v6sm26866817pgr.24.2018.07.13.10.55.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 10:55:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=c5ZO99xOWUeIVu6WAmM5TmhaAYgV/CX7av9/o+M3rnE=; b=Sb9xBVzgYe/7mhsI8l1NLWgb15aKckEaBEkFi+PkqY5tnrgxdOhyoteaALhSzpV4CX 8jdep0BMDSS/r0OrZx/h68Iy2ieitWflYbaxKWCUfrdnIjzX+x/hn+CaRn+ycs7sGw5r 6uLWJDagkkUE1u5cH6KfQT7zz7/vRzC/Hh4Iyze2GPr/pp4ND167GntJupuDGiMIWd65 3e4v3SkTMxs9FIxdtj9P1HbKcKoTSC+fcR5zBytfa+L6aPcvBocIVQUqd/c4eatXcVyP oiuW8jXqa73jy6/R70aX/z0Y6xD4XEtXUvZu8eJXCBJnIrleHF+BGxd8FXmJ/YKYcL/u ImCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=c5ZO99xOWUeIVu6WAmM5TmhaAYgV/CX7av9/o+M3rnE=; b=sP4A2Cu4tBXRlk7QrF0SkfF9Ch9Z174tkAjgrw1D2DiVVV3t6KL7C/wKzeBb2pDeh0 5yQmTaaoV2BaorfuddZSZXKbQH/QY5ChaPaPWnwb8Dmfz/mMBCgesO22jkrI49avpfsY greD7NR0dFZBI3Yb94i3lXvRF0RKKbUedCm526Ac2hdCxynw8MQC7jHbFLB+eUR4Ok9s 5liGaSf93WJt3gguRqcboqtQaudCh8P46J0tbcTaqY8eV/Odu6ul/MnnUHM5Ral9EBX+ i4qlB8IM10Q7I3y+m7nScQgAMKdSchYmen5yhf/KOLq/AvcnBkgcoAbvRcHBvQ1sGg3k 1bpg== X-Gm-Message-State: AOUpUlF4V63kTgqF0IE7p1U+yXAMnKejVBAjM/eAUGCMOuWTXFQRum81 gRlnI4WE6BBshpnXnanPLEgdsCv2 X-Google-Smtp-Source: AAOMgpcPggJQ3KA1HFesT1AZL2fZ35SynY4lR8zI6w8oSphdQ517edrGBInUa4qu6ScMw9ldIj1wTQ== X-Received: by 2002:aa7:84cf:: with SMTP id x15-v6mr8067136pfn.220.1531504527588; Fri, 13 Jul 2018 10:55:27 -0700 (PDT) From: Sukrit Bhatnagar To: libvir-list@redhat.com Date: Fri, 13 Jul 2018 23:24:40 +0530 Message-Id: <1531504509-7930-3-git-send-email-skrtbhtngr@gmail.com> In-Reply-To: <1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com> References: <1531504509-7930-1-git-send-email-skrtbhtngr@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 13 Jul 2018 17:55:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 13 Jul 2018 17:55:28 +0000 (UTC) for IP:'209.85.192.174' DOMAIN:'mail-pf0-f174.google.com' HELO:'mail-pf0-f174.google.com' FROM:'skrtbhtngr@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.301 * (DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, NML_ADSP_CUSTOM_MED, RCVD_IN_DNSWL_NONE, SPF_PASS, T_DKIM_INVALID) 209.85.192.174 mail-pf0-f174.google.com 209.85.192.174 mail-pf0-f174.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 02/31] cfg.mk: variable initialization when declared with cleanup macro X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 13 Jul 2018 17:55:46 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" A variable, which is never assigned a value in the function, might get passed into the cleanup function which may or may not raise any errors. To maintain the correct usage, the variable must be initialized, either with a value or with NULL. This syntax-check rule takes care of that. Signed-off-by: Sukrit Bhatnagar Reviewed-by: Erik Skultety --- cfg.mk | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cfg.mk b/cfg.mk index 6bebd0a..609ae86 100644 --- a/cfg.mk +++ b/cfg.mk @@ -1057,6 +1057,17 @@ sc_prohibit_backslash_alignment: halt=3D'Do not attempt to right-align backslashes' \ $(_sc_search_regexp) =20 +# Some syntax rules pertaining to the usage of cleanup macros +# implementing GNU C's cleanup attribute + +# Rule to ensure that varibales declared using a cleanup macro are +# always initialized. +sc_require_attribute_cleanup_initialization: + @prohibit=3D'VIR_AUTO(FREE|PTR)\(.+\) *[^=3D]+;' \ + in_vc_files=3D'\.[chx]$$' \ + halt=3D'variable declared with a cleanup macro must be initialized' \ + $(_sc_search_regexp) + # We don't use this feature of maint.mk. prev_version_file =3D /dev/null =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list