[Crosstoolchain-logs] [device-tree-compiler] 117/198: dtc: avoid shadowing dirname()

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:59 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.

commit 6d889343710e0ecb14f87758608708e08df7c8c1
Author: Florian Fainelli <f.fainelli at gmail.com>
Date:   Fri Jan 24 17:19:10 2014 -0800

    dtc: avoid shadowing dirname()
    
    dirname() is declared as a function, and later on try_open() another
    variable dirname is used, which shadows the dirname() function
    declaration and will produce the following warnings/errors with
    -Wshadow turned on:
    
    srcpos.c: In function 'try_open':
    srcpos.c:71:35: error: declaration of 'dirname' shadows a global
    declaration [-Werror=shadow]
    srcpos.c:37:14: error: shadowed declaration is here [-Werror=shadow]
    srcpos.c: In function 'srcfile_add_search_path':
    srcpos.c:183:42: error: declaration of 'dirname' shadows a global
    declaration [-Werror=shadow]
    srcpos.c:37:14: error: shadowed declaration is here [-Werror=shadow]
    cc1: all warnings being treated as errors
    
    Fix this by renaming the function dirname() to get_dirname().
    
    Signed-off-by: Florian Fainelli <f.fainelli at gmail.com>
---
 srcpos.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/srcpos.c b/srcpos.c
index 3999675..4549773 100644
--- a/srcpos.c
+++ b/srcpos.c
@@ -34,7 +34,7 @@ struct search_path {
 static struct search_path *search_path_head, **search_path_tail;
 
 
-static char *dirname(const char *path)
+static char *get_dirname(const char *path)
 {
 	const char *slash = strrchr(path, '/');
 
@@ -150,7 +150,7 @@ void srcfile_push(const char *fname)
 	srcfile = xmalloc(sizeof(*srcfile));
 
 	srcfile->f = srcfile_relative_open(fname, &srcfile->name);
-	srcfile->dir = dirname(srcfile->name);
+	srcfile->dir = get_dirname(srcfile->name);
 	srcfile->prev = current_srcfile;
 
 	srcfile->lineno = 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list