On 10/2/19 8:18 AM, Randy Dunlap wrote: > With sparse 0.6.1-rc1 and Linux kernel v5.4-rc1, sparse is complaining about > bit field sizes in 2 header files: include/linux/sched.h and > kernel/sched/sched.h. They both use a calculation + define macro for the > bit field sizes. > > ../kernel/sched/sched.h:809:31: error: bad integer constant expression > ../kernel/sched/sched.h:809:61: error: invalid named zero-width bitfield `value' > ../kernel/sched/sched.h:810:45: error: bad integer constant expression > ../kernel/sched/sched.h:810:77: error: invalid named zero-width bitfield `tasks' > > ../include/linux/sched.h:596:43: error: bad integer constant expression > ../include/linux/sched.h:596:73: error: invalid named zero-width bitfield `value' > ../include/linux/sched.h:597:43: error: bad integer constant expression > ../include/linux/sched.h:597:67: error: invalid named zero-width bitfield `bucket_id' > > I added #include <linux/log2.h> to both of these header files so that > bits_per() would be defined, but that did not help solve the problem. > > Somewhat similar problem here (using macro for case statement): ../drivers/gpu/drm/i915/display/intel_display.c:1202:22: error: Expected constant expression in case statement ../drivers/gpu/drm/i915/display/intel_display.c:1205:22: error: Expected constant expression in case statement ../drivers/gpu/drm/i915/display/intel_display.c:1208:22: error: Expected constant expression in case statement ../drivers/gpu/drm/i915/display/intel_display.c:1211:22: error: Expected constant expression in case statement -- ~Randy