From patchwork Thu Apr 11 06:53:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 10895153 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF48B186D for ; Thu, 11 Apr 2019 06:55:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9A8628C79 for ; Thu, 11 Apr 2019 06:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BDAC028968; Thu, 11 Apr 2019 06:55:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3E3E628C79 for ; Thu, 11 Apr 2019 06:55:43 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hETab-0002Bp-1X; Thu, 11 Apr 2019 06:53:37 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hETaZ-0002Be-Kg for xen-devel@lists.xenproject.org; Thu, 11 Apr 2019 06:53:35 +0000 X-Inumbo-ID: 85e5c56e-5c26-11e9-92d7-bc764e045a96 Received: from prv1-mh.provo.novell.com (unknown [137.65.248.33]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 85e5c56e-5c26-11e9-92d7-bc764e045a96; Thu, 11 Apr 2019 06:53:34 +0000 (UTC) Received: from INET-PRV1-MTA by prv1-mh.provo.novell.com with Novell_GroupWise; Thu, 11 Apr 2019 00:53:33 -0600 Message-Id: <5CAEE46B020000780022679C@prv1-mh.provo.novell.com> X-Mailer: Novell GroupWise Internet Agent 18.1.0 Date: Thu, 11 Apr 2019 00:53:31 -0600 From: "Jan Beulich" To: "xen-devel" Mime-Version: 1.0 Content-Disposition: inline Subject: [Xen-devel] [PATCH] xen-cpuid: constification X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Ian Jackson , Roger Pau Monne Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The majority of the static tables is never written to. Add const where possible. Signed-off-by: Jan Beulich Acked-by: Wei Liu --- a/tools/misc/xen-cpuid.c +++ b/tools/misc/xen-cpuid.c @@ -13,7 +13,7 @@ static uint32_t nr_features; -static const char *str_1d[32] = +static const char *const str_1d[32] = { [ 0] = "fpu", [ 1] = "vme", [ 2] = "de", [ 3] = "pse", @@ -33,7 +33,7 @@ static const char *str_1d[32] = [30] = "ia64", [31] = "pbe", }; -static const char *str_1c[32] = +static const char *const str_1c[32] = { [ 0] = "sse3", [ 1] = "pclmulqdq", [ 2] = "dtes64", [ 3] = "monitor", @@ -53,7 +53,7 @@ static const char *str_1c[32] = [30] = "rdrnd", [31] = "hyper", }; -static const char *str_e1d[32] = +static const char *const str_e1d[32] = { [ 0] = "fpu", [ 1] = "vme", [ 2] = "de", [ 3] = "pse", @@ -73,7 +73,7 @@ static const char *str_e1d[32] = [30] = "3dnow+", [31] = "3dnow", }; -static const char *str_e1c[32] = +static const char *const str_e1c[32] = { [ 0] = "lahf_lm", [ 1] = "cmp", [ 2] = "svm", [ 3] = "extapic", @@ -92,7 +92,7 @@ static const char *str_e1c[32] = [28] = "pcx_l2i", [29] = "monitorx", }; -static const char *str_7b0[32] = +static const char *const str_7b0[32] = { [ 0] = "fsgsbase", [ 1] = "tsc-adj", [ 2] = "sgx", [ 3] = "bmi1", @@ -112,13 +112,13 @@ static const char *str_7b0[32] = [30] = "avx512bw", [31] = "avx512vl", }; -static const char *str_Da1[32] = +static const char *const str_Da1[32] = { [ 0] = "xsaveopt", [ 1] = "xsavec", [ 2] = "xgetbv1", [ 3] = "xsaves", }; -static const char *str_7c0[32] = +static const char *const str_7c0[32] = { [ 0] = "prefetchwt1", [ 1] = "avx512_vbmi", [ 2] = "umip", [ 3] = "pku", @@ -136,13 +136,13 @@ static const char *str_7c0[32] = [30] = "sgx_lc", }; -static const char *str_e7d[32] = +static const char *const str_e7d[32] = { [ 8] = "itsc", [10] = "efro", }; -static const char *str_e8b[32] = +static const char *const str_e8b[32] = { [ 0] = "clzero", @@ -149,7 +149,7 @@ static const char *str_e8b[32] = [12] = "ibpb", }; -static const char *str_7d0[32] = +static const char *const str_7d0[32] = { [ 2] = "avx512_4vnniw", [ 3] = "avx512_4fmaps", [ 4] = "fsrm", @@ -163,10 +163,10 @@ static const char *str_7d0[32] = /* 30 */ [31] = "ssbd", }; -static struct { +static const struct { const char *name; const char *abbr; - const char **strs; + const char *const *strs; } decodes[] = { { "0x00000001.edx", "1d", str_1d }, @@ -195,7 +195,7 @@ static struct fsinfo { [XEN_SYSCTL_cpu_featureset_hvm] = { "HVM", 0, NULL }, }; -static void dump_leaf(uint32_t leaf, const char **strs) +static void dump_leaf(uint32_t leaf, const char *const *strs) { unsigned i; @@ -332,7 +332,7 @@ int main(int argc, char **argv) { const char *tmp_optarg; int option_index = 0, c; - static struct option long_options[] = + static const struct option long_options[] = { { "help", no_argument, NULL, 'h' }, { "info", no_argument, NULL, 'i' },