Skip to content

Commit

Permalink
Внутренние ошибки компилятора имеют errorlevel > 100 (#26)
Browse files Browse the repository at this point in the history
Новый обработчик командной строки возвращает errorlevel 1, если в командной
строке была ошибка. Автотесты воспринимали этот код возврата как признак
внутренней ошибки и падали. Данный коммит устанавливает код возврата по ошибкам
сопоставления и нехватки памяти коды возврата больше 100, аналогичная проверка
осуществляется в автотестах.
  • Loading branch information
Mazdaywik committed Apr 10, 2016
1 parent 6d72ed0 commit abe1c92
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion autotests/run.bat
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ setlocal
set CPP=%~n1.cpp

..\bin\srefc-core %1 2> __error.txt
if errorlevel 1 (
if errorlevel 100 (
echo COMPILER ON %1 FAILS, SEE __error.txt
exit
)
Expand Down
2 changes: 1 addition & 1 deletion autotests/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ run_test_aux.BAD-SYNTAX() {
EXE=${SREF%%.sref}

../bin/srefc-core $SREF 2>__error.txt
if [ $? -gt 0 ]; then
if [ $? -ge 100 ]; then
echo COMPILER ON $SREF FAILS, SEE __error.txt
exit
fi
Expand Down
8 changes: 4 additions & 4 deletions src/srlib/refalrts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2864,16 +2864,16 @@ int main(int argc, char **argv) {
return 0;

case refalrts::cRecognitionImpossible:
return 1;
return 101;

case refalrts::cNoMemory:
return 2;
return 102;

case refalrts::cExit:
return refalrts::vm::g_ret_code;

default:
fprintf(stderr, "INTERNAL ERROR: check switch in main");
return 5;
fprintf(stderr, "INTERNAL ERROR: check switch in main (res = %d)\n", res);
return 105;
}
}

0 comments on commit abe1c92

Please sign in to comment.