[coreboot-gerrit] New patch to review for coreboot: ifwitool: Fix gcc error due to shadowed global declaration

Werner Zeh (werner.zeh@siemens.com) gerrit at coreboot.org
Fri Jun 24 13:11:12 CEST 2016


Werner Zeh (werner.zeh at siemens.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/15343

-gerrit

commit 77130fcc0b311a817e8a7e0be3cd432a12776199
Author: Werner Zeh <werner.zeh at siemens.com>
Date:   Fri Jun 24 13:03:38 2016 +0200

    ifwitool: Fix gcc error due to shadowed global declaration
    
    The name 'bpdt_size' is used for a function as well as ia local variable.
    As ifwitool is compiled using HOSTCC, there can be an older gcc version
    used for the compilation. With gcc version 4.4.7 I get the following
    error: declaration of 'bpdt_size' shadows a global declaration
    To fix it, rename the function to get_bpdt_size so that names are
    unique now.
    
    Change-Id: I47791c705ac4ab28307c52b86940a7a14a5cfef8
    Signed-off-by: Werner Zeh <werner.zeh at siemens.com>
---
 util/cbfstool/ifwitool.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/util/cbfstool/ifwitool.c b/util/cbfstool/ifwitool.c
index 30b6f75..f6ca2a8 100644
--- a/util/cbfstool/ifwitool.c
+++ b/util/cbfstool/ifwitool.c
@@ -80,7 +80,7 @@ struct bpdt {
 	struct bpdt_entry e[0];
 } __attribute__((packed));
 
-static inline size_t bpdt_size(struct bpdt_header *h)
+static inline size_t get_bpdt_size(struct bpdt_header *h)
 {
 	return (sizeof(*h) + BPDT_ENTRY_SIZE * h->descriptor_count);
 }
@@ -714,7 +714,7 @@ static size_t alloc_bpdt_buffer(void *data, size_t size, size_t offset,
 	bpdt_read_header((uint8_t *)data + offset, &bpdt_header, name);
 
 	/* Buffer to read BPDT header and entries. */
-	alloc_buffer(b, bpdt_size(&bpdt_header), name);
+	alloc_buffer(b, get_bpdt_size(&bpdt_header), name);
 
 	struct bpdt *bpdt = buffer_get(b);
 	memcpy(&bpdt->h, &bpdt_header, BPDT_HEADER_SIZE);
@@ -727,7 +727,7 @@ static size_t alloc_bpdt_buffer(void *data, size_t size, size_t offset,
 		return (offset + BPDT_HEADER_SIZE);
 
 	/* Read all entries. */
-	assert((offset + bpdt_size(&bpdt->h)) < size);
+	assert((offset + get_bpdt_size(&bpdt->h)) < size);
 	bpdt_read_entries((uint8_t *)data + offset + BPDT_HEADER_SIZE, bpdt,
 			  name);
 



More information about the coreboot-gerrit mailing list