* fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant
@ 2010-01-18 7:31 Grant Grundler
2010-01-18 15:09 ` Kyle McMartin
0 siblings, 1 reply; 2+ messages in thread
From: Grant Grundler @ 2010-01-18 7:31 UTC (permalink / raw)
To: linux-parisc
Is this a known problem?
I'm getting this error on linus' kernel tree build:
fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant
The offending code is:
1646 static int compat_ioctl_check_table(unsigned int xcmd)
1647 {
1648 int i;
1649 const int max = ARRAY_SIZE(ioctl_pointer) - 1;
1650
1651 BUILD_BUG_ON(max >= (1 << 16));
This "looks" right to me. Everything is a constant other than "max".
Since max is declared "const", I *expect* max to behave like a constant.
I used "make V=1" to get the command than used that to preprocess the code:
hppa64-linux-gnu-gcc -Wp,-MD,fs/.compat_ioctl.o.d -nostdinc -isystem /home/dave/opt/gnu64/gcc-4.5.0/lib/gcc/hppa64-linux-gnu/4.5.0/include -I/usr/src/linux-2.6/arch/parisc/include -Iinclude -include include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -Os -pipe -mno-space-regs -mfast-indirect-calls -mdisable-fpregs -ffunction-sections -march=2.0 -mschedule=8000 -Wframe-larger-than=2048 -fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(compat_ioctl)" -D"KBUILD_MODNAME=KBUILD_STR(c
ompat_ioctl)" -E -o fs/.tmp_compat_ioctl.P fs/compat_ioctl.c
and I believe the same code in fs/.tmp_compat_ioctl.P is:
static int compat_ioctl_check_table(unsigned int xcmd)
{
int i;
const int max = (sizeof(ioctl_pointer) / sizeof((ioctl_pointer)[0]) + (sizeof(struct { int:-!!(__builtin_types_compatible_p(typeof(ioctl_pointer), typeof(&ioctl_pointer[0]))); }))) - 1;
((void)(sizeof(struct { int:-!!(max >= (1 << 16)); })));
I can't make sense of this since I have no clue what "int:-!!" means.
BTW, I also looked in include/linux/kernel.h:
/* Force a compilation error if condition is true */
#define BUILD_BUG_ON(condition) ((void)BUILD_BUG_ON_ZERO(condition))
...
/* Force a compilation error if condition is true, but also produce a
result (of value 0 and type size_t), so the expression can be used
e.g. in a structure initializer (or where-ever else comma expressions
aren't permitted). */
#define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); }))
#define BUILD_BUG_ON_NULL(e) ((void *)sizeof(struct { int:-!!(e); }))
Source this comes from is gsyprf11:/usr/src/linux-2.6 and I just did
a git pull. Please let me know if I just got unlucky and should pull again.
hth,
grant
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant
2010-01-18 7:31 fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant Grant Grundler
@ 2010-01-18 15:09 ` Kyle McMartin
0 siblings, 0 replies; 2+ messages in thread
From: Kyle McMartin @ 2010-01-18 15:09 UTC (permalink / raw)
To: Grant Grundler; +Cc: linux-parisc
On Mon, Jan 18, 2010 at 12:31:48AM -0700, Grant Grundler wrote:
> fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant
><...>
> ((void)(sizeof(struct { int:-!!(max >= (1 << 16)); })));
><...>
> I can't make sense of this since I have no clue what "int:-!!" means.
>
It basically means what the error above says. :) If the expr evaluates
to non-zero, bound it to 1 (ie: !!x = 1, where x > 0) and the negative
sign is to give an invalid field width, so we ftbfs.
Anyway, it's basically checking to see how many elements there are in
the table, and failing if there are more than expected. It looks kind of
failure that these are magic numbers.
regards, Kyle
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-01-18 15:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-18 7:31 fs/compat_ioctl.c:1651:2: error: bit-field '<anonymous>' width not an integer constant Grant Grundler
2010-01-18 15:09 ` Kyle McMartin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.