From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3on0058.outbound.protection.outlook.com [157.55.234.58]) by dpdk.org (Postfix) with ESMTP id 93B8B5A88 for ; Thu, 9 Jul 2015 07:00:14 +0200 (CEST) Received: from DB5PR02CA0016.eurprd02.prod.outlook.com (10.161.237.26) by VI1PR02MB0813.eurprd02.prod.outlook.com (10.162.14.150) with Microsoft SMTP Server (TLS) id 15.1.207.19; Thu, 9 Jul 2015 05:00:12 +0000 Received: from AM1FFO11FD055.protection.gbl (2a01:111:f400:7e00::128) by DB5PR02CA0016.outlook.office365.com (2a01:111:e400:5805::26) with Microsoft SMTP Server (TLS) id 15.1.213.14 via Frontend Transport; Thu, 9 Jul 2015 05:00:12 +0000 Authentication-Results: spf=fail (sender IP is 124.207.145.166) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none; 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-1.internal.tilera.com; Received: from bjgfarm-1.internal.tilera.com (124.207.145.166) by AM1FFO11FD055.mail.protection.outlook.com (10.174.65.74) with Microsoft SMTP Server (TLS) id 15.1.213.8 via Frontend Transport; Thu, 9 Jul 2015 05:00:10 +0000 Received: (from zlu@localhost) by bjgfarm-1.internal.tilera.com (8.14.4/8.14.4/Submit) id t695066T018561; Thu, 9 Jul 2015 13:00:06 +0800 From: Zhigang Lu To: Date: Thu, 9 Jul 2015 12:58:49 +0800 Message-ID: <1436417938-18496-4-git-send-email-zlu@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1436417938-18496-1-git-send-email-zlu@ezchip.com> References: <1436417938-18496-1-git-send-email-zlu@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1; AM1FFO11FD055; 1:DdBwG+KuBPkSttxhurbpnfX8M8T0M8dXnrWJrckFWB4VBNAWkH896qCjYIsoZ4+HDqH0MspCmQv/IYYxmOiNss3pI5nNscMDQEdxaX8/RPIGKVx8Q6Upuv8Zer7qjFOADmDdpegCzsvO97Dy0jHCnLiO22KoI+abSY8rYkRXWGbmaab6GBO13bzwjcrWsEs7Bops5pJCI/L8qN2qRlXZHQJy832Vdcvm7sPe14/+FZsQIslIucCR68oHwAgJP4GIAdb+I3GtH8/D6yNz3XQT04v0rN8h6S+8hvw1//kjL6Z3hG3HYXIZkz82/0232qOqLL0QrHUa8Ja6lzhcaImo0H0kPEPvpeIZ29RwHwDQhD8UUy7NgpxUZ9A1wLcE71H6zaGiEYCkPpB/3/VY+gCyKZ41ZSBuO0Bx9VCcCfYHmA0i+35nCRGq9LcKwPllLIrX X-Forefront-Antispam-Report: CIP:124.207.145.166; CTRY:CN; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(339900001)(189002)(199003)(42186005)(50986999)(76176999)(110136002)(19580395003)(19580405001)(107886002)(36756003)(5001960100002)(50466002)(2351001)(46102003)(189998001)(48376002)(229853001)(87936001)(77156002)(6806004)(92566002)(450100001)(62966003)(50226001)(5003940100001)(47776003)(2950100001)(85426001)(104016003)(86362001)(33646002)(105606002)(106466001)(4001430100001); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR02MB0813; H:bjgfarm-1.internal.tilera.com; FPR:; SPF:Fail; MLV:sfv; MX:1; A:1; LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB0813; 2:ymdvaBqUupsYJ2Re4uGmY78RlLGeWZnPNStE+nrbH6sxru5Mf0QDpCjV+/4IgSPE; 3:6MznXi7JSu/txZtp9rKTiJFzwWjEnUnK9LfVMc7eRwteq68+wejYpmcpb+F/CjsLXM5BspGhrJmt6XX7W/8wuzRdyEj235TxN+EBv1N4X2jTgQh8+mxXOSRjHCrBdoPN80vl5AqmrBAu9ZVaGo+zLCjGaYNPPqe7QQoGM7+eVcLwV7PsdwMiDtC6UVDkj5sO68zt2RbxRKly9r/2sR2rtB9UU4EpgbcRM7LdU58AVTCtFxyhRMid9owdo9ku1ZGE; 25:BNK1kFQU89tw13iTpeLzXB57dwzWV7ffbDzKHnmFp58Wlp5bKoa6fas4c//mBGIxKG4t1hNy8EGjv5hlcLogLLisVufjgCOUVy/xH16R8gJiqmif798zY+NRUwGCMexujJOpQ5dQqjnyVJsq9l635JmUa3m84z1Mm0f0c2cq9rvZKNDlTg3POUeL1m34zsWi7JKhwWEuK0rPlrq8Fw+OITftMeBh1Xr4PI8i+e7Ew/YD+NUE9INKGTt9jKZqbZ0qfylAWE/KgX2yeZb9vc3kXQ==; 20:okgaDq11UqNveOeILlimmEzgG41ZxB5I7BbGWx2DE4c18IT26gkwWTnCSGiTOxS0SJy1duZOXdKBVxpKATajagB9NMik7y1IC+1FD+GOnNpHh70sO/vQwgt9D1/ZXz/Y9GhMGkOA1GDn1U835gbp41Rgo8YwGk40Yl6ZduP9YxU= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:VI1PR02MB0813; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(3002001); SRVR:VI1PR02MB0813; BCL:0; PCL:0; RULEID:; SRVR:VI1PR02MB0813; X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB0813; 4:ODuipYqOFzSygfRVYhgDgw+33IVzFgn71aC/VBi+I1bhuMXUTkmIIxfFNhaJkBuYq8mDndKoH8h6TJ6OnxBFSpsM07xr/eb0NbdvNm3ffvVPGcnLjAiz5fjIx0ld1Q9e0NEpN1v/9g3HHnQxfUJ9vWkedpn58/D/NLEV57CYfU45U4Rclloqr9g6adrBZs+P8intYKswh90xg5ubbluVHiO5WfecNE37yEz6NvrKjpfJPKuQydDT7vkkeOt1mAlIFkYiHE3KydQxzFGdyEu9zpRTjg9sAr/zZdkpYQCfK98= X-Forefront-PRVS: 0632519F33 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR02MB0813; 23:ev5AAuHNsCtyfXC1/TMAY/phWqbejq06HX60PUN62?= =?us-ascii?Q?YAH2DmJkKjeveSLgAL+2Ei961C4xm7SZP+kkjyOPVeOMN+QQZbpponF1dVbD?= =?us-ascii?Q?rSDY6K80uDh90ltBOzGCNY+EKt8qh4GbGKmtAiZEAopI8RD3QUG/TvClNBSv?= =?us-ascii?Q?kYJBQmELyJrpJ58vwonc2NkAleG3ycF72503CwdgaGd2nUDPPEQ4kVjaItfM?= =?us-ascii?Q?gVyGypvoVK1IcHtV27IJb1uvEmb9g1OKu5V9lqTUO3KkxFGYZzC1stEKmlgx?= =?us-ascii?Q?rDXqdSK4z+vqDdOwHhWmS5NYuvrT5r0f0ZQy//xnQfLr2oafAv6kPCZ8jc7E?= =?us-ascii?Q?Wr6Ta0EJWEANuVZbXgqdEc5E2P4EKkzXsVHJxYAUsTOBHNvAidlZE+RMJcTD?= =?us-ascii?Q?mLBAazgJp9x70FKnYCw4k2LLiYRKS6P3tGwJQOlpwVAl8OHOqqLFlIfjirL9?= =?us-ascii?Q?EwyisvX5mqhRu6PP6Gi1N0v7cJTOj2eAGJEPzcD/bVZqGKh8fhbQkDJzuxoy?= =?us-ascii?Q?/eC0Kyc+VNPcqkgX61NDJO4im/yrQy1AfLehw5BNaAH1FbknPwefviY+NgGi?= =?us-ascii?Q?WYulPJKBq+ZUGZkubvCoueprDqX4Gl8cOoudemRHz0BYSmPTd53DWikF5bfi?= =?us-ascii?Q?vXkEQdmDiqTj/JBQJ/DEimZUsrdR7L2ScgNRC6245bMWN+8KfWfto5cYf2s9?= =?us-ascii?Q?tnCphopYGREXpjFGE9SdcqFuuL90SuJmD19Exc69ddF3eK0k+X7mhNWawgJK?= =?us-ascii?Q?VcsOrI7b8Gw4nGFFpDuK5D1/RMU8D0hhTYBwmzvBoDyLcwwfAqcGPwSIqpYu?= =?us-ascii?Q?8hI85S1kpLlhdthzq6f6t79lf1YipTXMMAvMe8oTyeQsjBXquvarZnQ2DODD?= =?us-ascii?Q?xHYVax0WmCBMchyJMSv1XogV1y32IORoAFPHODfOAjT6jiCeuQ5pd30Dm9Eg?= =?us-ascii?Q?U9jBR3FDzCLsyEm9oqTG+0ZKkwMS4RFYDaCIs3JrGiyYLNmBBNTt1ypaWJYW?= =?us-ascii?Q?dA=3D?= X-Microsoft-Exchange-Diagnostics: 1; VI1PR02MB0813; 5:xY9B2M3RHhsPRVf779tR+REDhbuEzdwta1VTk3lEYZSYOev0V3J0VSPdMyO89uHHJDs7Ewk5wlUOiTtoJPJcN5InIKZ8ojwFgjoKZ820nQ3nAH3KFHcAiyXdQYccHaTqkkPC6r5utwCVqieh3KiErQ==; 24:IIf0pmaJCLMW3BAkDmWxcNlhcM+CKFZ2zHMpBpPhy+3PPOsYL49Hvewjo7gjgLz8Jk67hG7FKV7BCfoh1n4Qm2rYm76oldv+cIi2XLJu7QM=; 20:44f3BjG1OV7NkFo7blcFzDV7c66Y8iwMvvd5l1mu8nBrco6haS5hlTWWVHmjQF6FUF9xkqfeoM+BPZeOt7cAVg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jul 2015 05:00:10.6765 (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]; Helo=[bjgfarm-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR02MB0813 Subject: [dpdk-dev] [PATCH v4 03/11] eal: allow empty compile time flags RTE_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: Thu, 09 Jul 2015 05:00:14 -0000 When RTE_COMPILE_TIME_CPUFLAGS is empty, the rte_cpu_check_supported() code breaks with a "comparison is always false due to limited range of data type". This is because the compile_time_flags[] array is empty. Assigning the array dimension to a local variable apparently solves this. Signed-off-by: Zhigang Lu Acked-by: Bruce Richardson --- lib/librte_eal/common/eal_common_cpuflags.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/librte_eal/common/eal_common_cpuflags.c b/lib/librte_eal/common/eal_common_cpuflags.c index 6fd360c..8ba7b30 100644 --- a/lib/librte_eal/common/eal_common_cpuflags.c +++ b/lib/librte_eal/common/eal_common_cpuflags.c @@ -30,6 +30,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include /* @@ -62,10 +63,10 @@ rte_cpu_check_supported(void) static const enum rte_cpu_flag_t compile_time_flags[] = { RTE_COMPILE_TIME_CPUFLAGS }; - unsigned i; + unsigned count = RTE_DIM(compile_time_flags), 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