From patchwork Mon Jan 13 10:26:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 23157 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f197.google.com (mail-qc0-f197.google.com [209.85.216.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7C9B1202FA for ; Mon, 13 Jan 2014 10:26:20 +0000 (UTC) Received: by mail-qc0-f197.google.com with SMTP id e16sf2187754qcx.8 for ; Mon, 13 Jan 2014 02:26:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=vfN7DlgP6I3vnlRF2k2pinIvZXAUQRDF+GNw5qEvL1I=; b=PUvzMl2jDkrUXjvkB2EsIBGoNGbgzwrOB2PvKgHM/zbO70GnJVjNH/XWbxOLRhr+nl vrudPucblGbYWRK8M6+bf0Yh2K20yrPUQdU1b+/7j6MwhRKjKRzPcn/fyeD+1IZY1WtV kFyrYuDm+7y75EotlQ2leLhxV6SL8pL5IDlNigCqrEj2oMJWp0zDaS/QltQj/S8WLHFE t8y9Qb6rLFLErPSQWkK/wdV2KtohqqFY3beflx7cM5WaK4Pym79IE1fdurF+x9NxjV8s 4GOSCbXhbaVeBg7zaHisCXXKfFRszVOn5PkgTW8U1MJIMS1i8yK1bM262+kvwO/I0MhH fCDQ== X-Gm-Message-State: ALoCoQkmaVPoED/8hcjs1a1JUcFHNrxx/t1YceIn8CgGQsGg0vy75zsHn0dXN1u4WHoEhioUmgQy X-Received: by 10.224.121.148 with SMTP id h20mr2399227qar.7.1389608779498; Mon, 13 Jan 2014 02:26:19 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.104.40 with SMTP id gb8ls2327430qeb.27.gmail; Mon, 13 Jan 2014 02:26:19 -0800 (PST) X-Received: by 10.58.4.138 with SMTP id k10mr17345259vek.8.1389608779425; Mon, 13 Jan 2014 02:26:19 -0800 (PST) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id tj7si10831890vdc.7.2014.01.13.02.26.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 13 Jan 2014 02:26:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.171; Received: by mail-ve0-f171.google.com with SMTP id cz12so2101444veb.30 for ; Mon, 13 Jan 2014 02:26:19 -0800 (PST) X-Received: by 10.52.116.200 with SMTP id jy8mr14453938vdb.15.1389608779330; Mon, 13 Jan 2014 02:26:19 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp117447ved; Mon, 13 Jan 2014 02:26:18 -0800 (PST) X-Received: by 10.180.160.212 with SMTP id xm20mr14228816wib.33.1389608778473; Mon, 13 Jan 2014 02:26:18 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id du3si7226563wib.66.2014.01.13.02.26.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 13 Jan 2014 02:26:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1W2eim-0008Le-NQ; Mon, 13 Jan 2014 10:26:16 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, "Edgar E. Iglesias" Subject: [PATCH] target-arm: Switch ARMCPUInfo arrays to use terminator entries Date: Mon, 13 Jan 2014 10:26:16 +0000 Message-Id: <1389608776-32065-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Switch the ARMCPUInfo arrays in cpu.c and cpu64.c to use a terminator entry rather than looping based on ARRAY_SIZE. The latter causes compile warnings on some versions of gcc if the configure options happen to result in an empty array. Signed-off-by: Peter Maydell --- Edgar, I think this should fix the compile warning you're seeing with your gcc version. target-arm/cpu.c | 9 ++++++--- target-arm/cpu64.c | 15 ++++++--------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 408d207..c77a16c 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -980,6 +980,7 @@ static const ARMCPUInfo arm_cpus[] = { { .name = "any", .initfn = arm_any_initfn }, #endif #endif + { .name = NULL } }; static Property arm_cpu_properties[] = { @@ -1043,11 +1044,13 @@ static const TypeInfo arm_cpu_type_info = { static void arm_cpu_register_types(void) { - int i; + const ARMCPUInfo *info = arm_cpus; type_register_static(&arm_cpu_type_info); - for (i = 0; i < ARRAY_SIZE(arm_cpus); i++) { - cpu_register(&arm_cpus[i]); + + while (info->name) { + cpu_register(info); + info++; } } diff --git a/target-arm/cpu64.c b/target-arm/cpu64.c index 60acd24..a639c2e 100644 --- a/target-arm/cpu64.c +++ b/target-arm/cpu64.c @@ -58,7 +58,7 @@ static const ARMCPUInfo aarch64_cpus[] = { #ifdef CONFIG_USER_ONLY { .name = "any", .initfn = aarch64_any_initfn }, #endif - { .name = NULL } /* TODO: drop when we support more CPUs */ + { .name = NULL } }; static void aarch64_cpu_initfn(Object *obj) @@ -101,11 +101,6 @@ static void aarch64_cpu_register(const ARMCPUInfo *info) .class_init = info->class_init, }; - /* TODO: drop when we support more CPUs - all entries will have name set */ - if (!info->name) { - return; - } - type_info.name = g_strdup_printf("%s-" TYPE_ARM_CPU, info->name); type_register(&type_info); g_free((void *)type_info.name); @@ -124,11 +119,13 @@ static const TypeInfo aarch64_cpu_type_info = { static void aarch64_cpu_register_types(void) { - int i; + const ARMCPUInfo *info = aarch64_cpus; type_register_static(&aarch64_cpu_type_info); - for (i = 0; i < ARRAY_SIZE(aarch64_cpus); i++) { - aarch64_cpu_register(&aarch64_cpus[i]); + + while (info->name) { + aarch64_cpu_register(info); + info++; } }