Skip to content

Commit

Permalink
gb.h: Silence -Wembedded-directive warnings with -pedantic
Browse files Browse the repository at this point in the history
gb.h:400:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
\#ifdef GB_BIG_ENDIAN
 ^
gb.h:410:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive]
\#endif
 ^
  • Loading branch information
orbea committed Jan 14, 2022
1 parent d92148b commit 5cf71b4
Showing 1 changed file with 7 additions and 22 deletions.
29 changes: 7 additions & 22 deletions Core/gb.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
#error Unable to detect endianess
#endif

#ifdef GB_BIG_ENDIAN
#define GB_REGISTER_ORDER a,f,b,c,d,e,h,l;
#else
#define GB_REGISTER_ORDER f,a,c,b,e,d,l,h;
#endif

typedef struct {
struct GB_color_s {
Expand Down Expand Up @@ -335,17 +340,7 @@ typedef union {
pc;
};
struct {
#ifdef GB_BIG_ENDIAN
uint8_t a, f,
b, c,
d, e,
h, l;
#else
uint8_t f, a,
c, b,
e, d,
l, h;
#endif
uint8_t GB_REGISTER_ORDER
};
} GB_registers_t;

Expand Down Expand Up @@ -383,17 +378,7 @@ struct GB_gameboy_internal_s {
pc;
};
struct {
#ifdef GB_BIG_ENDIAN
uint8_t a, f,
b, c,
d, e,
h, l;
#else
uint8_t f, a,
c, b,
e, d,
l, h;
#endif
uint8_t GB_REGISTER_ORDER
};
};
uint8_t ime;
Expand Down

0 comments on commit 5cf71b4

Please sign in to comment.