include/linux/bug.h:37:45: error: bit-field '<anonymous>' width not an integer constant

From: kbuild test robot
Date: Sun Dec 04 2016 - 00:30:44 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 0cb65c83304a341b9d09678448d7c8b550689531
commit: 80cca775cdc4f8555612d2943a2872076b33e0ff net: fec: cache statistics while device is down
date: 4 days ago
config: m68k-m5272c3_defconfig (attached as .config)
compiler: m68k-linux-gcc (GCC) 4.9.0
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 80cca775cdc4f8555612d2943a2872076b33e0ff
# save the attached .config to linux build tree
make.cross ARCH=m68k

All errors (new ones prefixed by >>):

drivers/net/ethernet/freescale/fec_main.c: In function 'fec_restart':
drivers/net/ethernet/freescale/fec_main.c:896:6: warning: unused variable 'val' [-Wunused-variable]
u32 val;
^
drivers/net/ethernet/freescale/fec_main.c: In function 'fec_get_mac':
drivers/net/ethernet/freescale/fec_main.c:1628:28: warning: unused variable 'pdata' [-Wunused-variable]
struct fec_platform_data *pdata = dev_get_platdata(&fep->pdev->dev);
^
drivers/net/ethernet/freescale/fec_main.c: In function 'fec_enet_close':
drivers/net/ethernet/freescale/fec_main.c:2887:2: error: implicit declaration of function 'fec_enet_update_ethtool_stats' [-Werror=implicit-function-declaration]
fec_enet_update_ethtool_stats(ndev);
^
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/net/ethernet/freescale/fec_main.c:24:
drivers/net/ethernet/freescale/fec_main.c: In function 'fec_probe':
drivers/net/ethernet/freescale/fec_main.c:3296:18: error: 'fec_stats' undeclared (first use in this function)
ARRAY_SIZE(fec_stats) * sizeof(u64),
^
include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
drivers/net/ethernet/freescale/fec_main.c:3296:18: note: each undeclared identifier is reported only once for each function it appears in
ARRAY_SIZE(fec_stats) * sizeof(u64),
^
include/linux/kernel.h:53:33: note: in definition of macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
In file included from include/linux/thread_info.h:11:0,
from include/asm-generic/preempt.h:4,
from ./arch/m68k/include/generated/asm/preempt.h:1,
from include/linux/preempt.h:59,
from include/linux/spinlock.h:50,
from include/linux/seqlock.h:35,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/net/ethernet/freescale/fec_main.c:24:
>> include/linux/bug.h:37:45: error: bit-field '<anonymous>' width not an integer constant
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
^
include/linux/compiler-gcc.h:64:28: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
^
include/linux/kernel.h:53:59: note: in expansion of macro '__must_be_array'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^
drivers/net/ethernet/freescale/fec_main.c:3296:7: note: in expansion of macro 'ARRAY_SIZE'
ARRAY_SIZE(fec_stats) * sizeof(u64),
^
cc1: some warnings being treated as errors

vim +37 include/linux/bug.h

9a8ab1c39 Daniel Santos 2013-02-21 21 #define BUILD_BUG_ON_MSG(cond, msg) (0)
ca623c914 Daniel Santos 2013-02-21 22 #define BUILD_BUG_ON(condition) (0)
35edd9103 Paul Gortmaker 2011-11-16 23 #define BUILD_BUG() (0)
ff20c2e0a Kirill A. Shutemov 2016-03-01 24 #define MAYBE_BUILD_BUG_ON(cond) (0)
35edd9103 Paul Gortmaker 2011-11-16 25 #else /* __CHECKER__ */
35edd9103 Paul Gortmaker 2011-11-16 26
35edd9103 Paul Gortmaker 2011-11-16 27 /* Force a compilation error if a constant expression is not a power of 2 */
3e9b3112e Jakub Kicinski 2016-08-31 28 #define __BUILD_BUG_ON_NOT_POWER_OF_2(n) \
3e9b3112e Jakub Kicinski 2016-08-31 29 BUILD_BUG_ON(((n) & ((n) - 1)) != 0)
35edd9103 Paul Gortmaker 2011-11-16 30 #define BUILD_BUG_ON_NOT_POWER_OF_2(n) \
35edd9103 Paul Gortmaker 2011-11-16 31 BUILD_BUG_ON((n) == 0 || (((n) & ((n) - 1)) != 0))
35edd9103 Paul Gortmaker 2011-11-16 32
35edd9103 Paul Gortmaker 2011-11-16 33 /* Force a compilation error if condition is true, but also produce a
35edd9103 Paul Gortmaker 2011-11-16 34 result (of value 0 and type size_t), so the expression can be used
35edd9103 Paul Gortmaker 2011-11-16 35 e.g. in a structure initializer (or where-ever else comma expressions
35edd9103 Paul Gortmaker 2011-11-16 36 aren't permitted). */
35edd9103 Paul Gortmaker 2011-11-16 @37 #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
35edd9103 Paul Gortmaker 2011-11-16 38 #define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
35edd9103 Paul Gortmaker 2011-11-16 39
baf05aa92 Konstantin Khlebnikov 2012-05-29 40 /*
baf05aa92 Konstantin Khlebnikov 2012-05-29 41 * BUILD_BUG_ON_INVALID() permits the compiler to check the validity of the
baf05aa92 Konstantin Khlebnikov 2012-05-29 42 * expression but avoids the generation of any code, even if that expression
baf05aa92 Konstantin Khlebnikov 2012-05-29 43 * has side-effects.
baf05aa92 Konstantin Khlebnikov 2012-05-29 44 */
baf05aa92 Konstantin Khlebnikov 2012-05-29 45 #define BUILD_BUG_ON_INVALID(e) ((void)(sizeof((__force long)(e))))

:::::: The code at line 37 was first introduced by commit
:::::: 35edd9103c84f2b37f63227d12765c38f30495c5 bug: consolidate BUILD_BUG_ON with other bug code

:::::: TO: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>
:::::: CC: Paul Gortmaker <paul.gortmaker@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip