From patchwork Thu Jan 21 03:51:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stewart Smith X-Patchwork-Id: 571027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 26BB714010F for ; Thu, 21 Jan 2016 14:52:00 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 085D41A1894 for ; Thu, 21 Jan 2016 14:52:00 +1100 (AEDT) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Received: from e18.ny.us.ibm.com (e18.ny.us.ibm.com [129.33.205.208]) (using TLSv1 with cipher CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id E783F1A1881 for ; Thu, 21 Jan 2016 14:51:41 +1100 (AEDT) Received: from localhost by e18.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 20 Jan 2016 22:51:39 -0500 Received: from d01dlp01.pok.ibm.com (9.56.250.166) by e18.ny.us.ibm.com (146.89.104.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 20 Jan 2016 22:51:38 -0500 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: stewart@linux.vnet.ibm.com X-IBM-RcptTo: skiboot@lists.ozlabs.org Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by d01dlp01.pok.ibm.com (Postfix) with ESMTP id DFE5038C804F for ; Wed, 20 Jan 2016 22:51:37 -0500 (EST) Received: from d01av01.pok.ibm.com (d01av01.pok.ibm.com [9.56.224.215]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u0L3pb9U21037068 for ; Thu, 21 Jan 2016 03:51:37 GMT Received: from d01av01.pok.ibm.com (localhost [127.0.0.1]) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u0L3pbtu004491 for ; Wed, 20 Jan 2016 22:51:37 -0500 Received: from birb.localdomain (birb.au.ibm.com [9.185.120.228] (may be forged)) by d01av01.pok.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id u0L3pQe6003920; Wed, 20 Jan 2016 22:51:36 -0500 Received: from ka1.ozlabs.ibm.com (localhost.localdomain [127.0.0.1]) by birb.localdomain (Postfix) with ESMTP id 88721229EAAB; Thu, 21 Jan 2016 14:51:24 +1100 (AEDT) From: Stewart Smith To: skiboot@lists.ozlabs.org Date: Thu, 21 Jan 2016 14:51:09 +1100 Message-Id: <1453348281-16085-3-git-send-email-stewart@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1453348281-16085-1-git-send-email-stewart@linux.vnet.ibm.com> References: <1453348281-16085-1-git-send-email-stewart@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16012103-0045-0000-0000-0000031D7C63 Subject: [Skiboot] [PATCH stable 02/14] Enable -Werror for -Wformat X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" commit 56bc1890b229072513788992d1d29b6f173c13de upstream We create our own inttypes.h to get the correct printf formatting for 64bit numbers. Signed-off-by: Stewart Smith --- Makefile.main | 2 +- core/mem_region.c | 8 ++++--- core/test/run-mem_range_is_reserved.c | 2 +- hdata/iohub.c | 21 +++++++++-------- hdata/vpd.c | 3 ++- include/inttypes.h | 44 +++++++++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 include/inttypes.h diff --git a/Makefile.main b/Makefile.main index c0f0955a069c..34591be8b65e 100644 --- a/Makefile.main +++ b/Makefile.main @@ -28,7 +28,7 @@ CWARNS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -Wwrite-strings -Wcast-align \ -Winit-self \ -Wframe-larger-than=1024 \ - -Werror -Wno-error=format + -Werror # Host tools and options HOSTCC=gcc diff --git a/core/mem_region.c b/core/mem_region.c index f8d9a11aabb4..40b486b013c6 100644 --- a/core/mem_region.c +++ b/core/mem_region.c @@ -14,6 +14,7 @@ * limitations under the License. */ +#include #include #include #include @@ -320,11 +321,12 @@ int64_t mem_dump_free(void) region_free+= hdr->num_longs * sizeof(long); } - printf("Region %s free: %llu\n", region->name, region_free); + printf("Region %s free: %"PRIx64"\n", + region->name, region_free); total_free += region_free; } - printf("Total free: %llu\n", total_free); + printf("Total free: %"PRIu64"\n", total_free); return total_free; } @@ -686,7 +688,7 @@ static bool add_region(struct mem_region *region) struct mem_region *r; if (mem_regions_finalised) { - prerror("MEM: add_region(%s@0x%llx) called after finalise!\n", + prerror("MEM: add_region(%s@0x%"PRIx64") called after finalise!\n", region->name, region->start); return false; } diff --git a/core/test/run-mem_range_is_reserved.c b/core/test/run-mem_range_is_reserved.c index b50432615c89..0efe9b921cf4 100644 --- a/core/test/run-mem_range_is_reserved.c +++ b/core/test/run-mem_range_is_reserved.c @@ -178,7 +178,7 @@ static void run_test(struct test *test) fprintf(stderr, "reserved regions:\n"); list_for_each(®ions, r, list) { - fprintf(stderr, "\t: %08x[%08x] %s\n", + fprintf(stderr, "\t: %08"PRIx64"[%08"PRIx64"] %s\n", r->start, r->len, r->name); } exit(EXIT_FAILURE); diff --git a/hdata/iohub.c b/hdata/iohub.c index d189cb774693..44ebded17e57 100644 --- a/hdata/iohub.c +++ b/hdata/iohub.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "hdata.h" @@ -142,15 +143,15 @@ static struct dt_node *io_add_p5ioc2(const struct cechub_io_hub *hub, prlog(PR_DEBUG, " GX#%d BUID_Ext = 0x%x\n", be32_to_cpu(hub->gx_index), be32_to_cpu(hub->buid_ext)); - prlog(PR_DEBUG, " GX BAR 0 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 0 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar0)); - prlog(PR_DEBUG, " GX BAR 1 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 1 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar1)); - prlog(PR_DEBUG, " GX BAR 2 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 2 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar2)); - prlog(PR_DEBUG, " GX BAR 3 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 3 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar3)); - prlog(PR_DEBUG, " GX BAR 4 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 4 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar4)); /* We assume SBAR == GX0 + some hard coded offset */ @@ -194,15 +195,15 @@ static struct dt_node *io_add_p7ioc(const struct cechub_io_hub *hub, prlog(PR_DEBUG, " GX#%d BUID_Ext = 0x%x\n", be32_to_cpu(hub->gx_index), be32_to_cpu(hub->buid_ext)); - prlog(PR_DEBUG, " GX BAR 0 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 0 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar0)); - prlog(PR_DEBUG, " GX BAR 1 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 1 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar1)); - prlog(PR_DEBUG, " GX BAR 2 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 2 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar2)); - prlog(PR_DEBUG, " GX BAR 3 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 3 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar3)); - prlog(PR_DEBUG, " GX BAR 4 = 0x%016llx\n", + prlog(PR_DEBUG, " GX BAR 4 = 0x%016"PRIx64"\n", be64_to_cpu(hub->gx_ctrl_bar4)); /* We only know about memory map 1 */ diff --git a/hdata/vpd.c b/hdata/vpd.c index 585ed9c01313..754e5f6751e7 100644 --- a/hdata/vpd.c +++ b/hdata/vpd.c @@ -21,6 +21,7 @@ #include "hdata.h" #include #include "hdata.h" +#include struct card_info { const char *ccin; /* Customer card identification number */ @@ -502,7 +503,7 @@ static struct dt_node *dt_create_vpd_node(struct dt_node *parent, addr = (uint64_t)be16_to_cpu(entry->rsrc_id); node = dt_new_addr(parent, name, addr); if (!node) { - prerror("VPD: Creating node at %s@%llx failed\n", name, addr); + prerror("VPD: Creating node at %s@%"PRIx64" failed\n", name, addr); return NULL; } diff --git a/include/inttypes.h b/include/inttypes.h new file mode 100644 index 000000000000..8e640cac8e51 --- /dev/null +++ b/include/inttypes.h @@ -0,0 +1,44 @@ +/* Copyright 2015 IBM Corp. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + * implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* This file exists because a bunch of files are built as part of + * unit tests as well as skiboot and inttypes.h is part of libc rather + * than gcc, so to get the magic to work when we don't have libc sitting + * around, we get to rewrite inttypes.h. + */ + +#ifndef __SKIBOOT_INTTYPES_H +#define __SKIBOOT_INTTYPES_H + +#include + +#ifndef __WORDSIZE +/* If we don't have __WORDSIZE it means we're *certainly* building skiboot + * which will *ALWAYS* have a word size of 32bits. + * (unless someone goes and ports skiboot to something that isn't powerpc) + */ +#define __WORDSIZE 32 +#endif + +#if __WORDSIZE == 64 +#define PRIu64 "lu" +#define PRIx64 "lx" +#else +#define PRIu64 "llu" +#define PRIx64 "llx" +#endif + +#endif