I'm wondering if there's a simple / sane way to get gcc to stop throwing this error when the opposing target of the comparison is a macro. Yes, I recognize that with this particular definition of the macro, the comparison is always true, but it obviously doesn't extend to the general case:
#define ROMBOT 0x00000000
#define ROMTOP 0x00002000
...
if (addr >= ROMBOT && addr < ROMTOP) {
simulator.c:517:2: error: comparison of unsigned expression >= 0 is always true
One solution would be something to the effect of:
#if ROMBOT == 0
if (addr < ROMTOP) {
#else
if (addr >= ROMBOT && addr < ROMTOP) {
#endif
But that seems really ungainly / high-maintenance.
Or the related:
#define CHECK_ROM_BOT(_addr) (... etc)
But that quickly escalates into a lot of ugly / unnecessary macros.
Anyone have any ideas?