From patchwork Wed Jan 23 22:46:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 156426 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp1257775jaa; Wed, 23 Jan 2019 14:48:04 -0800 (PST) X-Google-Smtp-Source: ALg8bN4i7bZUk1irSCofrrW/vcpYInGCxU4z/BxoNxQl2+ejXGEJ5AM6IKqZOqBef9QIDTflVk3E X-Received: by 2002:ac8:1712:: with SMTP id w18mr4380704qtj.76.1548283683964; Wed, 23 Jan 2019 14:48:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548283683; cv=none; d=google.com; s=arc-20160816; b=uXzJduuYwyxJyVNI1rbYTDdrHqVwyoKvRq22HTZRcL+c/ytD3imunwEnYDM4O2iVaM bOULS00obyY1U1OQ3VpNpXAFq63P5bfNbRlkCaLte5JKFv7XlUXDJq9UA/1xCFTOqQi1 xo+rEEX0nFTXcKJyUNrU5KXZVdgNGZB253SwAoCD5lomlRNNje1uk6xerIEFnS5WZsgJ J4l5gp7e5Yf4wMt4TV6a1Kj1WtYWGxpDyb3O3mXleutc8vNqG0NUV7KkzUPKIgpFg/tE MuzH59y3XlfFHxmGIUptJ1S9/zyoRHVEWa2hvxHzsJZwdrfLnDnt9rLBFhsqphg8oxBw JErw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :cc:mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=Gdu3vMdFNavdLUAmgwe5d0qEETceIj3MQT/AZ+V/xJo=; b=pl5E6yHZQ3QHT/C2LnbVkX1MJSYO9uDvhe97Ct1vh8vstzf6lPR8SPGCAn1uu6xIHQ RO/di3+jqyI7NXMX+IPjGd9LD8RwN7RsQqsbVh2gXUzgunBU6gznB6q8LRqyNmD5Do0T xNiLLrmRASO0uLhn7NgaZWRc2D5y8Ai5GFPp14wFnSOjtlNVIgDxh1l/I1Djevsbfbtx PQ7hQYZSaqinwOojOAcnVprnyO0lThTs2YXm4X73Ypfy8kHL3C3HOhbb5UHV132qcPD6 8VKSxFBXWHfv+j2myKoCghShbgy7am61bdL6GWGpKOgyGuXq0xy5MFLj49qCToo6w8B7 4uTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id k38si2962857qvk.220.2019.01.23.14.48.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Jan 2019 14:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6863030AF50; Wed, 23 Jan 2019 22:48:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2F82E2655A; Wed, 23 Jan 2019 22:48:02 +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 D44D13F605; Wed, 23 Jan 2019 22:48:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x0NMlsjU011144 for ; Wed, 23 Jan 2019 17:47:54 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4392D67141; Wed, 23 Jan 2019 22:47:54 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-120-34.rdu2.redhat.com [10.10.120.34]) by smtp.corp.redhat.com (Postfix) with ESMTP id 480A765F72; Wed, 23 Jan 2019 22:47:53 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 23 Jan 2019 17:46:13 -0500 Message-Id: <55760abbf66bfa58e1857d02d1338fdc4b7494b9.1548283535.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Andrea Bolognani Subject: [libvirt] [PATCH 6/9] Require a semicolon for VIR_ENUM_IMPL calls 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 23 Jan 2019 22:48:03 +0000 (UTC) Move the verify() statement to the end of the macro and drop the semicolon, so the compiler will require callers to add a semicolon. Signed-off-by: Cole Robinson --- src/util/virutil.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/util/virutil.h b/src/util/virutil.h index d5adab61e2..f8d8d85d27 100644 --- a/src/util/virutil.h +++ b/src/util/virutil.h @@ -82,7 +82,6 @@ const char *virEnumToString(const char *const*types, # define VIR_ENUM_IMPL(name, lastVal, ...) \ static const char *const name ## TypeList[] = { __VA_ARGS__ }; \ - verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal); \ const char *name ## TypeToString(int type) { \ return virEnumToString(name ## TypeList, \ ARRAY_CARDINALITY(name ## TypeList), \ @@ -93,6 +92,7 @@ const char *virEnumToString(const char *const*types, ARRAY_CARDINALITY(name ## TypeList), \ type); \ } \ + verify(ARRAY_CARDINALITY(name ## TypeList) == lastVal) # define VIR_ENUM_DECL(name) \ const char *name ## TypeToString(int type); \