net: can: Fix compiling warning
Subsystems (5)
PATCH 1/1 net: can: Fix compiling warning
There are two warings in net/can, fix them by setting bcm_sock_no_ioctlcmd and raw_sock_no_ioctlcmd as static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
--- net/can/bcm.c | 2 +- net/can/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/can/bcm.c +1 -1
@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
net/can/raw.c +1 -1
@@ -837,7 +837,7 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
Signature · 1 line
2.20.1
Quoted 9 lines · Mao Wenan
There are two warings in net/can, fix them by setting
bcm_sock_no_ioctlcmdandraw_sock_no_ioctlcmdas static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static?net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?Fixes 473d924d7d46 ("can: fix ioctl function removal")Signed-off-by Mao Wenan <[email protected]>
Thanks Mao!
Btw. what kind of compiler/make switches are you using so that I can see these warnings myself the next time?
Best regards,
Oliver
Quoted 32 lines
--- net/can/bcm.c | 2 +- net/can/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)net/can/bcm.c +1
-1@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ net/can/raw.c +1
-1@@ -837,7 +837,7 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
Quoted 9 lines · Oliver Hartkopp
Quoted 8 lines · Mao Wenan
There are two warings in net/can, fix them by setting
bcm_sock_no_ioctlcmdandraw_sock_no_ioctlcmdas static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static?net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?Fixes 473d924d7d46 ("can: fix ioctl function removal")
Quoted 8 lines
Quoted 1 line
Signed-off-by Mao Wenan <[email protected]>Acked-by Oliver Hartkopp <[email protected]>Thanks Mao!
Btw. what kind of compiler/make switches are you using so that I can see these warnings myself the next time?
I use ARCH=mips CROSS_COMPILE=mips-linux-gnu- .
Quoted 36 lines
Best regards,
OliverQuoted 23 lines
--- net/can/bcm.c | 2 +- net/can/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)net/can/bcm.c +1
-0@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd, +static int bcm_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd, unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ net/can/raw.c +0
-0net/can/raw.c static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, · line 843
Quoted 7 lines
net/can/raw.c +1
-0@@ -837,7 +837,7 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd, +static int raw_sock_no_ioctlcmd(struct socket *sock, unsigned int cmd, unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ .
Hello!
Quoted 1 line · Mao Wenan
There are two warings in net/can, fix them by setting
bcm_sock_no_ioctlcmd
Warnings. :-)
Quoted 8 lines
and
raw_sock_no_ioctlcmdas static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static?net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?Fixes 473d924d7d46 ("can: fix ioctl function removal")Signed-off-by Mao Wenan <[email protected]>
[...]
MBR, Sergei
Quoted 7 lines · Sergei Shtylyov
Hello!
Quoted 1 line · Mao Wenan
There are two warings in net/can, fix them by setting
bcm_sock_no_ioctlcmdWarnings. :-)
Thanks, I will send v2.
Quoted 14 lines
Quoted 9 lines
and
raw_sock_no_ioctlcmdas static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static?net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?Fixes 473d924d7d46 ("can: fix ioctl function removal")Signed-off-by Mao Wenan <[email protected]>[...]
MBR, Sergei
PATCH v2 1/1 net: can: Fix compiling warning
There are two warnings in net/can, fix them by setting bcm_sock_no_ioctlcmd and raw_sock_no_ioctlcmd as static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
---
v1->v2: change patch description typo error, 'warings' to 'warnings'.
net/can/bcm.c | 2 +- net/can/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/can/bcm.c +1 -1
@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
net/can/raw.c +1 -1
@@ -837,7 +837,7 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
Signature · 1 line
2.20.1
Quoted 1 line
v1->v2: change patch description typo error, …
Will an other commit subject like “[PATCH v3] net: can: Fix compilation warnings for two functions” be more appropriate here?
Regards,
Markus
PATCH v3 1/1 net: can: Fix compiling warnings for two functions
There are two warnings in net/can, fix them by setting bcm_sock_no_ioctlcmd and raw_sock_no_ioctlcmd as static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
---
v1->v2: change patch description typo error, 'warings' to 'warnings'. v2->v3: change subject of patch.
net/can/bcm.c | 2 +- net/can/raw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/can/bcm.c +1 -1
@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
net/can/raw.c +1 -1
@@ -837,7 +837,7 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */
Signature · 1 line
2.20.1
David Miller
maintainerRe: [PATCH net-next v3] net: can: Fix compiling warnings for two functions
From: Mao Wenan <[email protected]>
Date: Mon, 5 Aug 2019 19:57:44 +0800
net/can/bcm.c static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, · line 1684
Quoted 7 lines
net/can/bcm.c +1
-1@@ -1680,7 +1680,7 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd,unsigned long arg)
The alignment of the second line here needs to be adjusted, it must start precisely at the first column after the openning parenthesis of the first line.
Same for the other change in this patch.
PATCH v4 1/1 net: can: Fix compiling warnings for two functions
There are two warnings in net/can, fix them by setting bcm_sock_no_ioctlcmd and raw_sock_no_ioctlcmd as static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
---
v1->v2: change patch description typo error, 'warings' to 'warnings'. v2->v3: change subject of patch.
v3->v4: change the alignment of two functions.
net/can/bcm.c | 4 ++-- net/can/raw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/can/bcm.c +2 -2
@@ -1680,8 +1680,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, -unsigned long arg) +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ return -ENOIOCTLCMD ;
net/can/raw.c +2 -2
@@ -837,8 +837,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, -unsigned long arg) +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ return -ENOIOCTLCMD ;
Signature · 1 line
2.20.1
Re: [v4] net: can: Fix compiling warnings for two functions
Quoted 1 line
v2->v3: change subject of patch.
Will it be nicer to use the word “compilation” in your patch subject?
Quoted 1 line
v3->v4: change the alignment of two functions.
I would refer to an adjusted indentation.
How do you think about to omit “arrows” in these version identifications?
Regards,
Markus
Quoted 9 lines · Oliver Hartkopp
Quoted 8 lines · Mao Wenan
There are two warings in net/can, fix them by setting
bcm_sock_no_ioctlcmdandraw_sock_no_ioctlcmdas static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static?net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?Fixes 473d924d7d46 ("can: fix ioctl function removal")
Quoted 8 lines
Quoted 1 line
Signed-off-by Mao Wenan <[email protected]>Acked-by Oliver Hartkopp <[email protected]>Thanks Mao!
Btw. what kind of compiler/make switches are you using so that I can see these warnings myself the next time?
These are Sparse warnings, not from GCC.
regards,
dan carpenter
PATCH v5 1/1 net: can: Fix sparse warnings for two functions
In reply to Markus ElfringThere are two warnings in net/can, fix them by setting bcm_sock_no_ioctlcmd and raw_sock_no_ioctlcmd as static.
net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? net/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
---
v2: change patch description typo error, 'warings' to 'warnings'.
v3: change subject of patch.
v4: change the alignment of two functions.
v5: change subject of patch.
net/can/bcm.c | 4 ++-- net/can/raw.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/can/bcm.c +2 -2
@@ -1680,8 +1680,8 @@ static int bcm_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, -unsigned long arg) +static int bcm_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ return -ENOIOCTLCMD ;
net/can/raw.c +2 -2
@@ -837,8 +837,8 @@ static int raw_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,return size; } -int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, -unsigned long arg) +static int raw_sock_no_ioctlcmd (struct socket *sock,unsigned int cmd, +unsigned long arg) {/* no ioctls for socket layer -> hand it down to NIC layer */ return -ENOIOCTLCMD ;
Signature · 1 line
2.20.1
Oliver Hartkopp
maintainerHello Dan,
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Oliver Hartkopp
Btw. what kind of compiler/make switches are you using so that I can see these warnings myself the next time?
These are Sparse warnings, not from GCC.
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
user@box:~/net-next$ make C=1 CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool CHK include/generated/compile.h CHECK net/can/af_can.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/af_can.o CHECK net/can/proc.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/proc.o LD [M] net/can/can.o CHECK net/can/raw.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/raw.o LD [M] net/can/can-raw.o CHECK net/can/bcm.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/bcm.o LD [M] net/can/can-bcm.o CHECK net/can/gw.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/gw.o LD [M] net/can/can-gw.o Kernel: arch/x86/boot/bzImage is ready (#2)
I've seen that warning at different other code - but not in bcm.c & raw.c
I downloaded & compiled the latest sparse source. But still no "static" warning. Any idea?
Best regards,
Oliver
Quoted 16 lines · Oliver Hartkopp
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
user@box:~/net-next$ make C=1 CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool CHK include/generated/compile.h CHECK net/can/af_can.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/af_can.o
The sched.h errors suppress Sparse warnings so it's broken/useless now. The code looks like this:
include/linux/sched.h
613 struct uclamp_se {
614 unsigned int value : bits_per(SCHED_CAPACITY_SCALE); 615 unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); 616 unsigned int active : 1; 617 unsigned int user_defined : 1;
618 };
bits_per() is zero and Sparse doesn't like zero sized bitfields.
regards,
dan carpenter
Quoted 11 lines · Oliver Hartkopp
Hello Dan,
Quoted 6 lines · Dan Carpenter
Quoted 2 lines · Oliver Hartkopp
Btw. what kind of compiler/make switches are you using so that I can see these warnings myself the next time?
These are Sparse warnings, not from GCC.
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
Hello Oliver,
here are my steps for net/can/bcm.c,
make allmodconfig ARCH=mips CROSS_COMPILE=mips-linux-gnu- make C=2 net/can/bcm.o ARCH=mips CROSS_COMPILE=mips-linux-gnu-
CHECK scripts/mod/empty.c
CALL scripts/checksyscalls.sh
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
CALL scripts/atomic/check-atomics.sh
CHECK net/can/bcm.c./include/linux/slab.h:672:13: error: undefined identifier '__builtin_mul_overflow' ./include/linux/slab.h:672:13: error: not a function <noident> ./include/linux/slab.h:672:13: error: not a function <noident> net/can/bcm.c:1683:5: warning: symbol 'bcm_sock_no_ioctlcmd' was not declared. Should it be static? ./include/linux/slab.h:672:13: warning: call with no type!
CC [M] net/can/bcm.o
for net/can/raw.c,
make allmodconfig ARCH=mips CROSS_COMPILE=mips-linux-gnu- make C=2 net/can/raw.o ARCH=mips CROSS_COMPILE=mips-linux-gnu-
CHECK scripts/mod/empty.c
CALL scripts/checksyscalls.sh
<stdin>:1511:2: warning: #warning syscall clone3 not implemented [-Wcpp]
CALL scripts/atomic/check-atomics.sh
CHECK net/can/raw.cnet/can/raw.c:840:5: warning: symbol 'raw_sock_no_ioctlcmd' was not declared. Should it be static?
CC [M] net/can/raw.o
Oliver Hartkopp
maintainerQuoted 7 lines · maowenan
Quoted 1 line · Oliver Hartkopp
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
here are my steps for
net/can/bcm.c,
make allmodconfig ARCH=mips CROSS_COMPILE=mips-linux-gnu- make C=2net/can/bcm.oARCH=mips CROSS_COMPILE=mips-linux-gnu-
There were some sparse _errors_ in my setup that hide that "static" warning. I will use sparse by default now.
Many thanks,
Oliver
Quoted 22 lines · Dan Carpenter
Quoted 16 lines · Oliver Hartkopp
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
user@box:~/net-next$ make C=1 CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool CHK include/generated/compile.h CHECK net/can/af_can.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/af_can.oThe
sched.herrors suppress Sparse warnings so it's broken/useless now. The code looks like this:
include/linux/sched.h
Quoted 8 lines
613 struct uclamp_se { 614 unsigned int value : bits_per(SCHED_CAPACITY_SCALE); 615 unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); 616 unsigned int active : 1; 617 unsigned int user_defined : 1; 618 };
bits_per()is zero and Sparse doesn't like zero sized bitfields.
I just noticed these sparse warnings too -- what's happening here? Are they _supposed_ to be 0-width fields? It doesn't look like it to me:
CONFIG_UCLAMP_BUCKETS_COUNT=5
...
#define UCLAMP_BUCKETS CONFIG_UCLAMP_BUCKETS_COUNT
...
unsigned int bucket_id : bits_per(UCLAMP_BUCKETS);
I would expect this to be 3 bits wide. ... Looks like gcc agrees:
struct uclamp_se {
unsigned int value:11; /* 0: 0 4 */
unsigned int bucket_id:3; /* 0:11 4 */...
So this is a sparse issue?
Signature · 1 line
Kees Cook
Quoted 30 lines · Kees Cook
Quoted 29 lines · Dan Carpenter
Quoted 16 lines · Oliver Hartkopp
I compiled the code (the original version), but I do not get that "Should it be static?" warning:
user@box:~/net-next$ make C=1 CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh DESCEND objtool CHK include/generated/compile.h CHECK net/can/af_can.c ./include/linux/sched.h:609:43: error: bad integer constant expression ./include/linux/sched.h:609:73: error: invalid named zero-width bitfield `value' ./include/linux/sched.h:610:43: error: bad integer constant expression ./include/linux/sched.h:610:67: error: invalid named zero-width bitfield `bucket_id' CC [M] net/can/af_can.oThe
sched.herrors suppress Sparse warnings so it's broken/useless now. The code looks like this:
include/linux/sched.h613 struct uclamp_se { 614 unsigned int value : bits_per(SCHED_CAPACITY_SCALE); 615 unsigned int bucket_id : bits_per(UCLAMP_BUCKETS); 616 unsigned int active : 1; 617 unsigned int user_defined : 1; 618 };
Quoted 4 lines
Quoted 1 line
bits_per()is zero and Sparse doesn't like zero sized bitfields.I just noticed these sparse warnings too -- what's happening here? Are they _supposed_ to be 0-width fields? It doesn't look like it to me:
I'm sorr, I don't even know what code I was looking at before. I think my cscope database was stale? You're right. Sparse doesn't think it's zero, it knows that it is 11 and 3.
What's happening is that it's failing the test in in bad_integer_constant_expression():
if (!(expr->flags & CEF_ICE))
The ICE in CEF_ICE stands for Integer Constant Expression. The rule here is that enums are not constant expressions in c99. See the explanation in commit 274c154704db ("constexpr: introduce additional expression constness tracking flags").
I don't think the CEF_ICE is set properly in evaluate_conditional_expression(). If conditional is constant and it's true and the ->cond_true expression is constant then the result should be constant as well. It shouldn't matter if the cond_false is constant. But instead it is ANDing all three sub expressions:
expr->flags = (expr->conditional->flags & (*true)->flags & expr->cond_false->flags & ~CEF_CONST_MASK);
Or actually in this case it's doing:
if (expr->conditional->flags & (CEF_ACE | CEF_ADDR)) expr->flags = (*true)->flags & expr->cond_false->flags & ~CEF_CONST_MASK;
But it's the same problem because it's should ignore cond_false.
regards,
dan carpenter