Skip to content

Commit e30454a

Browse files
committed
Compiles OK to WebAssembly with Zig Compiler
1 parent b3d10a3 commit e30454a

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

libtcc.c

+13
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,18 @@
6666

6767
#include "tcc.h"
6868

69+
////TODO
70+
void longjmp(int jmp_buf, int ret) {
71+
puts("TODO: longjmp");
72+
exit(1);
73+
}
74+
75+
///TODO
76+
int setjmp(int jmp_buf) {
77+
puts("TODO: setjmp");
78+
return 0;
79+
}
80+
6981
/********************************************************/
7082
/* global variables */
7183

@@ -156,6 +168,7 @@ ST_FUNC void wait_sem(TCCSem *p)
156168
{
157169
if (!p->init)
158170
sem_init(&p->sem, 0, 1), p->init = 1;
171+
#define EINTR 4 ////TODO
159172
while (sem_wait(&p->sem) < 0 && errno == EINTR);
160173
}
161174
ST_FUNC void post_sem(TCCSem *p)

tcc.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#include <errno.h>
3737
#include <math.h>
3838
#include <fcntl.h>
39-
#include <setjmp.h>
39+
////TODO: #include <setjmp.h>
4040
#include <time.h>
4141

4242
#ifndef _WIN32
@@ -884,7 +884,8 @@ struct TCCState {
884884
void *error_opaque;
885885
void (*error_func)(void *opaque, const char *msg);
886886
int error_set_jmp_enabled;
887-
jmp_buf error_jmp_buf;
887+
////TODO: jmp_buf error_jmp_buf;
888+
int error_jmp_buf; ////TODO
888889
int nb_errors;
889890

890891
/* output file for preprocessing (-E) */

0 commit comments

Comments
 (0)