It's been a while since I've posted here, so if I'm in the wrong place, I'll repost this in the correct part of the forum.

I'm getting a specific error that appears related to my definition of this enum. It doesn't look like anything is wrong in this enum definition, and I've tried different permutations of typedefs and permutations, but it still throws that warning, which proceeds to cause errors later when the code tries to call cpu->interrupt.
I got this specific code from this GitHub repo and I'm messing around with porting it to the CE. The repo makes it appear that the agnes code has been tested on other platforms/compilers, so I don't immediately think something is wrong with the code. I'm using the latest release of the CE toolchain, so I don't think the error comes from there. I can share more of the code if more context is necessary.


Code:
[path]/src/agnes/agnes_types.h:32:5: warning: declaration does not declare anything [-Wmissing-declarations]
    cpu_interrupt_t interrupt;


Code:
typedef enum {
    INTERRUPT_NONE = 1,
    INTERRUPT_NMI,
    INTERRUPT_IRQ
} cpu_interrupt_t;

typedef struct cpu {
    struct agnes *agnes;
    uint16_t pc;
    uint8_t sp;
    uint8_t acc;
    uint8_t x;
    uint8_t y;
    uint8_t flag_carry;
    uint8_t flag_zero;
    uint8_t flag_dis_interrupt;
    uint8_t flag_decimal;
    uint8_t flag_overflow;
    uint8_t flag_negative;
    uint32_t stall;
    uint64_t cycles;
    cpu_interrupt_t interrupt; // this line here
} cpu_t;
On the CE, interrupt is a reserved keyword for silly historical reasons so just pick a different name for that field.
Edit: Alternatively you can #undef interrupt once per compilation unit to be able to use it normally after that point.
That fixed it, thanks! Time to fix other unrelated compilation errors
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement