From fd89b1a054493062de5bfe9881130c0e3874cfb5 Mon Sep 17 00:00:00 2001 From: "Samuel D. Crow" Date: Thu, 25 Mar 2021 14:38:17 -0500 Subject: [PATCH] fixes scope bug in test code, typo in runtime and makefiles --- Makefile | 2 ++ runtime/Makefile | 8 +++++--- runtime/runtime.h | 3 ++- tester.cpp | 18 +++++++++++++----- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 5a51f8c..03f5f1b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,8 @@ CC := g++ CFLAGS := -Wall CFLAGS += -std=c++11 +CFLAGS += -fno-rtti +CFLAGS += -fno-exceptions CFLAGS += -Os LFLAGS := diff --git a/runtime/Makefile b/runtime/Makefile index b254864..ea86fb2 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,6 +1,8 @@ CC := g++ CFLAGS := -Wall CFLAGS += -std=c++11 +CFLAGS += -fno-rtti +CFLAGS += -fno-exceptions CFLAGS += -Os LFLAGS := @@ -18,11 +20,11 @@ bin_main: $(MAIN_OBJ_DEPS) $(CC) -o main $(MAIN_OBJ_DEPS) main.o: $(OUTPUT_DEPS) - $(CC) -o main.o -c main.cpp + $(CC) $(CFLAGS) -o main.o -c main.cpp output.o: $(OUTPUT_DEPS) - $(CC) -I$(SRC) -o output.o -c $(SRC)output.cpp + $(CC) $(CFLAGS) -I$(SRC) -o output.o -c $(SRC)output.cpp .PHONY: clean clean: - rm -rf *.o main \ No newline at end of file + rm -rf *.o main diff --git a/runtime/runtime.h b/runtime/runtime.h index 2651161..3a1435a 100644 --- a/runtime/runtime.h +++ b/runtime/runtime.h @@ -4,8 +4,9 @@ ** by Samuel D. Crow */ #ifndef YAB_RUNTIME -#define YAB_RUTTIME +#define YAB_RUNTIME +#include #include using namespace std; diff --git a/tester.cpp b/tester.cpp index 9dd57c8..27aa1d5 100644 --- a/tester.cpp +++ b/tester.cpp @@ -151,7 +151,7 @@ int main(int argc, char *argv[]) helpText(argv[0]); break; } - cout << "vamanos!" <name; +shared_ptrv; +shared_ptrprint; void testInt() { - string name="v"; - shared_ptrv= - variableType::getOrCreateVar(name, T_INTVAR); + name=shared_ptr(new string("v")); + v=variableType::getOrCreateVar(*name, T_INTVAR); v->assignment(shared_ptr(new expression( shared_ptr(new constOp("2", T_INT))))); - shared_ptrprint=shared_ptr( + print=shared_ptr( new printSegment(shared_ptr(new expression(v)))); print->generate(); label::generateEnd();