From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3on0089.outbound.protection.outlook.com [157.55.234.89]) by dpdk.org (Postfix) with ESMTP id E353E5A40 for ; Tue, 6 Jan 2015 08:04:06 +0100 (CET) Received: from AMSPR02CA0041.eurprd02.prod.outlook.com (10.242.225.169) by DB3PR02MB010.eurprd02.prod.outlook.com (10.242.128.16) with Microsoft SMTP Server (TLS) id 15.1.49.12; Tue, 6 Jan 2015 07:02:45 +0000 Received: from AM1FFO11FD001.protection.gbl (2a01:111:f400:7e00::114) by AMSPR02CA0041.outlook.office365.com (2a01:111:e400:8028::41) with Microsoft SMTP Server (TLS) id 15.1.49.12 via Frontend Transport; Tue, 6 Jan 2015 07:02:44 +0000 Received: from bjgfarm-2.internal.tilera.com (124.207.145.166) by AM1FFO11FD001.mail.protection.outlook.com (10.174.64.83) with Microsoft SMTP Server (TLS) id 15.1.49.13 via Frontend Transport; Tue, 6 Jan 2015 07:02:32 +0000 Received: (from zlu@localhost) by bjgfarm-2.internal.tilera.com (8.14.4/8.14.4/Submit) id t0672O44017225; Tue, 6 Jan 2015 15:02:24 +0800 From: Zhigang Lu To: Date: Tue, 6 Jan 2015 14:53:49 +0800 Message-ID: <1420527230-17037-12-git-send-email-zlu@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1420527230-17037-1-git-send-email-zlu@ezchip.com> References: <1420527230-17037-1-git-send-email-zlu@ezchip.com> X-EOPAttributedMessage: 0 Received-SPF: Fail (protection.outlook.com: domain of ezchip.com does not designate 124.207.145.166 as permitted sender) receiver=protection.outlook.com; client-ip=124.207.145.166; helo=bjgfarm-2.internal.tilera.com; Authentication-Results: spf=fail (sender IP is 124.207.145.166) smtp.mailfrom=zlu@ezchip.com; X-Forefront-Antispam-Report: CIP:124.207.145.166; CTRY:CN; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(339900001)(199003)(189002)(50986999)(31966008)(76176999)(46102003)(21056001)(86362001)(97736003)(48376002)(120916001)(89996001)(87936001)(64706001)(19580395003)(19580405001)(4396001)(50226001)(99396003)(50466002)(92566001)(42186005)(68736005)(105606002)(2351001)(62966003)(107046002)(2950100001)(77156002)(36756003)(84676001)(229853001)(47776003)(6806004)(20776003)(104016003)(106466001)(33646002)(110136001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR02MB010; H:bjgfarm-2.internal.tilera.com; FPR:; SPF:Fail; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-DmarcAction: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005003);SRVR:DB3PR02MB010; X-Forefront-PRVS: 0448A97BF2 X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jan 2015 07:02:32.4914 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3; Ip=[124.207.145.166] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR02MB010 Subject: [dpdk-dev] [PATCH v2 11/12] eal: allow empty set of compile time cpuflags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jan 2015 07:04:07 -0000 On architectures that do not rely on RTE_COMPILE_TIME_CPUFLAGS, the compile_time_flags[] array can end up being zero sized. This results in a compiler complaint in the subsequent loop. Pulling out the array size computation silences this complaint. Signed-off-by: Zhigang Lu Signed-off-by: Cyril Chemparathy --- lib/librte_eal/common/eal_common_cpuflags.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 6fd360c..7a1ca26 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -62,10 +62,12 @@ rte_cpu_check_supported(void) static const enum rte_cpu_flag_t compile_time_flags[] = { RTE_COMPILE_TIME_CPUFLAGS }; + unsigned count = + sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); unsigned i; int ret; - for (i = 0; i < sizeof(compile_time_flags)/sizeof(compile_time_flags[0]); i++) { + for (i = 0; i < count; i++) { ret = rte_cpu_get_flag_enabled(compile_time_flags[i]); if (ret < 0) { -- 2.1.2