From e480e38ff593c1bba7669f89cf2213c694c9bcd2 Mon Sep 17 00:00:00 2001 From: Noah Swerhun Date: Fri, 24 May 2024 22:13:24 -0500 Subject: [PATCH] removed needless assertion --- build.ninja | 40 ++++++++++++++++++++-------------------- src/main.c | 10 +--------- 2 files changed, 21 insertions(+), 29 deletions(-) diff --git a/build.ninja b/build.ninja index 1c63bfb..2d5740a 100644 --- a/build.ninja +++ b/build.ninja @@ -24,26 +24,6 @@ build $builddir/compile_commands.json: regen_compile_commands ngen.toml || $buil build build.ninja: regen_ninjafile ngen.toml || $builddir/compile_commands.json pool = console -# BEGIN TARGET debug -rule cc_debug - deps = gcc - depfile = $dep - command = cc -I. -fsanitize=address -O0 -g -MD -MF $dep -o $out -c $in - description = Building $in -> $out -rule link_debug - command = cc -fsanitize=address -o $out $in - description = Linking $out - -build $builddir/debug/obj: mkdir -build $builddir/debug/dep: mkdir - -build $builddir/debug/obj/src-main.c.o: cc_debug src/main.c - dep = $builddir/debug/dep/src-main.c.o.d - -build $builddir/debug/pss-total: link_debug $builddir/debug/obj/src-main.c.o | || $builddir/debug/obj $builddir/debug/dep -build debug: phony $builddir/debug/pss-total -# END TARGET debug - # BEGIN TARGET release rule cc_release deps = gcc @@ -83,3 +63,23 @@ build $builddir/main/obj/src-main.c.o: cc_main src/main.c build $builddir/main/pss-total: link_main $builddir/main/obj/src-main.c.o | || $builddir/main/obj $builddir/main/dep build main: phony $builddir/main/pss-total # END TARGET main + +# BEGIN TARGET debug +rule cc_debug + deps = gcc + depfile = $dep + command = cc -I. -fsanitize=address -O0 -g -MD -MF $dep -o $out -c $in + description = Building $in -> $out +rule link_debug + command = cc -fsanitize=address -o $out $in + description = Linking $out + +build $builddir/debug/obj: mkdir +build $builddir/debug/dep: mkdir + +build $builddir/debug/obj/src-main.c.o: cc_debug src/main.c + dep = $builddir/debug/dep/src-main.c.o.d + +build $builddir/debug/pss-total: link_debug $builddir/debug/obj/src-main.c.o | || $builddir/debug/obj $builddir/debug/dep +build debug: phony $builddir/debug/pss-total +# END TARGET debug diff --git a/src/main.c b/src/main.c index 848fc76..cfd49da 100644 --- a/src/main.c +++ b/src/main.c @@ -22,15 +22,7 @@ double read_file(const char *filename) { fp = fopen(filename, "r"); if (fp == NULL) { - switch (errno) { - case EACCES: - return 0; - break; - default: - perror("cannot open file pointer"); - assert(fp != NULL); - break; - } + return 0; } while (1) {