Skip to content

Commit 899875b

Browse files
committed
msvc: fix build: typeof needs to be __typeof__.
1 parent 3f68208 commit 899875b

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

core/defines.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@
3939
# define strcasecmp _stricmp
4040
#endif
4141

42+
#ifdef _MSC_VER
43+
# define CEMU_TYPEOF __typeof__
44+
#else
45+
# define CEMU_TYPEOF typeof
46+
#endif
47+
4248
#ifdef __EMSCRIPTEN__
4349
# include <emscripten.h>
4450
#else

core/usb/physical.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,18 @@
1818

1919
#define NODE_EMPTY(head) \
2020
((head)->next == (head))
21+
2122
#define NODE_ITEM(type, item) \
2223
((type *)((uint8_t *)(item) - \
2324
offsetof(type, node)))
25+
2426
#define NODE_FIRST(type, head) \
2527
(NODE_EMPTY(head) ? NULL : NODE_ITEM(type, (head)->next))
28+
2629
#define NODE_FOREACH(current, head) \
2730
for (node_t *next = (head)->next; \
2831
((current) = next != (head) \
29-
? NODE_ITEM(typeof(*(current)), next) \
32+
? NODE_ITEM(CEMU_TYPEOF(*(current)), next) \
3033
: NULL), next = next->next, (current); )
3134

3235
#define UPDATE_STATUS_CHANGE(pointer, field, value) do { \

0 commit comments

Comments
 (0)