diff options
author | Kartik Agaram <vc@akkartik.com> | 2019-07-25 13:40:42 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2019-07-25 13:59:17 -0700 |
commit | ecbdc925d43f489e5c5b101900db88f9d260efe7 (patch) | |
tree | 626f31eebe26ccdc527c5d999ac87375e472bb88 | |
parent | 34e1828162deec95b1913b420e7aee605d68fa82 (diff) | |
download | mu-ecbdc925d43f489e5c5b101900db88f9d260efe7.tar.gz |
5476
Fix CI. Also kill compiler version mismatch bugs once and for all.
-rwxr-xr-x | build0 | 4 | ||||
-rwxr-xr-x | build1 | 7 | ||||
-rwxr-xr-x | build2 | 11 | ||||
-rwxr-xr-x | build3 | 11 | ||||
-rwxr-xr-x | build4 | 11 | ||||
-rw-r--r-- | subx/011run.cc | 8 | ||||
-rw-r--r-- | subx/030---operands.cc | 2 | ||||
-rwxr-xr-x | subx/build | 2 |
8 files changed, 33 insertions, 23 deletions
diff --git a/build0 b/build0 index 7c1c176f..c82e58a3 100755 --- a/build0 +++ b/build0 @@ -22,7 +22,7 @@ cd tangle grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list # } # Now that we have all the _lists, compile 'tangle' - g++ -g -O2 boot.cc -o tangle + g++ -std=c++98 -g -O2 boot.cc -o tangle ./tangle test cd .. @@ -41,6 +41,6 @@ grep -h "^[^[:space:]#].*) {$" mu.cc |grep -v ":.*(" |sed 's/ {.*/;/' > funct # auto-generate list of tests to run grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' > test_list grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list -g++ -g -O2 mu.cc termbox/libtermbox.a -o mu_bin +g++ -std=c++98 -g -O2 mu.cc termbox/libtermbox.a -o mu_bin cat [0-9]*.mu > core.mu diff --git a/build1 b/build1 index 53b54899..74a2afe7 100755 --- a/build1 +++ b/build1 @@ -14,13 +14,14 @@ test "$CXX" || export CXX=c++ test "$CC" || export CC=cc test "$CFLAGS" || export CFLAGS="-g -O2" export CFLAGS="$CFLAGS -Wall -Wextra -ftrapv -fno-strict-aliasing" +export CXXFLAGS="-std=c++98 $CFLAGS" # CI has an ancient version; don't expect recent dialects # Outline: # [0-9]*.cc -> mu.cc -> mu_bin # (layers) | | # tangle $CXX -$CXX $CFLAGS enumerate/enumerate.cc -o enumerate/enumerate +$CXX $CXXFLAGS enumerate/enumerate.cc -o enumerate/enumerate cd tangle # auto-generate various lists (ending in '_list' by convention) { @@ -40,7 +41,7 @@ cd tangle grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list # } # Now that we have all the _lists, compile 'tangle' - $CXX $CFLAGS boot.cc -o tangle + $CXX $CXXFLAGS boot.cc -o tangle ./tangle test cd .. @@ -60,7 +61,7 @@ grep -h "^[^[:space:]#].*) {$" mu.cc |grep -v ":.*(" |sed 's/ {.*/;/' > funct # auto-generate list of tests to run grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/\1,/' > test_list grep -h "^\s*void test_" mu.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' > test_name_list -$CXX $CFLAGS mu.cc termbox/libtermbox.a -o mu_bin +$CXX $CXXFLAGS mu.cc termbox/libtermbox.a -o mu_bin ## [0-9]*.mu -> core.mu diff --git a/build2 b/build2 index 293436ee..9b24bc81 100755 --- a/build2 +++ b/build2 @@ -14,6 +14,7 @@ test "$CXX" || export CXX=c++ test "$CC" || export CC=cc test "$CFLAGS" || export CFLAGS="-g -O2" export CFLAGS="$CFLAGS -Wall -Wextra -ftrapv -fno-strict-aliasing" +export CXXFLAGS="-std=c++98 $CFLAGS" # CI has an ancient version; don't expect recent dialects # Outline: # [0-9]*.cc -> mu.cc -> .build/*.cc -> .build/*.o -> .build/mu_bin @@ -81,7 +82,7 @@ noisy_cd() { } older_than enumerate/enumerate enumerate/enumerate.cc && { - $CXX $CFLAGS enumerate/enumerate.cc -o enumerate/enumerate + $CXX $CXXFLAGS enumerate/enumerate.cc -o enumerate/enumerate } older_than tangle/tangle tangle/*.cc && { @@ -103,7 +104,7 @@ older_than tangle/tangle tangle/*.cc && { grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list # } # Now that we have all the _lists, compile 'tangle' - $CXX $CFLAGS boot.cc -o tangle + $CXX $CXXFLAGS boot.cc -o tangle ./tangle test noisy_cd .. # no effect; just to show us returning to the parent directory } @@ -115,7 +116,7 @@ older_than mu.cc $LAYERS enumerate/enumerate tangle/tangle && { } older_than cleave/cleave cleave/cleave.cc && { - $CXX $CFLAGS cleave/cleave.cc -o cleave/cleave + $CXX $CXXFLAGS cleave/cleave.cc -o cleave/cleave rm -rf .build } @@ -139,7 +140,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && { for f in mu_*.cc do older_than `echo $f |sed 's/\.cc$/.o/'` $f header global_declarations_list function_list test_list && { - $CXX $CFLAGS -c $f + $CXX $CXXFLAGS -c $f } done noisy_cd ../termbox @@ -153,7 +154,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && { ar rcs libtermbox.a *.o } noisy_cd .. - $CXX $CFLAGS .build/*.o termbox/libtermbox.a -o .build/mu_bin + $CXX $CXXFLAGS .build/*.o termbox/libtermbox.a -o .build/mu_bin cp .build/mu_bin . } diff --git a/build3 b/build3 index 2748a2a7..652210fe 100755 --- a/build3 +++ b/build3 @@ -11,6 +11,7 @@ test "$CXX" || export CXX=c++ test "$CC" || export CC=cc test "$CFLAGS" || export CFLAGS="-g -O2" export CFLAGS="$CFLAGS -Wall -Wextra -ftrapv -fno-strict-aliasing" +export CXXFLAGS="-std=c++98 $CFLAGS" # CI has an ancient version; don't expect recent dialects # Outline: # [0-9]*.cc -> mu.cc -> .build/*.cc -> .build/*.o -> .build/mu_bin @@ -106,7 +107,7 @@ noisy_cd() { } older_than enumerate/enumerate enumerate/enumerate.cc && { - $CXX $CFLAGS enumerate/enumerate.cc -o enumerate/enumerate + $CXX $CXXFLAGS enumerate/enumerate.cc -o enumerate/enumerate } older_than tangle/tangle tangle/*.cc && { @@ -128,7 +129,7 @@ older_than tangle/tangle tangle/*.cc && { grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list # } # Now that we have all the _lists, compile 'tangle' - $CXX $CFLAGS boot.cc -o tangle + $CXX $CXXFLAGS boot.cc -o tangle ./tangle test noisy_cd .. # no effect; just to show us returning to the parent directory } @@ -140,7 +141,7 @@ older_than mu.cc $LAYERS enumerate/enumerate tangle/tangle && { } older_than cleave/cleave cleave/cleave.cc && { - $CXX $CFLAGS cleave/cleave.cc -o cleave/cleave + $CXX $CXXFLAGS cleave/cleave.cc -o cleave/cleave rm -rf .build } @@ -164,7 +165,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && { for f in mu_*.cc do older_than `echo $f |sed 's/\.cc$/.o/'` $f header global_declarations_list function_list test_list && { - $CXX $CFLAGS -c $f + $CXX $CXXFLAGS -c $f } done noisy_cd ../termbox @@ -178,7 +179,7 @@ older_than mu_bin mu.cc *_list cleave/cleave termbox/* && { ar rcs libtermbox.a *.o } noisy_cd .. - $CXX $CFLAGS .build/*.o termbox/libtermbox.a -o .build/mu_bin + $CXX $CXXFLAGS .build/*.o termbox/libtermbox.a -o .build/mu_bin cp .build/mu_bin . } diff --git a/build4 b/build4 index d92dbfda..26ec6a7b 100755 --- a/build4 +++ b/build4 @@ -25,6 +25,7 @@ test "$CXX" || export CXX=c++ test "$CC" || export CC=cc test "$CFLAGS" || export CFLAGS="-g -O2" export CFLAGS="$CFLAGS -Wall -Wextra -ftrapv -fno-strict-aliasing" +export CXXFLAGS="-std=c++98 $CFLAGS" # CI has an ancient version; don't expect recent dialects # Outline: # [0-9]*.cc -> mu.cc -> .build/*.cc -> .build/*.o -> .build/mu_bin @@ -129,7 +130,7 @@ mv_if_exists enumerate/enumerate $TMP wait_for_all enumerate/enumerate.cc older_than $TMP enumerate/enumerate.cc && { echo "building enumerate" - $CXX $CFLAGS enumerate/enumerate.cc -o $TMP || quit + $CXX $CXXFLAGS enumerate/enumerate.cc -o $TMP || quit echo "done building enumerate" } mv $TMP enumerate/enumerate @@ -159,7 +160,7 @@ mv_if_exists tangle/tangle $TMP grep -h "^\s*void test_" [0-9]*.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |update test_name_list # } # Now that we have all the _lists, compile 'tangle' - $CXX $CFLAGS boot.cc -o $TMP || quit + $CXX $CXXFLAGS boot.cc -o $TMP || quit $TMP test cd .. echo "done building tangle" @@ -191,7 +192,7 @@ mv_if_exists cleave/cleave $TMP wait_for_all cleave/cleave.cc older_than $TMP cleave/cleave.cc && { echo "building cleave" - $CXX $CFLAGS cleave/cleave.cc -o $TMP || quit + $CXX $CXXFLAGS cleave/cleave.cc -o $TMP || quit rm -rf .build echo "done building cleave" } @@ -229,7 +230,7 @@ mv_if_exists mu_bin $TMP ( older_than $TMP $f header global_declarations_list function_list test_list && { echo "building $OBJ" - $CXX $CFLAGS -c $f -o $TMP || quit + $CXX $CXXFLAGS -c $f -o $TMP || quit echo "done building $OBJ" } mv $TMP $OBJ @@ -272,7 +273,7 @@ mv_if_exists mu_bin $TMP echo wait_for_all $MU_OBJS termbox/libtermbox.a wait_for_all $MU_OBJS termbox/libtermbox.a echo "building .build/mu_bin" - $CXX $CFLAGS $MU_OBJS termbox/libtermbox.a -o $TMP || quit + $CXX $CXXFLAGS $MU_OBJS termbox/libtermbox.a -o $TMP || quit echo "done building .build/mu_bin" echo "done building mu_bin" } diff --git a/subx/011run.cc b/subx/011run.cc index ca568a98..cc3b82f6 100644 --- a/subx/011run.cc +++ b/subx/011run.cc @@ -300,7 +300,7 @@ const segment* find(const program& p, const string& segment_name) { } uint8_t hex_byte(const string& s) { - if (std::any_of(s.begin(), s.end(), isupper)) { + if (contains_uppercase(s)) { raise << "uppercase hex not allowed: " << s << '\n' << end(); return 0; } @@ -459,3 +459,9 @@ string to_string(const word& w) { out << " /" << w.metadata.at(i); return out.str(); } + +bool contains_uppercase(const string& s) { + for (int i = 0; i < SIZE(s); ++i) + if (isupper(s.at(i))) return true; + return false; +} diff --git a/subx/030---operands.cc b/subx/030---operands.cc index 8dc38542..9f40e949 100644 --- a/subx/030---operands.cc +++ b/subx/030---operands.cc @@ -503,7 +503,7 @@ string to_string(const line& inst) { int32_t parse_int(const string& s) { if (s.empty()) return 0; - if (std::any_of(s.begin(), s.end(), isupper)) { + if (contains_uppercase(s)) { raise << "uppercase hex not allowed: " << s << '\n' << end(); return 0; } diff --git a/subx/build b/subx/build index 8939c8b3..67479b92 100755 --- a/subx/build +++ b/subx/build @@ -21,7 +21,7 @@ UNTIL_LAYER=${2:-zzz} test "$CXX" || export CXX=c++ test "$CC" || export CC=cc -test "$CFLAGS" || export CFLAGS="-g -O3" +test "$CFLAGS" || export CFLAGS="-g -O3 -std=c++98" # CI has an ancient version; don't expect recent dialects export CFLAGS="$CFLAGS -Wall -Wextra -fno-strict-aliasing" # return 1 if $1 is older than _any_ of the remaining args |