diff --git a/self.sh b/self.sh index a4608e2dc8aeb7027d324dcc2b36ae6116bda6ba..ac833cfc4b92bd1db9ff938c2dfcc8aa2766fc95 100755 --- a/self.sh +++ b/self.sh @@ -19,6 +19,15 @@ long fread(void *ptr, long size, long nmemb, FILE *stream); int feof(FILE *stream); static void assert() {} int strcmp(char *s1, char *s2); +int printf(char *fmt, ...); +int sprintf(char *buf, char *fmt, ...); +long strlen(char *p); +int strncmp(char *p, char *q); +void *memcpy(char *dst, char *src, long n); +char *strndup(char *p, long n); +int isspace(int c); +char *strstr(char *haystack, char *needle); +long strtol(char *nptr, char **endptr, int base); EOF grep -v '^#' chibi.h >> $TMP/$1 @@ -28,6 +37,7 @@ EOF sed -i 's/\btrue\b/1/g; s/\bfalse\b/0/g;' $TMP/$1 sed -i 's/\bNULL\b/0/g' $TMP/$1 sed -i 's/, \.\.\.//g' $TMP/$1 + sed -i 's/INT_MAX/2147483647/g' $TMP/$1 ./chibicc $TMP/$1 > $TMP/${1%.c}.s gcc -c -o $TMP/${1%.c}.o $TMP/${1%.c}.s @@ -40,5 +50,7 @@ done expand main.c expand type.c +expand parse.c +expand codegen.c gcc -static -o chibicc-gen2 $TMP/*.o