Re: [PATCH 2/2] kbuild: redefine __FILE__ as relative path from $(srctree) if possible

From: kbuild test robot
Date: Sat Oct 14 2017 - 16:16:07 EST


Hi Masahiro,

[auto build test WARNING on mmarek/for-next]
[also build test WARNING on next-20171013]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Masahiro-Yamada/kbuild-use-relative-path-from-srctree-instead-of-__FILE__/20171015-012234
base: git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild for-next
config: sparc64-allmodconfig (attached as .config)
compiler: sparc64-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sparc64

All warnings (new ones prefixed by >>):

lib/dynamic_debug.c: In function 'trim_prefix':
>> lib/dynamic_debug.c:71:13: warning: overflow in implicit constant conversion [-Woverflow]
int skip = strlen(__FILE__) - strlen("lib/dynamic_debug.c");
^~~~~~

vim +71 lib/dynamic_debug.c

e9d376f0 Jason Baron 2009-02-05 67
2b678319 Jim Cromie 2011-12-19 68 /* Return the path relative to source root */
2b678319 Jim Cromie 2011-12-19 69 static inline const char *trim_prefix(const char *path)
2b678319 Jim Cromie 2011-12-19 70 {
2b678319 Jim Cromie 2011-12-19 @71 int skip = strlen(__FILE__) - strlen("lib/dynamic_debug.c");
2b678319 Jim Cromie 2011-12-19 72
2b678319 Jim Cromie 2011-12-19 73 if (strncmp(path, __FILE__, skip))
2b678319 Jim Cromie 2011-12-19 74 skip = 0; /* prefix mismatch, don't skip */
2b678319 Jim Cromie 2011-12-19 75
2b678319 Jim Cromie 2011-12-19 76 return path + skip;
2b678319 Jim Cromie 2011-12-19 77 }
2b678319 Jim Cromie 2011-12-19 78

:::::: The code at line 71 was first introduced by commit
:::::: 2b6783191da7211c88f98eb1a2bd2027bff36e30 dynamic_debug: add trim_prefix() to provide source-root relative paths

:::::: TO: Jim Cromie <jim.cromie@xxxxxxxxx>
:::::: CC: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip