From: Michael D. Lowis Date: Wed, 9 Oct 2019 00:46:05 +0000 (-0400) Subject: integrate linting compiler script X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=02005312c7b3495305023d86a3241af05ab5ee31;p=projs%2Ftide.git integrate linting compiler script --- diff --git a/Rsconscript b/Rsconscript index 246a6f7..5896af3 100644 --- a/Rsconscript +++ b/Rsconscript @@ -19,7 +19,7 @@ build do # Build library and binaries env.Library("libtide.a", glob("src/lib/**/*.c")) - (glob("src/*.c") - ["src/term.c"]).each do |src| + (glob("src/*.c") - ["src/term.c", "src/tsed.c"]).each do |src| bin = File.basename(src).sub(/\.[^\.]$/,'') env.Program("bin/#{bin}", [src, "libtide.a"]) end diff --git a/alcc b/alcc index e7d1b3f..c226c0b 100755 --- a/alcc +++ b/alcc @@ -176,31 +176,26 @@ script=$(cat < 1) - { - error("functions should have a maximum of one return statement") - } - - if ((FNR - linenum) > MAXLINES) - { - warn("function is " (FNR - linenum) " lines long. blocks larger than 50 lines are considered too complex") - } + if (nreturns > 1) + { + error("functions should have a maximum of one return statement") + } - if (level < 0) - { - error("too many closing braces detected") - } + if ((FNR - linenum) > MAXLINES) + { + warn("function is " (FNR - linenum) " lines long. blocks larger than 50 lines are considered too complex") + } - if (!privatefn && (nasserts == 0)) - { - warn("public function has no assertions") - } + if (level < 0) + { + error("too many closing braces detected") + } - privatefn = 0 - nasserts = 0 - nreturns = 0 - infunc = 0 + if (!privatefn && (nasserts == 0)) + { + warn("public function has no assertions") } +} # if we're in a comment block, look for the end (incomment && match(\$0, /\*\//)) { @@ -228,19 +223,21 @@ script=$(cat <