diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-09-28 19:28:24 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-09-28 19:28:24 +0000 |
commit | 5b7e753d9523f7cfd469f1b08a9a26976024fe37 (patch) | |
tree | 2621468c4c5e445038d93afb27c62b4fac397640 /lib/AsmParser/llvmAsmParser.cpp.cvs | |
parent | 2a0b2b292af1b67187a48546a2abb8182e233dca (diff) |
Fix PR902:
Errors are generated with the YYERROR macro which can only be called from
a production (inside yyparse) because of the goto statement in the macro.
This lead to several situations where GEN_ERROR was not called but
GenerateError was used instead (because it doesn't use YYERROR). However,
in such situations, catching the error much later (e.g. at the end of
the production) is not sufficient because LLVM can assert on invalid data
before the end of the production is reached. The solution is to ensure that
the CHECK_FOR_ERROR macro (which invokes YYERROR if there's an error) is
used as soon as possible after a call to GenerateError has been made.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30650 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser/llvmAsmParser.cpp.cvs')
-rw-r--r-- | lib/AsmParser/llvmAsmParser.cpp.cvs | 2191 |
1 files changed, 1064 insertions, 1127 deletions
diff --git a/lib/AsmParser/llvmAsmParser.cpp.cvs b/lib/AsmParser/llvmAsmParser.cpp.cvs index 7e1eb7b1ee..0cac3c8233 100644 --- a/lib/AsmParser/llvmAsmParser.cpp.cvs +++ b/lib/AsmParser/llvmAsmParser.cpp.cvs @@ -1,9 +1,7 @@ -/* A Bison parser, made by GNU Bison 2.2. */ +/* A Bison parser, made by GNU Bison 2.1. */ -/* Skeleton implementation for Bison's Yacc-like parsers in C - - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 - Free Software Foundation, Inc. +/* Skeleton parser for Yacc-like parsing with Bison, + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,21 +18,13 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ +/* As a special exception, when this file is copied by Bison into a + Bison output file, you may use that output file without restriction. + This special exception was added by the Free Software Foundation + in version 1.24 of Bison. */ -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ +/* Written by Richard Stallman by simplifying the original so called + ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local @@ -47,7 +37,7 @@ #define YYBISON 1 /* Bison version. */ -#define YYBISON_VERSION "2.2" +#define YYBISON_VERSION "2.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -292,7 +282,7 @@ /* Copy the first part of user declarations. */ -#line 14 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" +#line 14 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" #include "ParserInternals.h" #include "llvm/CallingConv.h" @@ -388,6 +378,8 @@ static struct PerModuleInfo { // are resolved when the constant pool has been completely parsed. // ResolveDefinitions(LateResolveValues); + if (TriggerError) + return; // Check to make sure that all global value forward references have been // resolved! @@ -401,6 +393,7 @@ static struct PerModuleInfo { I->first.second.getName() + "\n"; } GenerateError(UndefinedReferences); + return; } // Look for intrinsic functions and CallInst that need to be upgraded @@ -458,9 +451,11 @@ static struct PerFunctionInfo { NumberedBlocks.clear(); // Any forward referenced blocks left? - if (!BBForwardRefs.empty()) + if (!BBForwardRefs.empty()) { GenerateError("Undefined reference to label " + BBForwardRefs.begin()->first->getName()); + return; + } // Resolve all forward references now. ResolveDefinitions(LateResolveValues, &CurModule.LateResolveValues); @@ -504,6 +499,7 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { break; default: GenerateError("Internal parser error: Invalid symbol type reference!"); + return 0; } // If we reached here, we referenced either a symbol that we don't know about @@ -514,10 +510,13 @@ static const Type *getTypeVal(const ValID &D, bool DoNotImprovise = false) { if (inFunctionScope()) { - if (D.Type == ValID::NameVal) + if (D.Type == ValID::NameVal) { GenerateError("Reference to an undefined type: '" + D.getName() + "'"); - else + return 0; + } else { GenerateError("Reference to an undefined type: #" + itostr(D.Num)); + return 0; + } } std::map<ValID, PATypeHolder>::iterator I =CurModule.LateResolveTypes.find(D); @@ -541,9 +540,11 @@ static Value *lookupInSymbolTable(const Type *Ty, const std::string &Name) { // it. Otherwise return null. // static Value *getValNonImprovising(const Type *Ty, const ValID &D) { - if (isa<FunctionType>(Ty)) + if (isa<FunctionType>(Ty)) { GenerateError("Functions are not values and " "must be referenced as pointers"); + return 0; + } switch (D.Type) { case ValID::NumberVal: { // Is it a numbered definition? @@ -578,10 +579,12 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // Check to make sure that "Ty" is an integral type, and that our // value will fit into the specified type... case ValID::ConstSIntVal: // Is it a constant pool reference?? - if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) + if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Signed integral constant '" + itostr(D.ConstPool64) + "' is invalid for type '" + Ty->getDescription() + "'!"); + return 0; + } return ConstantSInt::get(Ty, D.ConstPool64); case ValID::ConstUIntVal: // Is it an unsigned const pool reference? @@ -589,6 +592,7 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { if (!ConstantSInt::isValueValidForType(Ty, D.ConstPool64)) { GenerateError("Integral constant '" + utostr(D.UConstPool64) + "' is invalid or out of range!"); + return 0; } else { // This is really a signed reference. Transmogrify. return ConstantSInt::get(Ty, D.ConstPool64); } @@ -597,13 +601,17 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { } case ValID::ConstFPVal: // Is it a floating point const pool reference? - if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) + if (!ConstantFP::isValueValidForType(Ty, D.ConstPoolFP)) { GenerateError("FP constant invalid for type!!"); + return 0; + } return ConstantFP::get(Ty, D.ConstPoolFP); case ValID::ConstNullVal: // Is it a null value? - if (!isa<PointerType>(Ty)) + if (!isa<PointerType>(Ty)) { GenerateError("Cannot create a a non pointer null!"); + return 0; + } return ConstantPointerNull::get(cast<PointerType>(Ty)); case ValID::ConstUndefVal: // Is it an undef value? @@ -613,16 +621,20 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { return Constant::getNullValue(Ty); case ValID::ConstantVal: // Fully resolved constant? - if (D.ConstantValue->getType() != Ty) + if (D.ConstantValue->getType() != Ty) { GenerateError("Constant expression type different from required type!"); + return 0; + } return D.ConstantValue; case ValID::InlineAsmVal: { // Inline asm expression const PointerType *PTy = dyn_cast<PointerType>(Ty); const FunctionType *FTy = PTy ? dyn_cast<FunctionType>(PTy->getElementType()) : 0; - if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) + if (!FTy || !InlineAsm::Verify(FTy, D.IAD->Constraints)) { GenerateError("Invalid type for asm constraint string!"); + return 0; + } InlineAsm *IA = InlineAsm::get(FTy, D.IAD->AsmString, D.IAD->Constraints, D.IAD->HasSideEffects); D.destroy(); // Free InlineAsmDescriptor. @@ -644,15 +656,20 @@ static Value *getValNonImprovising(const Type *Ty, const ValID &D) { // real thing. // static Value *getVal(const Type *Ty, const ValID &ID) { - if (Ty == Type::LabelTy) + if (Ty == Type::LabelTy) { GenerateError("Cannot use a basic block here"); + return 0; + } // See if the value has already been defined. Value *V = getValNonImprovising(Ty, ID); if (V) return V; + if (TriggerError) return 0; - if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) + if (!Ty->isFirstClassType() && !isa<OpaqueType>(Ty)) { GenerateError("Invalid use of a composite type!"); + return 0; + } // If we reached here, we referenced either a symbol that we don't know about // or an id number that hasn't been read yet. We may be referencing something @@ -684,7 +701,9 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { std::string Name; BasicBlock *BB = 0; switch (ID.Type) { - default: GenerateError("Illegal label reference " + ID.getName()); + default: + GenerateError("Illegal label reference " + ID.getName()); + return 0; case ValID::NumberVal: // Is it a numbered definition? if (unsigned(ID.Num) >= CurFun.NumberedBlocks.size()) CurFun.NumberedBlocks.resize(ID.Num+1); @@ -703,9 +722,11 @@ static BasicBlock *getBBVal(const ValID &ID, bool isDefinition = false) { // If this is the definition of the block, make sure the existing value was // just a forward reference. If it was a forward reference, there will be // an entry for it in the PlaceHolderInfo map. - if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) + if (isDefinition && !CurFun.BBForwardRefs.erase(BB)) { // The existing value was a definition, not a forward reference. GenerateError("Redefinition of label " + ID.getName()); + return 0; + } ID.destroy(); // Free strdup'd memory. return BB; @@ -769,6 +790,8 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, ValID &DID = PHI->second.first; Value *TheRealValue = getValNonImprovising(LRI->first, DID); + if (TriggerError) + return; if (TheRealValue) { V->replaceAllUsesWith(TheRealValue); delete V; @@ -778,15 +801,18 @@ ResolveDefinitions(std::map<const Type*,ValueList> &LateResolvers, // resolver table InsertValue(V, *FutureLateResolvers); } else { - if (DID.Type == ValID::NameVal) + if (DID.Type == ValID::NameVal) { GenerateError("Reference to an invalid definition: '" +DID.getName()+ "' of type '" + V->getType()->getDescription() + "'", PHI->second.second); - else + return; + } else { GenerateError("Reference to an invalid definition: #" + itostr(DID.Num) + " of type '" + V->getType()->getDescription() + "'", PHI->second.second); + return; + } } } } @@ -820,14 +846,18 @@ static void setValueName(Value *V, char *NameStr) { std::string Name(NameStr); // Copy string free(NameStr); // Free old string - if (V->getType() == Type::VoidTy) + if (V->getType() == Type::VoidTy) { GenerateError("Can't assign name '" + Name+"' to value with void type!"); + return; + } assert(inFunctionScope() && "Must be in function scope!"); SymbolTable &ST = CurFun.CurrentFunction->getSymbolTable(); - if (ST.lookup(V->getType(), Name)) + if (ST.lookup(V->getType(), Name)) { GenerateError("Redefinition of value named '" + Name + "' in the '" + V->getType()->getDescription() + "' type plane!"); + return; + } // Set the name. V->setName(Name); @@ -840,8 +870,10 @@ static GlobalVariable * ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, bool isConstantGlobal, const Type *Ty, Constant *Initializer) { - if (isa<FunctionType>(Ty)) + if (isa<FunctionType>(Ty)) { GenerateError("Cannot declare global vars of function type!"); + return 0; + } const PointerType *PTy = PointerType::get(Ty); @@ -900,6 +932,7 @@ ParseGlobalVariable(char *NameStr,GlobalValue::LinkageTypes Linkage, GenerateError("Redefinition of global variable named '" + Name + "' in the '" + Ty->getDescription() + "' type plane!"); + return 0; } } @@ -926,8 +959,10 @@ static bool setTypeName(const Type *T, char *NameStr) { free(NameStr); // Free old string // We don't allow assigning names to void type - if (T == Type::VoidTy) + if (T == Type::VoidTy) { GenerateError("Can't assign name '" + Name + "' to the void type!"); + return false; + } // Set the type name, checking for conflicts as we do so. bool AlreadyExists = CurModule.CurrentModule->addTypeName(Name, T); @@ -1052,7 +1087,7 @@ static PATypeHolder HandleUpRefs(const Type *ty) { // common code from the two 'RunVMAsmParser' functions - static Module * RunParser(Module * M) { +static Module* RunParser(Module * M) { llvmAsmlineno = 1; // Reset the current line number... ObsoleteVarArgs = false; @@ -1077,13 +1112,18 @@ static PATypeHolder HandleUpRefs(const Type *ty) { ObsoleteVarArgs = true; } - if (ObsoleteVarArgs && NewVarArgs) - GenerateError("This file is corrupt: it uses both new and old style varargs"); + if (ObsoleteVarArgs && NewVarArgs) { + GenerateError( + "This file is corrupt: it uses both new and old style varargs"); + return 0; + } if(ObsoleteVarArgs) { if(Function* F = Result->getNamedFunction("llvm.va_start")) { - if (F->arg_size() != 0) + if (F->arg_size() != 0) { GenerateError("Obsolete va_start takes 0 argument!"); + return 0; + } //foo = va_start() // -> @@ -1109,8 +1149,10 @@ static PATypeHolder HandleUpRefs(const Type *ty) { } if(Function* F = Result->getNamedFunction("llvm.va_end")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_end takes 1 argument!"); + return 0; + } //vaend foo // -> @@ -1133,8 +1175,10 @@ static PATypeHolder HandleUpRefs(const Type *ty) { } if(Function* F = Result->getNamedFunction("llvm.va_copy")) { - if(F->arg_size() != 1) + if(F->arg_size() != 1) { GenerateError("Obsolete va_copy takes 1 argument!"); + return 0; + } //foo = vacopy(bar) // -> //a = alloca 1 of typeof(foo) @@ -1165,8 +1209,7 @@ static PATypeHolder HandleUpRefs(const Type *ty) { } return Result; - - } +} //===----------------------------------------------------------------------===// // RunVMAsmParser - Define an interface to this parser @@ -1210,10 +1253,9 @@ Module *llvm::RunVMAsmParser(const char * AsmString, Module * M) { # define YYTOKEN_TABLE 0 #endif -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED -typedef union YYSTYPE -#line 913 "/home/asl/proj/llvm/src/lib/AsmParser/llvmAsmParser.y" -{ +#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) +#line 966 "/proj/llvm/llvm/lib/AsmParser/llvmAsmParser.y" +typedef union YYSTYPE { llvm::Module *ModuleVal; llvm::Function *FunctionVal; std::pair<llvm::PATypeHolder*, char*> *ArgVal; @@ -1251,10 +1293,9 @@ typedef union YYSTYPE llvm::Instruction::MemoryOps MemOpVal; llvm::Instruction::OtherOps OtherOpVal; llvm::Module::Endianness Endianness; -} -/* Line 193 of yacc.c. */ -#line 1257 "llvmAsmParser.tab.c" - YYSTYPE; +} YYSTYPE; +/* Line 196 of yacc.c. */ +#line 1299 "llvmAsmParser.tab.c" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 @@ -1265,56 +1306,23 @@ typedef union YYSTYPE /* Copy the second part of user declarations. */ -/* Line 216 of yacc.c. */ -#line 1270 "llvmAsmParser.tab.c" +/* Line 219 of yacc.c. */ +#line 1311 "llvmAsmParser.tab.c" -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) +# define YYSIZE_T __SIZE_TYPE__ #endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#elif (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -typedef signed char yytype_int8; -#else -typedef short int yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; +#if ! defined (YYSIZE_T) && defined (size_t) +# define YYSIZE_T size_t #endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; +#if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) +# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t #endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -# include <stddef.h> /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif +#if ! defined (YYSIZE_T) +# define YYSIZE_T unsigned int #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS @@ -1327,32 +1335,7 @@ typedef short int yytype_int16; # endif #endif -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(e) ((void) (e)) -#else -# define YYUSE(e) /* empty */ -#endif - -/* Identity function, used to suppress warnings about constant conditions. */ -#ifndef lint -# define YYID(n) (n) -#else -#if (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) -static int -YYID (int i) -#else -static int -YYID (i) - int i; -#endif -{ - return i; -} -#endif - -#if ! defined yyoverflow || YYERROR_VERBOSE +#if ! defined (yyoverflow) || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -1360,76 +1343,64 @@ YYID (i) # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include <alloca.h> /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include <malloc.h> /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca # else # define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if defined (__STDC__) || defined (__cplusplus) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif +# define YYINCLUDED_STDLIB_H # endif # endif # endif # endif # ifdef YYSTACK_ALLOC - /* Pacify GCC's `empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) + /* Pacify GCC's `empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) # endif -# if (defined __cplusplus && ! defined _STDLIB_H \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ -# ifndef _STDLIB_H -# define _STDLIB_H 1 -# endif +# ifdef __cplusplus +extern "C" { # endif # ifndef YYMALLOC # define YYMALLOC malloc -# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free -# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ - || defined __cplusplus || defined _MSC_VER) +# if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ + && (defined (__STDC__) || defined (__cplusplus))) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif +# ifdef __cplusplus +} +# endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ +#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) +#if (! defined (yyoverflow) \ + && (! defined (__cplusplus) \ + || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss; + short int yyss; YYSTYPE yyvs; }; @@ -1439,13 +1410,13 @@ union yyalloc /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ +# if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else @@ -1456,7 +1427,7 @@ union yyalloc for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ - while (YYID (0)) + while (0) # endif # endif @@ -1474,22 +1445,28 @@ union yyalloc yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ - while (YYID (0)) + while (0) + +#endif +#if defined (__STDC__) || defined (__cplusplus) + typedef signed char yysigned_char; +#else + typedef short int yysigned_char; #endif -/* YYFINAL -- State number of the termination state. */ +/* YYFINAL -- State number of the termination state. */ #define YYFINAL 4 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 1330 -/* YYNTOKENS -- Number of terminals. */ +/* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 122 -/* YYNNTS -- Number of nonterminals. */ +/* YYNNTS -- Number of nonterminals. */ #define YYNNTS 75 -/* YYNRULES -- Number of rules. */ +/* YYNRULES -- Number of rules. */ #define YYNRULES 251 -/* YYNRULES -- Number of states. */ +/* YYNRULES -- Number of states. */ #define YYNSTATES 514 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ @@ -1500,7 +1477,7 @@ union yyalloc ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ -static const yytype_uint8 yytranslate[] = +static const unsigned char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, @@ -1544,7 +1521,7 @@ static const yytype_uint8 yytranslate[] = #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ -static const yytype_uint16 yyprhs[] = +static const unsigned short int yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, @@ -1574,8 +1551,8 @@ static const yytype_uint16 yyprhs[] = 804, 811 }; -/* YYRHS -- A `-1'-separated list of the rules' RHS. */ -static const yytype_int16 yyrhs[] = +/* YYRHS -- A `-1'-separated list of the rules' RHS. */ +static const short int yyrhs[] = { 153, 0, -1, 5, -1, 6, -1, 3, -1, 4, -1, 77, -1, 78, -1, 79, -1, 80, -1, 81, @@ -1662,40 +1639,40 @@ static const yytype_int16 yyrhs[] = }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const unsigned short int yyrline[] = { - 0, 1035, 1035, 1036, 1044, 1045, 1055, 1055, 1055, 1055, - 1055, 1056, 1056, 1056, 1057, 1057, 1057, 1057, 1057, 1057, - 1059, 1059, 1063, 1063, 1063, 1063, 1064, 1064, 1064, 1064, - 1065, 1065, 1066, 1066, 1069, 1073, 1078, 1079, 1080, 1081, - 1082, 1083, 1084, 1085, 1087, 1088, 1089, 1090, 1091, 1092, - 1093, 1094, 1103, 1104, 1110, 1111, 1119, 1127, 1128, 1133, - 1134, 1135, 1140, 1154, 1154, 1155, 1155, 1157, 1167, 1167, - 1167, 1167, 1167, 1167, 1167, 1168, 1168, 1168, 1168, 1168, - 1168, 1169, 1173, 1177, 1184, 1192, 1205, 1210, 1222, 1232, - 1236, 1245, 1250, 1256, 1257, 1261, 1265, 1276, 1302, 1316, - 1346, 1372, 1393, 1406, 1416, 1421, 1481, 1488, 1497, 1503, - 1509, 1513, 1517, 1525, 1536, 1568, 1576, 1598, 1609, 1615, - 1623, 1629, 1635, 1644, 1648, 1656, 1656, 1666, 1674, 1679, - 1683, 1687, 1691, 1706, 1727, 1730, 1733, 1733, 1740, 1740, - 1748, 1748, 1756, 1756, 1764, 1767, 1770, 1774, 1787, 1788, - 1790, 1794, 1803, 1809, 1811, 1816, 1821, 1830, 1830, 1831, - 1831, 1833, 1840, 1846, 1853, 1857, 1863, 1868, 1873, 1967, - 1967, 1969, 1977, 1977, 1979, 1984, 1985, 1986, 1988, 1988, - 1998, 2002, 2007, 2011, 2015, 2019, 2023, 2027, 2031, 2035, - 2039, 2064, 2068, 2082, 2086, 2092, 2092, 2098, 2103, 2107, - 2116, 2126, 2131, 2142, 2154, 2158, 2162, 2166, 2170, 2185, - 2190, 2244, 2248, 2255, 2264, 2275, 2283, 2289, 2297, 2302, - 2309, 2309, 2311, 2315, 2322, 2335, 2347, 2358, 2371, 2379, - 2387, 2395, 2401, 2421, 2444, 2450, 2456, 2462, 2477, 2535, - 2542, 2545, 2550, 2554, 2561, 2566, 2571, 2576, 2581, 2589, - 2600, 2614 + 0, 1088, 1088, 1089, 1097, 1098, 1108, 1108, 1108, 1108, + 1108, 1109, 1109, 1109, 1110, 1110, 1110, 1110, 1110, 1110, + 1112, 1112, 1116, 1116, 1116, 1116, 1117, 1117, 1117, 1117, + 1118, 1118, 1119, 1119, 1122, 1126, 1131, 1132, 1133, 1134, + 1135, 1136, 1137, 1138, 1140, 1141, 1142, 1143, 1144, 1145, + 1146, 1147, 1156, 1157, 1163, 1164, 1172, 1180, 1181, 1186, + 1187, 1188, 1193, 1207, 1207, 1208, 1208, 1210, 1220, 1220, + 1220, 1220, 1220, 1220, 1220, 1221, 1221, 1221, 1221, 1221, + 1221, 1222, 1226, 1230, 1238, 1246, 1259, 1264, 1276, 1286, + 1290, 1299, 1304, 1310, 1311, 1315, 1319, 1330, 1356, 1370, + 1400, 1426, 1447, 1460, 1470, 1475, 1536, 1543, 1552, 1558, + 1564, 1568, 1572, 1580, 1591, 1623, 1631, 1653, 1664, 1670, + 1678, 1684, 1690, 1699, 1703, 1711, 1711, 1721, 1729, 1734, + 1738, 1742, 1746, 1761, 1783, 1786, 1789, 1789, 1797, 1797, + 1805, 1805, 1813, 1813, 1822, 1825, 1828, 1832, 1845, 1846, + 1848, 1852, 1861, 1867, 1869, 1874, 1879, 1888, 1888, 1889, + 1889, 1891, 1898, 1904, 1911, 1915, 1921, 1926, 1931, 2026, + 2026, 2028, 2036, 2036, 2038, 2043, 2044, 2045, 2047, 2047, + 2057, 2061, 2066, 2070, 2074, 2078, 2082, 2086, 2090, 2094, + 2098, 2123, 2127, 2141, 2145, 2151, 2151, 2157, 2162, 2166, + 2175, 2186, 2191, 2203, 2216, 2220, 2224, 2229, 2238, 2257, + 2266, 2322, 2326, 2333, 2344, 2357, 2366, 2375, 2385, 2389, + 2396, 2396, 2398, 2402, 2407, 2423, 2438, 2452, 2465, 2473, + 2481, 2489, 2495, 2515, 2538, 2544, 2550, 2556, 2571, 2630, + 2637, 2640, 2645, 2649, 2656, 2661, 2667, 2672, 2678, 2686, + 2698, 2713 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "ESINT64VAL", "EUINT64VAL", "SINTVAL", @@ -1738,7 +1715,7 @@ static const char *const yytname[] = # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ -static const yytype_uint16 yytoknum[] = +static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, @@ -1757,7 +1734,7 @@ static const yytype_uint16 yytoknum[] = # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const unsigned char yyr1[] = { 0, 122, 123, 123, 124, 124, 125, 125, 125, 125, 125, 126, 126, 126, 127, 127, 127, 127, 127, 127, @@ -1788,7 +1765,7 @@ static const yytype_uint8 yyr1[] = }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +static const unsigned char yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1821,7 +1798,7 @@ static const yytype_uint8 yyr2[] = /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ -static const yytype_uint8 yydefact[] = +static const unsigned char yydefact[] = { 146, 0, 43, 132, 1, 131, 178, 36, 37, 38, 39, 40, 41, 42, 0, 44, 202, 128, 129, 202, @@ -1877,8 +1854,8 @@ static const yytype_uint8 yydefact[] = 0, 0, 213, 210 }; -/* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +/* YYDEFGOTO[NTERM-NUM]. */ +static const short int yydefgoto[] = { -1, 85, 253, 269, 270, 271, 272, 191, 192, 221, 193, 25, 15, 37, 441, 305, 386, 405, 328, 387, @@ -1893,7 +1870,7 @@ static const yytype_int16 yydefgoto[] = /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -428 -static const yytype_int16 yypact[] = +static const short int yypact[] = { -428, 45, 194, 602, -428, -428, -428, -428, -428, -428, -428, -428, -428, -428, 26, 14, 85, -428, -428, -13, @@ -1950,7 +1927,7 @@ static const yytype_int16 yypact[] = }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = +static const short int yypgoto[] = { -428, -428, -428, 307, 308, 309, 311, -127, -126, -427, -428, 365, 383, -117, -428, -221, 55, -428, -241, -428, @@ -1967,7 +1944,7 @@ static const yytype_int16 yypgoto[] = number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -128 -static const yytype_int16 yytable[] = +static const short int yytable[] = { 88, 219, 220, 307, 104, 26, 329, 330, 195, 93, 39, 362, 222, 394, 198, 88, 117, 42, 364, 340, @@ -2105,7 +2082,7 @@ static const yytype_int16 yytable[] = 160 }; -static const yytype_int16 yycheck[] = +static const short int yycheck[] = { 37, 128, 128, 224, 52, 3, 247, 248, 110, 29, 23, 15, 129, 109, 109, 52, 84, 30, 15, 266, @@ -2245,7 +2222,7 @@ static const yytype_int16 yycheck[] = /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const unsigned char yystos[] = { 0, 153, 154, 155, 0, 25, 31, 41, 42, 43, 44, 45, 46, 47, 62, 134, 172, 174, 176, 183, @@ -2326,7 +2303,7 @@ do \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ - YYPOPSTACK (1); \ + YYPOPSTACK; \ goto yybackup; \ } \ else \ @@ -2334,7 +2311,7 @@ do \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ -while (YYID (0)) +while (0) #define YYTERROR 1 @@ -2349,7 +2326,7 @@ while (YYID (0)) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ - if (YYID (N)) \ + if (N) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ @@ -2363,7 +2340,7 @@ while (YYID (0)) (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ - while (YYID (0)) + while (0) #endif @@ -2375,8 +2352,8 @@ while (YYID (0)) # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column) + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif @@ -2403,96 +2380,36 @@ while (YYID (0)) do { \ if (yydebug) \ YYFPRINTF Args; \ -} while (YYID (0)) - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (YYID (0)) +} while (0) - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -/*ARGSUSED*/ -#if (defined __STDC__ || defined __C99__FUNC__ \ |