From patchwork Tue May 31 08:30:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 102273 Delivered-To: patch@linaro.org Received: by 10.140.92.199 with SMTP id b65csp1806840qge; Tue, 31 May 2016 01:30:32 -0700 (PDT) X-Received: by 10.98.98.69 with SMTP id w66mr53430954pfb.20.1464683432596; Tue, 31 May 2016 01:30:32 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h5si2941334pah.28.2016.05.31.01.30.32; Tue, 31 May 2016 01:30:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161964AbcEaIaa (ORCPT + 30 others); Tue, 31 May 2016 04:30:30 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:63200 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756038AbcEaIaZ (ORCPT ); Tue, 31 May 2016 04:30:25 -0400 Received: from wuerfel.lan. ([78.42.132.4]) by mrelayeu.kundenserver.de (mreue002) with ESMTPA (Nemesis) id 0M5lI9-1bRGF62vvt-00xtRM; Tue, 31 May 2016 10:30:17 +0200 From: Arnd Bergmann To: George Spelvin Cc: Andrew Morton , Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH] hash: fix gcc-4 build warnings in test_hash.c Date: Tue, 31 May 2016 10:30:25 +0200 Message-Id: <1464683443-2900765-1-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.7.0 MIME-Version: 1.0 X-Provags-ID: V03:K0:4pDQMPE7V8QcErixNXz5WY+vjerz3JIviUuxK0d5qktU/xQV8tE qZrr82XCJBpRg/AIEaafYud17Zv6pkRxuvmdMV6GoSj0V2QvYYDPJm8Dx+Aj8lYq3T5m2cs 5m9jdtEVStb+a+PaJqFQLouUHbdtXuDT6nMSCj/7b0QpW1wMHMTpHA7ObG321Zr3Fll9IUa biUp8Rl3atflDxHzFChuQ== X-UI-Out-Filterresults: notjunk:1; V01:K0:bMwPNE95T6U=:IPUXOVPQDsfJ14KsaKsSaz EwRSsvyjn8N/HFcTIbEam1laloHB8s3daib5FtqHrtmYjVJuP6TVl7boE81DGrXKfDEsvJ/as ptRk7nq8qCyynP7wswRgdsnUE/3hbc4ZirUB4+/KyxPzZBQAHnJwm25vtl72qeMeYtrJdhgST HgNhH7qIPYiips+X7ZRQU35NeWgC9Ruc1tZdJODQl2OC/Zmw+Z1feQWz0W4/IA0Xtk8NHo5JQ Rzdm/F2SBjXv2RUmlLk3wmWY77tHYv+laaK3V1IfHaD6YYRN40DUeEjoltJyCH3EI/4pDHvI1 oeC03X3cfs4BFM92OvIxd6RQLxls5dksbX68G6SbfPkWL9zlyGglnFIvQM1cUSdz4qiJbRQ8c w0DCTkP3i3A7X7RkqwzgydkKI6dTgJZPZN1HHyTNzrdRs+Pfev7BhWFWzZYOkSc2XBYxKetQv +TRJoGWLRodjCGEBiGbEFqjSHVAWT8efFcaLZtvGKbWEXX1OvWnJBIbgESFvS8Q9sCDDG9zxa D9CN7PVCvRBo2Y+0rRZ45hhKjBvMgQhvjkRjDip3++iBg7eDHDL3eTPpe6P/QFKnlNtLPguiR rcpwGqBQ/hV6uO+4WYY7pHWNTJseOf9w0WuMQCLJb/bZFgZ+E2YWCAZrBsProoXP8tQdgtuTJ emxpGRwbBsd2zzfUjQYcZnaFGbdmxYgZGtD9jJvYgvS7fpJFZoMnw6/EouXgcWz/3lw0kWRjM bLBuRD+IO5Zy95E/ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newly added lib/test_hash.c file builds fine with gcc-5 or newer, but causes some annoying warnings witih gcc-4.9 and older: lib/test_hash.c: In function ‘test_hash_init’: lib/test_hash.c:146:2: error: missing braces around initializer [-Werror=missing-braces] lib/test_hash.c:146:2: error: (near initialization for ‘hash_or[0]’) [-Werror=missing-braces] lib/test_hash.c:224:7: error: "HAVE_ARCH__HASH_32" is not defined [-Werror=undef] lib/test_hash.c:229:7: error: "HAVE_ARCH_HASH_32" is not defined [-Werror=undef] lib/test_hash.c:234:7: error: "HAVE_ARCH_HASH_64" is not defined [-Werror=undef] This adds the braces and extra #ifdef checks for the macros to shut up those warnings. Signed-off-by: Arnd Bergmann --- lib/test_hash.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.7.0 diff --git a/lib/test_hash.c b/lib/test_hash.c index c9549c8b4909..ad136bbf1465 100644 --- a/lib/test_hash.c +++ b/lib/test_hash.c @@ -143,7 +143,7 @@ static int __init test_hash_init(void) { char buf[SIZE+1]; - u32 string_or = 0, hash_or[2][33] = { 0 }; + u32 string_or = 0, hash_or[2][33] = { { 0 } }; unsigned tests = 0; unsigned long long h64 = 0; int i, j; @@ -221,17 +221,17 @@ test_hash_init(void) /* Issue notices about skipped tests. */ #ifndef HAVE_ARCH__HASH_32 pr_info("__hash_32() has no arch implementation to test."); -#elif HAVE_ARCH__HASH_32 != 1 +#elif defined(HAVE_ARCH__HASH_32) && HAVE_ARCH__HASH_32 != 1 pr_info("__hash_32() is arch-specific; not compared to generic."); #endif #ifndef HAVE_ARCH_HASH_32 pr_info("hash_32() has no arch implementation to test."); -#elif HAVE_ARCH_HASH_32 != 1 +#elif defined(HAVE_ARCH_HASH_32) && HAVE_ARCH_HASH_32 != 1 pr_info("hash_32() is arch-specific; not compared to generic."); #endif #ifndef HAVE_ARCH_HASH_64 pr_info("hash_64() has no arch implementation to test."); -#elif HAVE_ARCH_HASH_64 != 1 +#elif defined(HAVE_ARCH_HASH_64) && HAVE_ARCH_HASH_64 != 1 pr_info("hash_64() is arch-specific; not compared to generic."); #endif