Fix CI. Also kill compiler version mismatch bugs once and for all.
This commit is contained in:
Kartik Agaram 2019-07-25 13:40:42 -07:00
parent 34e1828162
commit ecbdc925d4
8 changed files with 33 additions and 23 deletions

4
build0
View File

@ -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

7
build1
View File

@ -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

11
build2
View File

@ -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 .
}

11
build3
View File

@ -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 .
}

11
build4
View File

@ -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"
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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