From: Bernhard Urban Date: Sat, 26 Jan 2013 21:19:52 +0000 (+0100) Subject: scanner: remove linker dependency X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=uebersetzerbau-ss10.git;a=commitdiff_plain;h=b133cf25e9c4bf3266dcd0a5024fb815d29f3cfe scanner: remove linker dependency tests: add callconf stuff (wip) --- diff --git a/.gitignore b/.gitignore index 4194454..d76765b 100644 --- a/.gitignore +++ b/.gitignore @@ -67,5 +67,13 @@ gesamt_arm/scanner.c gesamt_arm/code.c gesamt_arm/wtf.out +#gesamt_arm64 +gesamt_arm64/gesamt_arm64 +gesamt_arm64/parser.c +gesamt_arm64/parser.h +gesamt_arm64/scanner.c +gesamt_arm64/code.c +gesamt_arm64/wtf.out + #weitere eintragen... torero/torero.log diff --git a/gesamt_arm64/Makefile b/gesamt_arm64/Makefile index db261f8..f63c6f5 100644 --- a/gesamt_arm64/Makefile +++ b/gesamt_arm64/Makefile @@ -1,6 +1,6 @@ SHELL := bash -CC := /usr/lib/ccache/gcc -NAME := gesamt_arm +CC := gcc +NAME := gesamt_arm64 CFLAGS := -ansi -pedantic -D_GNU_SOURCE -g OBJS := scanner.o parser.o symtable.o code.o chelper.o tree.o @@ -8,7 +8,7 @@ all: $(NAME) $(NAME): $(OBJS) @echo " LINK $@" - @$(CC) -o $@ $(OBJS) -lfl + @$(CC) -o $@ $(OBJS) scanner.c: oxout.l @echo " FLEX $<" diff --git a/gesamt_arm64/callingconvention.c b/gesamt_arm64/callingconvention.c new file mode 100644 index 0000000..ae1280d --- /dev/null +++ b/gesamt_arm64/callingconvention.c @@ -0,0 +1,11 @@ +/* gcc -c -fomit-frame-pointer -fno-defer-pop callingconvetion.c */ + +extern int call(void); + +long callchecking() +{ + long ret; + /* TODO: check calling conv */ + ret = call(); + return ret; +} diff --git a/gesamt_arm64/callingconvention.o b/gesamt_arm64/callingconvention.o new file mode 100644 index 0000000..8818d8a Binary files /dev/null and b/gesamt_arm64/callingconvention.o differ diff --git a/gesamt_arm64/scanner.lex b/gesamt_arm64/scanner.lex index 92f6df7..7d60d35 100644 --- a/gesamt_arm64/scanner.lex +++ b/gesamt_arm64/scanner.lex @@ -13,17 +13,13 @@ COMMENT_END \*\/ %x COMMENT %option yylineno +%option noyywrap %% {COMMENT_START} BEGIN(COMMENT); {COMMENT_END} BEGIN(INITIAL); -<> { - fprintf(stderr, "Kommentar nicht geschlossen\n"); - exit(1); -} - (.|\n) /* alles im kommentar wird ignoriert */ struct return(STRUCT); diff --git a/gesamt_arm64/testmain.c b/gesamt_arm64/testmain.c new file mode 100644 index 0000000..6756a64 --- /dev/null +++ b/gesamt_arm64/testmain.c @@ -0,0 +1,30 @@ +#include +#include + +extern long callchecking(); + +#define RET return + +int call(void) +{ +#include CALL +} + +long labs(long); + +#ifdef DEFINE_G +long g(long x, long y) +{ + return h(x*2, y*3)+1; +} +#endif + +int main(int argc, char *argv[]) +{ + long r; + r=callchecking(); + if(r==0 || r==1) + return !r; + return r; +} +