utl_err.cpp

来自「这是广泛使用的通信开源项目,对于大容量,高并发的通讯要求完全能够胜任,他广泛可用」· C++ 代码 · 共 1,310 行 · 第 1/4 页

CPP
1,310
字号
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::error3 (UTL_Error::ErrorCode c,
                   AST_Decl *d1,
                   AST_Decl *d2,
                   AST_Decl *d3)
{
  idl_error_header (c,
                    idl_global->lineno (),
                    idl_global->filename ());
  d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              ", "));
  d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              ", "));
  d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::warning0 (UTL_Error::ErrorCode c)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (c,
                        idl_global->lineno (),
                        idl_global->filename ());
      ACE_ERROR ((LM_ERROR,
                  "\n"));
    }
}

void
UTL_Error::warning1 (UTL_Error::ErrorCode c,
                     AST_Decl *d)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (c,
                        idl_global->lineno (),
                        idl_global->filename ());
      d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  "\n"));
    }
}

void
UTL_Error::warning2 (UTL_Error::ErrorCode c,
                     AST_Decl *d1,
                     AST_Decl *d2)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (c,
                        idl_global->lineno (),
                        idl_global->filename ());
      d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  ", "));
      d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  "\n"));
    }
}

void
UTL_Error::warning3 (UTL_Error::ErrorCode c,
                     AST_Decl *d1,
                     AST_Decl *d2,
                     AST_Decl *d3)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (c,
                        idl_global->lineno (),
                        idl_global->filename ());
      d1->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  ", "));
      d2->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  ", "));
      d3->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
      ACE_ERROR ((LM_ERROR,
                  "\n"));
    }
}

// Report a failed coercion attempt.
void
UTL_Error::coercion_error (AST_Expression *v,
                           AST_Expression::ExprType t)
{
  idl_error_header (EIDL_COERCION_FAILURE,
                    v->line (),
                    v->file_name ());
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " to %s\n",
              exprtype_to_string (t)));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a failed name lookup attempt.
void
UTL_Error::lookup_error (UTL_ScopedName *n)
{
  idl_error_header (EIDL_LOOKUP_ERROR,
                    idl_global->lineno (),
                    idl_global->filename ());
  n->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an illegal version number assignment.
void
UTL_Error::version_number_error (char *n)
{
  idl_error_header (EIDL_ILLEGAL_VERSION,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "%s\n",
              n));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an attempt to set the version a second time.
void
UTL_Error::version_reset_error (void)
{
  idl_error_header (EIDL_VERSION_RESET,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a reset of the id a second time to a different string.
void
UTL_Error::id_reset_error (char *o,
                           char *n)
{
  idl_error_header (EIDL_ID_RESET,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "%s, %s\n",
              o,
              n));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an attempt to inherit from an interface which was only
// declared forward but not yet defined.
void
UTL_Error::inheritance_fwd_error (UTL_ScopedName *n,
                                  AST_Interface *f)
{
  idl_error_header (EIDL_INHERIT_FWD_ERROR,
                    f->line (),
                    f->file_name ());
  ACE_ERROR ((LM_ERROR,
              "interface "));
  n->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " cannot inherit from forward declared interface "));
  f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an attempt to inherit from something other than an interface.
void
UTL_Error::inheritance_error (UTL_ScopedName *n,
                              AST_Decl *d)
{
  idl_error_header (EIDL_CANT_INHERIT,
                    idl_global->lineno (),
                    idl_global->filename ());
  n->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              " attempts to inherit from "));
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an attempt to support an interface which was only
// declared forward but not yet defined.
void
UTL_Error::supports_fwd_error (UTL_ScopedName *n,
                               AST_Interface *f)
{
  idl_error_header (EIDL_SUPPORTS_FWD_ERROR,
                    f->line (),
                    f->file_name ());
  ACE_ERROR ((LM_ERROR,
              "interface "));
  n->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " cannot support forward declared interface "));
  f->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an attempt to support something other than an interface.
void
UTL_Error::supports_error (UTL_ScopedName *n,
                           AST_Decl *d)
{
  idl_error_header (EIDL_CANT_SUPPORT,
                    idl_global->lineno (),
                    idl_global->filename ());
  n->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " attempts to support "));
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report illegal inheritance from non-abstract valuetype or interface.
void
UTL_Error::abstract_inheritance_error (UTL_ScopedName *v,
                                       UTL_ScopedName *i)
{
  idl_error_header (EIDL_CANT_INHERIT,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              " abstract valuetype "));
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " attempts to inherit from nonabstract type: "));
  i->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report illegal support of non-abstract interface.
void
UTL_Error::abstract_support_error (UTL_ScopedName *v,
                                   UTL_ScopedName *i)
{
  idl_error_header (EIDL_CANT_SUPPORT,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              " valuetype "));
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " attempts to support more than one concrete type: "));
  i->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::concrete_supported_inheritance_error (UTL_ScopedName *v,
                                                 UTL_ScopedName *i)
{
  idl_error_header (EIDL_CANT_SUPPORT,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              " valuetype "));
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " supports concrete interface that does not inherit from"
              " all ancestors of valuetype's ancestor's concrete supported"
              " interface: "));
  i->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an error while evaluating an expression.
void
UTL_Error::eval_error (AST_Expression *v)
{
  idl_error_header (EIDL_EVAL_ERROR,
                    v->line (),
                    v->file_name ());
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report an error while evaluating an expression.
void
UTL_Error::incompatible_type_error (AST_Expression *v)
{
  idl_error_header (EIDL_INCOMPATIBLE_TYPE,
                    idl_global->lineno (),
                    idl_global->filename ());
  v->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where a constant was expected but we
// got something else. This may occur in a union when a label
// evaluates to a non-constant.
void
UTL_Error::constant_expected (UTL_ScopedName *n,
                              AST_Decl *d)
{

⌨️ 快捷键说明

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