From f5761a5e68fa805d58422ca0db5f32f049e77551 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 13 Feb 2004 16:37:43 +0000 Subject: [PATCH] exit(1) instead of abort()'ing on error git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11380 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/FileLexer.l | 4 ++-- utils/TableGen/FileParser.y | 46 ++++++++++++++++++------------------- utils/TableGen/TableGen.cpp | 4 ++-- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/utils/TableGen/FileLexer.l b/utils/TableGen/FileLexer.l index ec22afdb1fc..9b7973c6dc3 100644 --- a/utils/TableGen/FileLexer.l +++ b/utils/TableGen/FileLexer.l @@ -130,7 +130,7 @@ static void HandleInclude(const char *Buffer) { yyin = fopen(NextFilename.c_str(), "r"); if (yyin == 0) { err() << "Could not find include file '" << Filename << "'!\n"; - abort(); + exit(1); } Filename = NextFilename; } @@ -214,7 +214,7 @@ ${Identifier} { Filelval.StrVal = new std::string(yytext+1, yytext+yyleng); "/*" { ++CommentDepth; } "/"+[^*]* /* eat up /'s not followed by *'s */ "*"+"/" { if (!--CommentDepth) { BEGIN(INITIAL); } } -<> { err() << "Unterminated comment!\n"; abort(); } +<> { err() << "Unterminated comment!\n"; exit(1); } . { return Filetext[0]; } diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index e95e59785c9..af8d3d4ff28 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -51,7 +51,7 @@ static void addValue(const RecordVal &RV) { err() << "New definition of '" << RV.getName() << "' of type '" << *RV.getType() << "' is incompatible with previous " << "definition of type '" << *ERV->getType() << "'!\n"; - abort(); + exit(1); } } else { CurRec->addValue(RV); @@ -61,7 +61,7 @@ static void addValue(const RecordVal &RV) { static void addSuperClass(Record *SC) { if (CurRec->isSubClassOf(SC)) { err() << "Already subclass of '" << SC->getName() << "'!\n"; - abort(); + exit(1); } CurRec->addSuperClass(SC); } @@ -73,7 +73,7 @@ static void setValue(const std::string &ValName, RecordVal *RV = CurRec->getValue(ValName); if (RV == 0) { err() << "Value '" << ValName << "' unknown!\n"; - abort(); + exit(1); } // If we are assigning to a subset of the bits in the value... then we must be @@ -84,7 +84,7 @@ static void setValue(const std::string &ValName, BitsInit *CurVal = dynamic_cast(RV->getValue()); if (CurVal == 0) { err() << "Value '" << ValName << "' is not a bits type!\n"; - abort(); + exit(1); } // Convert the incoming value to a bits type of the appropriate size... @@ -92,7 +92,7 @@ static void setValue(const std::string &ValName, if (BI == 0) { V->convertInitializerTo(new BitsRecTy(BitList->size())); err() << "Initializer '" << *V << "' not compatible with bit range!\n"; - abort(); + exit(1); } // We should have a BitsInit type now... @@ -107,7 +107,7 @@ static void setValue(const std::string &ValName, if (NewVal->getBit(Bit)) { err() << "Cannot set bit #" << Bit << " of value '" << ValName << "' more than once!\n"; - abort(); + exit(1); } NewVal->setBit(Bit, BInit->getBit(i)); } @@ -122,7 +122,7 @@ static void setValue(const std::string &ValName, if (RV->setValue(V)) { err() << "Value '" << ValName << "' of type '" << *RV->getType() << "' is incompatible with initializer '" << *V << "'!\n"; - abort(); + exit(1); } } @@ -137,7 +137,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { // Ensure that an appropriate number of template arguments are specified... if (TArgs.size() < TemplateArgs.size()) { err() << "ERROR: More template args specified than expected!\n"; - abort(); + exit(1); } else { // This class expects template arguments... // Loop over all of the template arguments, setting them to the specified // value or leaving them as the default as necessary. @@ -149,7 +149,7 @@ static void addSubClass(Record *SC, const std::vector &TemplateArgs) { err() << "ERROR: Value not specified for template argument #" << i << " (" << TArgs[i] << ") of subclass '" << SC->getName() << "'!\n"; - abort(); + exit(1); } } } @@ -206,7 +206,7 @@ ClassID : ID { $$ = Records.getClass(*$1); if ($$ == 0) { err() << "Couldn't find class '" << *$1 << "'!\n"; - abort(); + exit(1); } delete $1; }; @@ -252,7 +252,7 @@ Value : INTVAL { if (Bit == 0) { err() << "Element #" << i << " (" << *(*$2)[i] << ") is not convertable to a bit!\n"; - abort(); + exit(1); } Init->setBit($2->size()-i-1, Bit); } @@ -265,7 +265,7 @@ Value : INTVAL { $$ = new DefInit(D); } else { err() << "Variable not defined: '" << *$1 << "'!\n"; - abort(); + exit(1); } delete $1; @@ -273,7 +273,7 @@ Value : INTVAL { $$ = $1->convertInitializerBitRange(*$3); if ($$ == 0) { err() << "Invalid bit range for value '" << *$1 << "'!\n"; - abort(); + exit(1); } delete $3; } | '[' ValueList ']' { @@ -282,7 +282,7 @@ Value : INTVAL { } | Value '.' ID { if (!$1->getFieldType(*$3)) { err() << "Cannot access field '" << *$3 << "' of value '" << *$1 << "!\n"; - abort(); + exit(1); } $$ = new FieldInit($1, *$3); delete $3; @@ -290,7 +290,7 @@ Value : INTVAL { Record *D = Records.getDef(*$2); if (D == 0) { err() << "Invalid def '" << *$2 << "'!\n"; - abort(); + exit(1); } $$ = new DagInit(D, *$3); delete $2; delete $3; @@ -326,7 +326,7 @@ RBitList : INTVAL { } | INTVAL '-' INTVAL { if ($1 < $3 || $1 < 0 || $3 < 0) { err() << "Invalid bit range: " << $1 << "-" << $3 << "!\n"; - abort(); + exit(1); } $$ = new std::vector(); for (int i = $1; i >= $3; --i) @@ -335,7 +335,7 @@ RBitList : INTVAL { $2 = -$2; if ($1 < $2 || $1 < 0 || $2 < 0) { err() << "Invalid bit range: " << $1 << "-" << $2 << "!\n"; - abort(); + exit(1); } $$ = new std::vector(); for (int i = $1; i >= $2; --i) @@ -345,7 +345,7 @@ RBitList : INTVAL { } | RBitList ',' INTVAL '-' INTVAL { if ($3 < $5 || $3 < 0 || $5 < 0) { err() << "Invalid bit range: " << $3 << "-" << $5 << "!\n"; - abort(); + exit(1); } $$ = $1; for (int i = $3; i >= $5; --i) @@ -354,7 +354,7 @@ RBitList : INTVAL { $4 = -$4; if ($3 < $4 || $3 < 0 || $4 < 0) { err() << "Invalid bit range: " << $3 << "-" << $4 << "!\n"; - abort(); + exit(1); } $$ = $1; for (int i = $3; i >= $4; --i) @@ -472,7 +472,7 @@ ObjectBody : OptID { ClassInst : CLASS ObjectBody { if (Records.getClass($2->getName())) { err() << "Class '" << $2->getName() << "' already defined!\n"; - abort(); + exit(1); } Records.addClass($$ = $2); }; @@ -481,12 +481,12 @@ DefInst : DEF ObjectBody { if (!$2->getTemplateArgs().empty()) { err() << "Def '" << $2->getName() << "' is not permitted to have template arguments!\n"; - abort(); + exit(1); } // If ObjectBody has template arguments, it's an error. if (Records.getDef($2->getName())) { err() << "Def '" << $2->getName() << "' already defined!\n"; - abort(); + exit(1); } Records.addDef($$ = $2); }; @@ -520,5 +520,5 @@ File : ObjectList {}; int yyerror(const char *ErrorMsg) { err() << "Error parsing: " << ErrorMsg << "\n"; - abort(); + exit(1); } diff --git a/utils/TableGen/TableGen.cpp b/utils/TableGen/TableGen.cpp index cb0a804617e..dd0dc9a93ca 100644 --- a/utils/TableGen/TableGen.cpp +++ b/utils/TableGen/TableGen.cpp @@ -97,7 +97,7 @@ static Init *getBit(Record *R, unsigned BitNo) { } std::cerr << "Cannot find requested bit!\n"; - abort(); + exit(1); return 0; } @@ -273,7 +273,7 @@ static Record *ParseMachineCode(std::vector::iterator InstsB, if (RangeBegin == InstsB && RangeEnd == InstsE) { std::cerr << "Error: Could not distinguish among the following insts!:\n"; PrintRange(InstsB, InstsE); - abort(); + exit(1); } #if 0 -- 2.34.1