本文整理汇总了C++中reportError函数的典型用法代码示例。如果您正苦于以下问题:C++ reportError函数的具体用法?C++ reportError怎么用?C++ reportError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了reportError函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _int_14
void _int_14()
{
reportError("Interrupts", "Interrupt 14: #PF (Page Fault)", TRUE);
}
示例2: reportError
void CheckNullPointer::nullPointerDefaultArgError(const Token *tok, const std::string &varname)
{
reportError(tok, Severity::warning, "nullPointer", "Possible null pointer dereference if the default parameter value is used: " + varname);
}
示例3: reportError
void CheckCondition::badBitmaskCheckError(const Token *tok)
{
reportError(tok, Severity::warning, "badBitmaskCheck", "Result of operator '|' is always true if one operand is non-zero. Did you intend to use '&'?");
}
示例4: reportError
// }}}
// {{{ error mgnt
void FlowParser::reportUnexpectedToken()
{
reportError("Unexpected token '%s'", token().c_str());
}
示例5: reportError
void CheckAutoVariables::errorReturnTempReference(const Token *tok)
{
reportError(tok, Severity::error, "returnTempReference", "Reference to temporary returned.");
}
示例6: error
void error(std::error_code EC) {
if (!EC)
return;
reportError(EC.message());
}
示例7: main
//.........这里部分代码省略.........
cmd[ sizeof(cmd) - 1 ] = -1;
// Create args block for any command line parameters.
if( (argc - fileN) > 1 )
{
int i;
pos = str_copy( pos, "args: [" );
for( i = fileN + 1; i < argc; ++i )
{
*pos++ = '"';
pos = str_copy( pos, argv[i] );
*pos++ = '"';
*pos++ = ' ';
}
*pos++ = ']';
}
else
{
pos = str_copy( pos, "args: none " );
}
pos = str_copy( pos, "do load {" );
pos = str_copy( pos, argv[fileN] );
*pos++ = '}';
assert( cmd[ sizeof(cmd) - 1 ] == -1 && "cmd buffer overflow" );
if( ! boron_evalUtf8( ut, cmd, pos - cmd ) )
{
UCell* ex = ur_exception( ut );
if( ur_is(ex, UT_ERROR) )
{
OPEN_CONSOLE
reportError( ut, ex, &rstr );
goto prompt;
}
else if( ur_is(ex, UT_WORD) )
{
switch( ur_atom(ex) )
{
case UR_ATOM_QUIT:
goto quit;
case UR_ATOM_HALT:
goto prompt;
break;
}
}
}
}
else
{
OPEN_CONSOLE
printf( APPNAME " %s (%s)\n", UR_VERSION_STR, __DATE__ );
prompt:
while( 1 )
{
printf( ")> " );
fflush( stdout ); /* Required on Windows. */
fgets( cmd, sizeof(cmd), stdin );
#if 0
{
char* cp = cmd;
while( *cp != '\n' )
示例8: hostaddr_std
void IOSCfgParser::rule_std() {
try { // for error handling
{
hostaddr_std();
if ( inputState->guessing==0 ) {
#line 360 "iosacl.g"
importer->SaveTmpAddrToSrc(); *dbg << "(std) ";
#line 1505 "IOSCfgParser.cpp"
}
{
switch ( LA(1)) {
case LOG:
case LOG_INPUT:
{
log();
break;
}
case ANTLR_USE_NAMESPACE(antlr)Token::EOF_TYPE:
case NEWLINE:
case IP:
case QUIT:
case WORD:
case CERTIFICATE:
case IOSVERSION:
case HOSTNAME:
case ACCESS_LIST:
case VLAN:
case CONTROLLER:
case INTRFACE:
case DESCRIPTION:
case SHUTDOWN:
case EXIT:
case LINE_COMMENT:
{
break;
}
default:
{
throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
}
}
}
}
if ( inputState->guessing==0 ) {
#line 363 "iosacl.g"
*dbg << std::endl;
#line 1546 "IOSCfgParser.cpp"
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
if( inputState->guessing == 0 ) {
reportError(ex);
recover(ex,_tokenSet_2);
} else {
throw;
}
}
}
示例9: reportError
void CheckFunctions::mathfunctionCallWarning(const Token *tok, const std::string& oldexp, const std::string& newexp)
{
reportError(tok, Severity::style, "unpreciseMathCall", "Expression '" + oldexp + "' can be replaced by '" + newexp + "' to avoid loss of precision.");
}
示例10: ANTLR_USE_NAMESPACE
void IOSCfgParser::hostaddr_ext() {
ANTLR_USE_NAMESPACE(antlr)RefToken h = ANTLR_USE_NAMESPACE(antlr)nullToken;
ANTLR_USE_NAMESPACE(antlr)RefToken a = ANTLR_USE_NAMESPACE(antlr)nullToken;
ANTLR_USE_NAMESPACE(antlr)RefToken m = ANTLR_USE_NAMESPACE(antlr)nullToken;
try { // for error handling
switch ( LA(1)) {
case HOST:
{
{
match(HOST);
h = LT(1);
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 423 "iosacl.g"
importer->tmp_a = h->getText();
importer->tmp_nm = "0.0.0.0";
*dbg << h->getText() << "/0.0.0.0";
#line 1620 "IOSCfgParser.cpp"
}
break;
}
case IPV4:
{
{
a = LT(1);
match(IPV4);
m = LT(1);
match(IPV4);
}
if ( inputState->guessing==0 ) {
#line 430 "iosacl.g"
importer->tmp_a = a->getText();
importer->tmp_nm = m->getText();
*dbg << a->getText() << "/" << m->getText();
#line 1639 "IOSCfgParser.cpp"
}
break;
}
case ANY:
{
match(ANY);
if ( inputState->guessing==0 ) {
#line 437 "iosacl.g"
importer->tmp_a = "0.0.0.0";
importer->tmp_nm = "0.0.0.0";
*dbg << "0.0.0.0/0.0.0.0";
#line 1653 "IOSCfgParser.cpp"
}
break;
}
default:
{
throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());
}
}
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
if( inputState->guessing == 0 ) {
reportError(ex);
recover(ex,_tokenSet_8);
} else {
throw;
}
}
}
示例11: kin_getarray
static PyObject*
kin_getarray(PyObject *self, PyObject *args)
{
int kin;
int job;
if (!PyArg_ParseTuple(args, "ii:kin_getarray", &kin, &job))
return NULL;
// array attributes
int iok = -22;
size_t nrxns = kin_nReactions(kin);
size_t nsp = kin_nSpecies(kin);
size_t ix;
if (job < 45 || job >= 90) ix = nrxns; else ix = nsp;
#ifdef HAS_NUMPY
npy_intp nix = ix;
PyArrayObject* x = (PyArrayObject*)PyArray_SimpleNew(1, &nix, PyArray_DOUBLE);
#else
int nix = int(ix);
PyArrayObject* x =
(PyArrayObject*)PyArray_FromDims(1, &nix, PyArray_DOUBLE);
#endif
double* xd = (double*)x->data;
switch (job) {
case 10:
iok = kin_getFwdRatesOfProgress(kin, nrxns, xd);
break;
case 20:
iok = kin_getRevRatesOfProgress(kin, nrxns, xd);
break;
case 30:
iok = kin_getNetRatesOfProgress(kin, nrxns, xd);
break;
case 32:
iok = kin_getActivationEnergies(kin, nrxns, xd);
break;
case 34:
iok = kin_getFwdRateConstants(kin, nrxns, xd);
break;
case 35:
iok = kin_getRevRateConstants(kin, 1, nrxns, xd);
case 36:
iok = kin_getRevRateConstants(kin, 0, nrxns, xd);
break;
case 40:
iok = kin_getEquilibriumConstants(kin, nrxns, xd);
break;
case 50:
iok = kin_getCreationRates(kin, nsp, xd);
break;
case 60:
iok = kin_getDestructionRates(kin, nsp, xd);
break;
case 70:
iok = kin_getNetProductionRates(kin, nsp, xd);
break;
case 80:
iok = kin_getSourceTerms(kin, nsp, xd);
break;
case 90:
iok = kin_getDelta(kin, 0, nrxns, xd);
break;
case 91:
iok = kin_getDelta(kin, 1, nrxns, xd);
break;
case 92:
iok = kin_getDelta(kin, 2, nrxns, xd);
break;
case 93:
iok = kin_getDelta(kin, 3, nrxns, xd);
break;
case 94:
iok = kin_getDelta(kin, 4, nrxns, xd);
break;
case 95:
iok = kin_getDelta(kin, 5, nrxns, xd);
break;
default:
;
}
if (iok >= 0) {
return PyArray_Return(x);
}
else
return reportError(iok);
}
示例12: switch
void IOSCfgParser::cfgfile() {
try { // for error handling
{ // ( ... )+
int _cnt3=0;
for (;;) {
switch ( LA(1)) {
case LINE_COMMENT:
{
comment();
break;
}
case IOSVERSION:
{
version();
break;
}
case HOSTNAME:
{
hostname();
break;
}
case IP:
{
ip_commands();
break;
}
case INTRFACE:
{
intrface();
break;
}
case CONTROLLER:
{
controller();
break;
}
case VLAN:
{
vlan();
break;
}
case ACCESS_LIST:
{
access_list_commands();
break;
}
case EXIT:
{
exit();
break;
}
case DESCRIPTION:
{
description();
break;
}
case SHUTDOWN:
{
shutdown();
break;
}
case CERTIFICATE:
{
certificate();
break;
}
case QUIT:
{
quit();
break;
}
case WORD:
{
unknown_command();
break;
}
case NEWLINE:
{
match(NEWLINE);
break;
}
default:
{
if ( _cnt3>=1 ) { goto _loop3; } else {throw ANTLR_USE_NAMESPACE(antlr)NoViableAltException(LT(1), getFilename());}
}
}
_cnt3++;
}
_loop3:;
} // ( ... )+
}
catch (ANTLR_USE_NAMESPACE(antlr)RecognitionException& ex) {
if( inputState->guessing == 0 ) {
reportError(ex);
recover(ex,_tokenSet_0);
} else {
throw;
}
}
//.........这里部分代码省略.........
示例13: FNTRACE
std::unique_ptr<Stmt> FlowParser::callStmt()
{
// callStmt ::= NAME ['(' exprList ')' | exprList] (';' | LF)
// | NAME '=' expr [';' | LF]
// NAME may be a builtin-function, builtin-handler, handler-name, or variable.
FNTRACE();
FlowLocation loc(location());
std::string name = stringValue();
nextToken(); // IDENT
std::unique_ptr<Stmt> stmt;
Symbol* callee = scope()->lookup(name, Lookup::All);
if (!callee) {
// XXX assume that given symbol is a auto forward-declared handler.
callee = (Handler*) globalScope()->appendSymbol(std::make_unique<Handler>(name, loc));
}
bool callArgs = false;
switch (callee->type()) {
case Symbol::Variable: { // var '=' expr (';' | LF)
if (!consume(FlowToken::Assign))
return nullptr;
std::unique_ptr<Expr> value = expr();
if (!value)
return nullptr;
stmt = std::make_unique<AssignStmt>(static_cast<Variable*>(callee), std::move(value), loc.update(end()));
break;
}
case Symbol::BuiltinHandler:
case Symbol::BuiltinFunction:
stmt = std::make_unique<CallStmt>(loc, (Callable*) callee);
callArgs = true;
break;
case Symbol::Handler:
stmt = std::make_unique<CallStmt>(loc, (Callable*) callee);
break;
default:
break;
}
if (callArgs) {
CallStmt* callStmt = static_cast<CallStmt*>(stmt.get());
if (token() == FlowToken::RndOpen) {
nextToken();
ExprList args;
bool rv = listExpr(args);
consume(FlowToken::RndClose);
if (!rv) return nullptr;
callStmt->setArgs(std::move(args));
}
else if (lexer_->line() == loc.begin.line) {
ExprList args;
if (!listExpr(args))
return nullptr;
callStmt->setArgs(std::move(args));
}
// match call parameters
FlowVM::Signature sig;
sig.setName(name);
sig.setReturnType(callStmt->callee()->signature().returnType()); // XXX cheetah
std::vector<FlowType> argTypes;
for (const auto& arg: callStmt->args()) {
argTypes.push_back(arg->getType());
}
sig.setArgs(argTypes);
if (sig != callStmt->callee()->signature()) {
reportError("Callee parameter type signature mismatch: %s passed, but %s expected.\n",
sig.to_s().c_str(), callStmt->callee()->signature().to_s().c_str());
return nullptr;
}
}
switch (token()) {
case FlowToken::If:
case FlowToken::Unless:
return postscriptStmt(std::move(stmt));
case FlowToken::Semicolon:
// stmt ';'
nextToken();
stmt->location().update(end());
return stmt;
default:
if (stmt->location().end.line != lexer_->line())
return stmt;
reportUnexpectedToken();
return nullptr;
}
}
示例14: throw
void UpdateInstaller::run() throw ()
{
if (!m_script || !m_script->isValid())
{
reportError("Unable to read update script");
return;
}
if (m_installDir.empty())
{
reportError("No installation directory specified");
return;
}
std::string updaterPath;
try
{
updaterPath = ProcessUtils::currentProcessPath();
}
catch (const FileUtils::IOException&)
{
LOG(Error,"error reading process path with mode " + intToStr(m_mode));
reportError("Unable to determine path of updater");
return;
}
if (m_mode == Setup)
{
if (m_waitPid != 0)
{
LOG(Info,"Waiting for main app process to finish");
ProcessUtils::waitForProcess(m_waitPid);
}
std::list<std::string> args = updaterArgs();
args.push_back("--mode");
args.push_back("main");
args.push_back("--wait");
args.push_back(intToStr(ProcessUtils::currentProcessId()));
int installStatus = 0;
if (m_forceElevated || !checkAccess())
{
LOG(Info,"Insufficient rights to install app to " + m_installDir + " requesting elevation");
// start a copy of the updater with admin rights
installStatus = ProcessUtils::runElevated(updaterPath,args,AppInfo::name());
}
else
{
LOG(Info,"Sufficient rights to install app - restarting with same permissions");
installStatus = ProcessUtils::runSync(updaterPath,args);
}
if (installStatus == 0)
{
LOG(Info,"Update install completed");
}
else
{
LOG(Error,"Update install failed with status " + intToStr(installStatus));
}
// restart the main application - this is currently done
// regardless of whether the installation succeeds or not
restartMainApp();
// clean up files created by the updater
cleanup();
}
else if (m_mode == Main)
{
LOG(Info,"Starting update installation");
// the detailed error string returned by the OS
std::string error;
// the message to present to the user. This may be the same
// as 'error' or may be different if a more helpful suggestion
// can be made for a particular problem
std::string friendlyError;
try
{
LOG(Info,"Installing new and updated files");
installFiles();
LOG(Info,"Uninstalling removed files");
uninstallFiles();
LOG(Info,"Removing backups");
removeBackups();
postInstallUpdate();
}
catch (const FileUtils::IOException& exception)
{
error = exception.what();
friendlyError = friendlyErrorForError(exception);
}
catch (const std::string& genericError)
{
//.........这里部分代码省略.........
示例15: flowdevicemethods
void flowdevicemethods(int nlhs, mxArray* plhs[],
int nrhs, const mxArray* prhs[])
{
int m, iok = 0, n;
int job = getInt(prhs[1]);
int i = getInt(prhs[2]);
double r = Undef;
double v = Undef;
if (nrhs > 3) {
v = getDouble(prhs[3]);
}
// constructor
if (job == 0) {
n = flowdev_new(i);
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
double* h = mxGetPr(plhs[0]);
*h = double(n);
if (n < 0) {
reportError();
}
return;
}
// options that do not return a value
if (job < 20) {
switch (job) {
case 1:
iok = flowdev_del(i);
break;
case 2:
m = getInt(prhs[4]);
iok = flowdev_install(i, int(v), m);
break;
case 3:
iok = flowdev_setMassFlowRate(i, v);
break;
case 4:
iok = flowdev_setParameters(i, 1, &v);
break;
case 5:
iok = flowdev_setFunction(i, int(v));
break;
case 6:
iok = flowdev_ready(i);
break;
case 7:
iok = flowdev_setMaster(i, int(v));
break;
default:
mexErrMsgTxt("unknown job parameter");
}
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
double* h = mxGetPr(plhs[0]);
*h = double(iok);
if (iok < 0) {
reportError();
}
return;
}
// options that return a value of type 'double'
else if (job < 40) {
switch (job) {
case 21:
r = flowdev_massFlowRate(i, v);
break;
default:
mexErrMsgTxt("unknown job parameter");
}
plhs[0] = mxCreateNumericMatrix(1,1,mxDOUBLE_CLASS,mxREAL);
double* h = mxGetPr(plhs[0]);
*h = r;
if (r == Undef) {
reportError();
}
return;
}
}