utl_err.cpp

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

CPP
1,310
字号
  idl_error_header (EIDL_CONSTANT_EXPECTED,
                    d->line (),
                    d->file_name ());
  n->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              " bound to "));
  d->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an interface was expected but we got
// something else instead. This most likely is a case in a supports
// or inheritance list.
void 
UTL_Error::interface_expected (AST_Decl *d)
{
  idl_error_header (EIDL_INTERFACE_EXPECTED,
                    idl_global->lineno (),
                    idl_global->filename ());
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an value type was expected but we got
// something else instead. This most likely is a case in a primary
// key, emits, publishes or consumes declaration.
void 
UTL_Error::valuetype_expected (AST_Decl *d)
{
  idl_error_header (EIDL_VALUETYPE_EXPECTED,
                    idl_global->lineno (),
                    idl_global->filename ());
  d->name ()->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 concrete value type was expected but we got
// something else instead. This most likely is a case where a valuetype
// inherits from something other than a concrete valuetype.
void 
UTL_Error::concrete_valuetype_expected (AST_Decl *d)
{
  idl_error_header (EIDL_CONCRETE_VT_EXPECTED,
                    idl_global->lineno (),
                    idl_global->filename ());
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an abstract type was expected but we got
// something else instead. This is the case in an inheritance
// list where a concrete type appears after an abstract type, or
// where a valuetype inherits more than one concrete valuetype.
void 
UTL_Error::abstract_expected (AST_Decl *d)
{
  idl_error_header (EIDL_ABSTRACT_EXPECTED,
                    idl_global->lineno (),
                    idl_global->filename ());
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an abstract type was expected but we got
// something else instead. This is the case in an inheritance
// list where a concrete type appears after an abstract type, or
// where a valuetype inherits more than one concrete valuetype.
void 
UTL_Error::eventtype_expected (AST_Decl *d)
{
  idl_error_header (EIDL_EVENTTYPE_EXPECTED,
                    idl_global->lineno (),
                    idl_global->filename ());
  d->name ()->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 valuetype used as a primary key for a
// component home does not inherit directly or indirectly from
// Components::primaryKeyBase.
void 
UTL_Error::primary_key_error (AST_Decl *d)
{
  idl_error_header (EIDL_PRIMARY_KEY_ERROR,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "primary key "));
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "does not have Components::primaryKeyBase as an ancestor\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an enumerator was expected but we
// got something else. This may occur in a union with an enum
// discriminator where a label did not evaluate to a constant
// enumerator.
void
UTL_Error::enum_val_expected (AST_Union *u,
                              AST_UnionLabel *l)
{
  idl_error_header (EIDL_ENUM_VAL_EXPECTED,
                    u->line (),
                    u->file_name ());
  ACE_ERROR ((LM_ERROR,
              " union %s, ",
              u->local_name ()->get_string ()));
  l->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a situation where an enumerator was received but we
// could not find it (by name) in an enum. This occurs when
// a union with an enum discriminator is being parsed, and a
// label evaluates to an enumerator which is not a member of
// the enum discriminator type.
void
UTL_Error::enum_val_lookup_failure (AST_Union *u,
                                    AST_Enum *e,
                                    UTL_ScopedName *n)
{
  idl_error_header (EIDL_ENUM_VAL_NOT_FOUND,
                    u->line (),
                    u->file_name ());
  ACE_ERROR ((LM_ERROR,
              " union %s,  enum %s,  enumerator ",
              u->local_name ()->get_string (),
              e->local_name ()->get_string ()));
  n->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report clash between declared and referenced indentifiers.
void
UTL_Error::redef_error (char *b,
                        char *n)
{
  idl_error_header (EIDL_REDEF,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "\"%s\" and \"%s\"\n",
              b,
              n));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report two or more spellings for an identifier.
void
UTL_Error::name_case_error (char *b,
                            char *n)
{
  idl_error_header (EIDL_NAME_CASE_ERROR,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "\"%s\" and \"%s\"\n",
              b,
              n));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::name_case_warning (char *b,
                              char *n)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (EIDL_NAME_CASE_WARNING,
                        idl_global->lineno (),
                        idl_global->filename ());
      ACE_ERROR ((LM_ERROR,
                  "\"%s\" and \"%s\"\n",
                  b,
                  n));
    }
}

void
UTL_Error::idl_keyword_error (char *n)
{
  idl_error_header (EIDL_KEYWORD_ERROR,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "\"%s\"\n",
              n));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::idl_keyword_warning (char *n)
{
  if (! (idl_global->compile_flags () & IDL_CF_NOWARNINGS))
    {
      idl_error_header (EIDL_KEYWORD_WARNING,
                        idl_global->lineno (),
                        idl_global->filename ());
      ACE_ERROR ((LM_ERROR,
                  "\"%s\"\n",
                  n));
    }
}

// Report an ambiguous definition of a name.
void
UTL_Error::ambiguous (UTL_Scope *s,
                      AST_Decl *l,
                      AST_Decl *d)
{
  idl_error_header (EIDL_AMBIGUOUS,
                    d->line (),
                    d->file_name ());
  ACE_ERROR ((LM_ERROR,
              " scope: %s,  collision: ",
              (ScopeAsDecl (s))->local_name ()->get_string ()));
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              " vs. "));
  l->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a forward declared interface which was never defined.
void
UTL_Error::fwd_decl_not_defined (AST_Type *d)
{
  idl_error_header (EIDL_DECL_NOT_DEFINED,
                    d->line (),
                    d->file_name ());
  ACE_ERROR ((LM_ERROR,
              "interface "));
  d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report lookup in undefined forward declared but undefined interface.
void
UTL_Error::fwd_decl_lookup (AST_Interface *d,
                            UTL_ScopedName *n)
{
  idl_error_header (EIDL_FWD_DECL_LOOKUP,
                    idl_global->lineno (),
                    idl_global->filename ());
  ACE_ERROR ((LM_ERROR,
              "trying to look up "));
  n->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              " in undefined forward declared interface "));
  d->local_name ()->dump (*ACE_DEFAULT_LOG_STREAM);
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report a redefinition inside its own scope.
void
UTL_Error::redefinition_in_scope (AST_Decl *d,
                                  AST_Decl *s)
{
  idl_error_header (EIDL_REDEF_SCOPE,
                    d->line (),
                    d->file_name ());
  d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              ", "));
  s->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

// Report not a type error.
void
UTL_Error::not_a_type (AST_Decl *d)
{
  idl_error_header (EIDL_NOT_A_TYPE,
                    idl_global->lineno (),
                    idl_global->filename ());
  if (d == 0 || d->name () == 0)
    {
      ACE_ERROR ((LM_ERROR,
                  "unknown symbol"));
    }
  else
    {
      d->name ()->dump (*ACE_DEFAULT_LOG_STREAM);;
    }

  ACE_ERROR ((LM_ERROR,
              "\n"));
  idl_global->set_err_count (idl_global->err_count () + 1);
}

void
UTL_Error::back_end (long lineno,
                     UTL_String *s)
{
  idl_error_header (EIDL_BACK_END,
                    lineno,
                    s);
  idl_global->set_err_count (idl_global->err_count () + 1);
}

⌨️ 快捷键说明

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