menu_xxx_NUM_CHOICES should not be part of the enum
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Low
|
Andrew Johnson |
Bug Description
In base-3.15 (and perhaps later versions), the C enumerations generated for a menu dbd contain an additional menu_xxx_
typedef enum {
menuCvtInit
menuCvtInit
menuCvtInit
menuCvtInit
menuCvtInit
} menuCvtInitState;
This is not a good idea IMNSHO: modern C compilers (gcc in particular) issue warnings for switch statements that do not handle all cases of an enum. This is very useful for refactoring or for adding new features, since it shows you all the places where a new case is not yet handled. The additional ..._NUM_CHOICES item defeats this: either you must live with code that issues bogus warnings for the _NUM_CHOICES item or you add a default case everywhere, effectively disabling these warnings.
Here is what I think should be generated instead:
typedef enum {
menuCvtInit
menuCvtInit
menuCvtInit
menuCvtInit
} menuCvtInitState;
#define menuCvtInitStat
Related branches
Changed in epics-base: | |
status: | In Progress → Fix Committed |
Changed in epics-base: | |
status: | Fix Committed → Fix Released |
Agreed, although I choose to make it very slightly harder for someone to hand-edit the generated menu.h file.
Ralph, would you like this fix committed immediately?