Skip to content

Commit 5302133

Browse files
committed
fix clang warnings
amd64-ucontext.h:3:25: warning: redefinition of typedef 'mcontext_t' is a C11 feature amd64-ucontext.h:4:25: warning: redefinition of typedef 'ucontext_t' is a C11 feature context.c:86:3: warning: indirection of non-volatile null pointer will be deleted, not trap
1 parent 3ae1151 commit 5302133

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

context.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ makecontext(ucontext_t *ucp, void (*func)(void), int argc, ...)
8383

8484
memset(&ucp->uc_mcontext, 0, sizeof ucp->uc_mcontext);
8585
if(argc != 2)
86-
*(int*)0 = 0;
86+
*(volatile int*)0 = 0;
8787
va_start(va, argc);
8888
ucp->uc_mcontext.mc_rdi = va_arg(va, int);
8989
ucp->uc_mcontext.mc_rsi = va_arg(va, int);

taskimpl.h

+5-7
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,17 @@ extern void makecontext(ucontext_t*, void(*)(), int, ...);
105105
#endif
106106

107107
#if defined(__linux__) && defined(__amd64__)
108-
typedef struct mcontext mcontext_t;
109-
typedef struct ucontext ucontext_t;
108+
# if defined(__i386__)
109+
# include "386-ucontext.h"
110+
# elif defined(__x86_64__)
111+
# include "amd64-ucontext.h"
112+
# endif
110113
extern int getmcontext(mcontext_t*);
111114
extern void setmcontext(const mcontext_t*);
112115
#define setcontext(u) setmcontext(&(u)->uc_mcontext)
113116
#define getcontext(u) getmcontext(&(u)->uc_mcontext)
114117
extern int swapcontext(ucontext_t*, const ucontext_t*);
115118
extern void makecontext(ucontext_t*, void(*)(), int, ...);
116-
# if defined(__i386__)
117-
# include "386-ucontext.h"
118-
# elif defined(__x86_64__)
119-
# include "amd64-ucontext.h"
120-
# endif
121119
#endif
122120

123121
#if defined(__APPLE__)

0 commit comments

Comments
 (0)