⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 error.c

📁 CC386 is a general-purpose 32-bit C compiler. It is not an optimizing compiler but given that the co
💻 C
📖 第 1 页 / 共 4 页
字号:
        case ERR_ADDROFSTRUCT:
            sprintf(buf, "Structure required on left side of . or .*");
            break;
        case ERR_MEMBERNAMEEXP:
            sprintf(buf, "Member name expected");
            break;
        case ERR_MUSTCALLMEMBER:
            sprintf(buf, "Member function must be called or its address taken");
            break;
        case ERR_OPERATOREXPECTED:
            sprintf(buf, "Overloadable operator expected");
            break;
        case ERR_OPERATORMUSTCLASS:
            sprintf(buf, "'%s'must be class member or have a class parameter", 
                (char*)err->data);
            break;
        case ERR_CONSTNOMEMBER:
            sprintf(buf, "Only member functions may be 'const' or 'volatile'");
            break;
        case ERR_USERERR:
            sprintf(buf, "User: %s", (char*)err->data);
            break;
        case ERR_USERWARN:
            sprintf(buf, "User: %s", (char*)err->data);
            errlvl = 1;
            break;
        case ERR_DECL0ARG:
            sprintf(buf, "'%s' must be defined with no parameters", (char*)err
                ->data);
            break;
        case ERR_DECL1ARG:
            sprintf(buf, "'%s' must be defined with one parameter", (char*)err
                ->data);
            break;
        case ERR_DECL2ARG:
            sprintf(buf, "'%s' must be defined with two parameters", (char*)err
                ->data);
            break;
        case ERR_DECL0OR1ARG:
            sprintf(buf, "'%s' must be defined with zero or one parameters", 
                (char*)err->data);
            break;
        case ERR_DECL1OR2ARG:
            sprintf(buf, "'%s' must be defined with one or two parameters", 
                (char*)err->data);
            break;
        case ERR_SIZE_T_NEW:
            sprintf(buf, 
                "First parameter to 'operator new' must be type (size_t)");
            break;
        case ERR_VOIDSTAR_NEW:
            sprintf(buf, "return type of 'operator new' must be type (void *)");
            break;
        case ERR_VOIDSTAR_DELETE:
            sprintf(buf, "Parameter to 'operator delete' must be type (void *)")
                ;
            break;
        case ERR_VOID_DELETE:
            sprintf(buf, "'operator delete' cannot return a value");
            break;
        case ERR_OPMUSTBEMEMBER:
            sprintf(buf, "'%s' must be a member function", (char*)err->data);
            break;
        case ERR_POINTTOCLASS:
            sprintf(buf, "'%s' must return a pointer to a class", (char*)err
                ->data);
            break;
        case ERR_OVPOSTFIXINTLAST:
            sprintf(buf, 
                "overloaded postfix operator '%s' must have 'int' as type of last parameter", (char*)err->data);
            break;
        case ERR_NOREFARRAY:
            sprintf(buf, "Array of references not allowed");
            break;
        case ERR_AMBIGCONTEXT:
            sprintf(buf, "'%s' is ambiguous in this context", (char*)err->data);
            break;
        case ERR_WRONGMACROARGS:
            sprintf(buf, 
                "Wrong number of macro arguments in call to macro '%s'", (char*)
                err->data);
            break;
        case ERR_OBJECTNEEDED:
            sprintf(buf, "Object required to use member");
            break;
        case ERR_NOSTATIC:
            sprintf(buf, "Storage class 'static' is not allowed here");
            break;
        case ERR_ILLINIT:
            sprintf(buf, "Illegal initialization");
            break;
        case ERR_NOTUNAMBIGUOUSBASE:
            sprintf(buf, "'%s' is not an unambiguous base class of '%s'", (
                (char **)err->data)[0], ((char **)err->data)[1]);
            break;
        case ERR_NOINITSTATICMEMBER:
            sprintf(buf, 
                "'%s' is a static data member and cannot be initialized here", 
                (char*)err->data);
            break;
        case ERR_MEMBERREINIT:
            sprintf(buf, "Member '%s' is initialized more than once", (char*)
                err->data);
            break;
        case ERR_NEWARRAYINIT:
            sprintf(buf, "Array created with 'new' cannot have initializer");
            break;
        case ERR_VOIDFUNCNOVALUE:
            sprintf(buf, "Void functions cannot return a value");
            if (!prm_cplusplus && !prm_c99)
                errlvl++ ;
            break;
        case ERR_FRIENDMUSTCLASS:
            sprintf(buf, "Storage class 'friend' not allowed here");
            break;
        case ERR_FRIENDNEEDFUNC:
            sprintf(buf, 
                "Storage class 'friend' needs a function without a body");
            break;
        case ERR_FRIENDCLASSNEEDSTRUC:
            sprintf(buf, "Storage class 'friend class' needs a structure");
            break;
        case ERR_ADDRMEMORYLOC:
            sprintf(buf, "Must take the address of a memory location");
            break;
        case ERR_INVCONST:
            sprintf(buf, "Invalid constant value");
            break;
        case ERR_INVALIDTEMPLATE:
            sprintf(buf, "Invalid template declaration");
            break;
        case ERR_TEMPLATECLASSFUNC:
            sprintf(buf, "Template must declare a class or function");
            break;
        case ERR_TEMPLATEEOF:
            sprintf(buf, "End of file encountered in template");
            break;
        case ERR_DECLARATIONCOMMA:
            sprintf(buf, "Declaration missing ';'");
            break;
        case ERR_TEMPLATENOINSTANTIATION:
            sprintf(buf, "Cannot instantiate template here");
            break;
        case ERR_INCOMPATTYPECONV:
            sprintf(buf, "Incompatible type conversion");
            break;
        case ERR_TEMPLATEBODYDECLARED:
            sprintf(buf, "Body has already been defined for template '%s'", 
                (char*)err->data);
            break;
        case ERR_TEMPLATEEXTRAARG:
            sprintf(buf, "Extra argument in invocation of template '%s'", 
                (char*)err->data);
            break;
        case ERR_TEMPLATEFEWARG:
            sprintf(buf, "Too few argumens in invocation of template '%s'", 
                (char*)err->data);
            break;
        case ERR_ILLEGALNAMESPACEUSE:
            sprintf(buf, "Illegal use of namespace '%s'", (char*)err->data);
            break;
        case ERR_NOTNSORTYPQUAL:
            sprintf(buf, "'%s' is not a namespace or type qualifier", (char*)
                err->data);
            break;
        case ERR_INVALIDARGTOTYPEOF:
            sprintf(buf, "Invalid argument to typeof operator");
            break;
        case ERR_TEMPLATEFUNCMATCHCLASS:
            sprintf(buf, "Invalid template qualified name");
            break;
        case ERR_EXPMEMBERPTRFUNC:
            sprintf(buf, "Expected member pointer function declarator");
            break;
        case ERR_NOTPUBLICBASECLASS:
            sprintf(buf, "'%s' is not a public base class of '%s'", ((char **)
                err->data)[0], ((char **)err->data)[1]);
            break;
        case ERR_ALSOBASECLASS:
            sprintf(buf, "'%s' is also a base class of '%s'", ((char **)err
                ->data)[0], ((char **)err->data)[1]);
            break;
        case ERR_MEMBERSAMENAME:
            sprintf(buf, "Member '%s' has the same name as its base class", (
                (char*)err->data));
            break;
        case ERR_CONSTMUSTINIT:
            sprintf(buf, "Constant value needs initialization");
            break;
        case ERR_TYPENOVIRTFUNC:
            sprintf(buf, 
                "Type '%s' is not a defined class with virtual functions", 
                (char*)err->data);
            break;
        case ERR_NOXCEPT:
            sprintf(buf, "Exception/RTTI handling is disabled");
            break;
        case ERR_STRUCTEXP:
            sprintf(buf, "Structured type expected");
            break;
        case ERR_CATCHEXP:
            sprintf(buf, "'catch' expected");
            break;
        case ERR_ELLIPSEHANDLERLAST:
            sprintf(buf, "The '...' handler must be last");
            break;
        case ERR_DUPHANDLER:
            sprintf(buf, "Duplicate handler for '%s'", (char*)err->data);
            break;
        case ERR_CANTRESOLVE:
            sprintf(buf, "Cannot resolve function '%s'", (char*)err->data);
            break;
        case ERR_TYPEINFOUNDEF:
            sprintf(buf, "'typeinfo' is undefined");
            break;
        case ERR_DECLNOTALLOWED:
            sprintf(buf, "Variable declaration not allowed here");
            break;
        case ERR_OPERATORNOTDEFINED:
            sprintf(buf, "Could not find a match for operator");
            break;

        case ERR_REDECLDEFAULT:
            sprintf(buf, "Default parameter %s redeclared", (char*)err->data);
            break;
        case ERR_OBJMEMPTRREQ:
            sprintf(buf, "Object required to use member pointer %s", (char*)err
                ->data);
            break;
        case ERR_REDEFINE:
            sprintf(buf, "Redefinition of macro '%s' changes value", (char*)err
                ->data);
            if (!prm_ansi)
                errlvl++;
            break;
        case ERR_AMBIGTEMPLATE:
            sprintf(buf, "Cannot instantiate template '%s'", (char*)err->data);
            break;
        case ERR_SIMPLETEMPLATEARGS:
            sprintf(buf, 
                "Non-typed template arguments must be an unstructured type");
            break;
        case ERR_SPECIALIZATION:
            sprintf(buf, 
                "Template '%s' does not specialize an existing template", 
                (char*)err->data);
            break;
        case ERR_EXPLICITNOTALLOWED:
            sprintf(buf, "Storage class 'explicit' not allowed here");
            break;
        case ERR_NOEXPLICITHERE:
            sprintf(buf, "Explicit constructor cannot be used implicitly");
            break;
        case ERR_RETURNLOCAL:
            sprintf(buf, "Returning local object");
            errlvl += !prm_cplusplus;
            break;
        case ERR_REDEFTEMPLATEDEFAULTS:
            sprintf(buf, 
                "Redefinition of default values for template arguments");
            break;
        case ERR_TEMPLATEDEFAULTLIMITED:
            sprintf(buf, 
                "Default values may only be specified on primary class templates");
            break;
        case ERR_NEEDSPECIAL:
            sprintf(buf, "Cannot use template %s here without specializing", 
                (char*)err->data);
            break;
        case ERR_NEEDSTRING:
            sprintf(buf, "String constant required");
            break;
        case ERR_PARAMMISSINGNAME:
            sprintf(buf, "Parameter missing name");
            break;
        case ERR_VLABLOCKSCOPE:
            sprintf(buf, 
                "Variable Length Arrays must have block or parameter scope");
            break;
        case ERR_FLEXARRAYLAST:
            sprintf(buf, "Flexible Array must be last member of structure");
            break;
        case ERR_RESTRICTPTR:
            sprintf(buf, "'restrict' qualifier needs pointer");
            break;
        case ERR_MAINNOINLINE:
            sprintf(buf, "Cannot use inline specifier on 'main'");
            break;
        case ERR_INLINENOSTATIC:
            sprintf(buf, 
                "Cannot use non-const static members in inline functions");
            break;
        case ERR_VMSTATIC:
            sprintf(buf, 
                "Global pointers to variable length arrays must be 'static'");
            break;
        case ERR_VLAMUSTSIZE:
            sprintf(buf, 
                "Variable length array specifier must have explicit size except in prototypes");
            break;
        case ERR_DEFINEENUM:
            sprintf(buf, "Enumeration tag must be previously defined");
            break;
        case ERR_INLINEFUNC:
            sprintf(buf, "'inline' qualifier must be used with a function");
            break;
        case ERR_INLINENOBODY:
            sprintf(buf, "inline function %s used without a body",(char *)err->data);
            break;
        case ERR_ARRELEMSIZE:
            sprintf(buf,"Array element must be a complete type");
            break ;
        case ERR_SELECTSCALAR:
            sprintf(buf,"Controlling expression must be scalar");
            break;
        case ERR_VLAGOTO:
            sprintf(buf,"'goto' cannot bypass variable length array initialization");
            break;
        case ERR_FUNCBADRET:
            sprintf(buf,"Functions cannot return functions or arrays");
            break;
        case ERR_ILLUSEPTR:
            sprintf(buf,"Illegal use of pointer");
            break;
        case ERR_ILLPTRADD:
            sprintf(buf,"Illegal pointer addition");
            break;
        case ERR_INVPTRSUB:
            sprintf(buf,"Invalid pointer subtraction");
            break;
        case ERR_HASDEF:
            sprintf(buf,"Redefinition of switch default");
            break;
        case ERR_CASENOSWITCH:
            sprintf(buf,"case or default outside a switch statement");
            break;
		case ERR_DUPVIRTUAL:
			sprintf(buf,"virtual keyword specified more than once");
			break;
        default:
            sprintf(buf, "Error #%d", err->errornumber);
            break;
    }
    return errlvl;
}

//-------------------------------------------------------------------------

void lferror(void)
/*
 * sticck an error in the list file
 */
{
    char buf[256];
    while (curerr)
    {
        int errlvl = printerr(buf, curerr);
        if (!(errlvl &1))
        {
            if (prm_listfile)
                fprintf(listFile, "**** ERROR: %s\n", buf);
        }
        else if (prm_warning && (prm_extwarning || !(errlvl &2)))
        {
            if (prm_listfile)
                fprintf(listFile, "** WARNING: %s\n", buf);
        }
        curerr = curerr->link;
    }

}

//-------------------------------------------------------------------------

void basicskim(int *skimlist)
/*
 * simple skim for a token with no nesting
 */
{
    int i;
    while (TRUE)
    {
        if (lastst == eof)
            break;
        for (i = 0; skimlist[i]; i++)
        {
            if (lastst == skimlist[i])

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -