diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2020-04-11 05:03:49 +0200 |
commit | 1b8a56941708e6fe884f4649f718fae7c543c045 (patch) | |
tree | 3d7be0a7e43b01aba6dd986bff06bcc3947a6d78 /sys/src/cmd/5a | |
parent | 9d46360c9d83fa95f42f1eebbad49ecd9281fb0d (diff) |
cc, ?[acl]: fix gethunk() and move common memory allocator code to cc/compat
for gethunk() to work, all allocators have to use it,
including allocations done by libc thru malloc(),
so the fake allocation functions are mandatory for
everyone.
to avoid duplication the code is moved to cc/compat
and prototypes provided in new cc/compat.h header.
Diffstat (limited to 'sys/src/cmd/5a')
-rw-r--r-- | sys/src/cmd/5a/a.h | 27 | ||||
-rw-r--r-- | sys/src/cmd/5a/mkfile | 3 |
2 files changed, 3 insertions, 27 deletions
diff --git a/sys/src/cmd/5a/a.h b/sys/src/cmd/5a/a.h index 08ea625a9..0e07a1e10 100644 --- a/sys/src/cmd/5a/a.h +++ b/sys/src/cmd/5a/a.h @@ -2,10 +2,7 @@ #include <libc.h> #include <bio.h> #include "../5c/5.out.h" - -#ifndef EXTERN -#define EXTERN extern -#endif +#include "../cc/compat.h" typedef struct Sym Sym; typedef struct Gen Gen; @@ -96,14 +93,12 @@ EXTERN int nDlist; EXTERN Hist* ehist; EXTERN int newflag; EXTERN Hist* hist; -EXTERN char* hunk; EXTERN char* include[NINCLUDE]; EXTERN Io* iofree; EXTERN Io* ionext; EXTERN Io* iostack; EXTERN long lineno; EXTERN int nerrors; -EXTERN long nhunk; EXTERN int ninclude; EXTERN Gen nullgen; EXTERN char* outfile; @@ -115,11 +110,8 @@ EXTERN int sym; EXTERN char symb[NSYMB]; EXTERN int thechar; EXTERN char* thestring; -EXTERN uintptr thunk; EXTERN Biobuf obuf; -void* alloc(long); -void* allocn(void*, long, long); void errorexit(void); void pushio(void); void newio(void); @@ -160,20 +152,3 @@ void yyerror(char*, ...); int yyparse(void); void setinclude(char*); int assemble(char*); - -/* - * system-dependent stuff from ../cc/compat.c - */ - -enum /* keep in synch with ../cc/cc.h */ -{ - Plan9 = 1<<0, - Unix = 1<<1, - Windows = 1<<2, -}; -int mywait(int*); -int mycreat(char*, int); -int systemtype(int); -int pathchar(void); -int myfork(void); -void* mysbrk(ulong); diff --git a/sys/src/cmd/5a/mkfile b/sys/src/cmd/5a/mkfile index 1933aae09..cfd14dde9 100644 --- a/sys/src/cmd/5a/mkfile +++ b/sys/src/cmd/5a/mkfile @@ -7,6 +7,7 @@ OFILES=\ HFILES=\ ../5c/5.out.h\ + ../cc/compat.h\ y.tab.h\ a.h\ @@ -16,4 +17,4 @@ BIN=/$objtype/bin < /sys/src/cmd/mkone YFLAGS=-D1 -d -lex.$O: ../cc/macbody ../cc/lexbody +lex.$O: ../cc/macbody ../cc/lexbody ../cc/compat |