armink/EasyFlash

宏展开无法使用枚举变量

AaronKonishi opened this issue · 1 comments

#if (ENV_STATUS_TABLE_SIZE >= DIRTY_STATUS_TABLE_SIZE)

此处的代码会宏展开ENV_STATUS_TABLE_SIZE 和DIRTY_STATUS_TABLE_SIZE,而他们会分别使用枚举变量:ENV_STATUS_NUM和SECTOR_DIRTY_STATUS_NUM。而枚举变量在宏展开时是没法使用的,一般编译器会自动把ENV_STATUS_NUM和SECTOR_DIRTY_STATUS_NUM设置为0,因此#if (ENV_STATUS_TABLE_SIZE >= DIRTY_STATUS_TABLE_SIZE)始终为真,从而导致:
uint8_t status_table[ENV_STATUS_TABLE_SIZE];语句永久有效;
uint8_t status_table[DIRTY_STATUS_TABLE_SIZE];语句无法有效。

你好,方便提交一个 PR 吗?