From ac465200d9a8b6f38fa8fe5a1ebe47f75936ab39 Mon Sep 17 00:00:00 2001 From: Dante Falzone <48266179+DanteFalzone0@users.noreply.github.com> Date: Fri, 11 Mar 2022 18:49:46 -0600 Subject: [PATCH 1/2] Added DEBUG macro #ifdef --- src/compiler/parse.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/compiler/parse.c b/src/compiler/parse.c index e36a0e5..bd9de4a 100644 --- a/src/compiler/parse.c +++ b/src/compiler/parse.c @@ -491,7 +491,8 @@ static inline TokenKind current(Context *ctx) return current_token(ctx)->kind; } -#if 0 +// Compile with -DDEBUG to get debugging messages printed to stderr. +#ifdef DEBUG #include @@ -2103,4 +2104,4 @@ static Node *parse_dowhile_statement(Context *ctx) } return (Node*) dowhl; -} \ No newline at end of file +} From 6a25171c30dcfd8a2e2b7fb32253cdb008a92380 Mon Sep 17 00:00:00 2001 From: Dante Falzone <48266179+DanteFalzone0@users.noreply.github.com> Date: Fri, 11 Mar 2022 19:02:10 -0600 Subject: [PATCH 2/2] added `--debug` option to build.sh --- build.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index c4f2226..03ca4f3 100755 --- a/build.sh +++ b/build.sh @@ -2,6 +2,15 @@ USING_VALGRIND=0 FLAGS="-L3p/libs/ -I3p/include/ -Wall -Wextra -g -DUSING_VALGRIND=$USING_VALGRIND" +# pass `--debug` to this script to enable debugging messages +while test $# != 0 +do + case "$1" in + --debug) FLAGS="$FLAGS -DDEBUG" ;; + esac + shift +done + mkdir temp mkdir temp/utils @@ -101,4 +110,4 @@ gcc src/main.c \ temp/common/executable.o \ -o build/noja $FLAGS -Lbuild/ -lnoja-compile -lnoja-objects -lxjson -lm -rm -rf temp \ No newline at end of file +rm -rf temp