eolian: use fprintf(stderr) rather than eina_log for compile errors

This commit is contained in:
Daniel Kolesa 2015-05-14 16:33:09 +01:00
parent 066ca5ffdd
commit e0fe487856
7 changed files with 23 additions and 59 deletions

View File

@ -136,7 +136,7 @@ eolian_class_function_get_by_name(const Eolian_Class *cl, const char *func_name,
}
}
ERR("Function %s not found in class %s", func_name, cl->name);
fprintf(stderr, "eolian: function '%s' not found in class '%s'\n", func_name, cl->name);
return NULL;
}

View File

@ -10,8 +10,7 @@
static Eina_Bool
node_error(const Eolian_Object *obj, const char *msg)
{
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_ERR, obj->file, "",
obj->line, "%s at column %d", msg, obj->column);
fprintf(stderr, "eolian:%s:%d:%d: %s\n", obj->file, obj->line, obj->column, msg);
return EINA_FALSE;
}

View File

@ -7,11 +7,10 @@
static Eina_Bool
_func_error(Eolian_Class *cl, Eolian_Implement *impl)
{
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_ERR, impl->base.file, "",
impl->base.line, "%s%s not known in class %s at column %d",
impl->full_name, (impl->is_prop_get ? ".get"
: (impl->is_prop_set ? ".set" : "")),
eolian_class_name_get(cl), impl->base.column);
fprintf(stderr, "eolian:%s:%d:%d: '%s%s' not known in class '%s'\n",
impl->base.file, impl->base.line, impl->base.column, impl->full_name,
(impl->is_prop_get ? ".get" : (impl->is_prop_set ? ".set" : "")),
eolian_class_name_get(cl));
return EINA_FALSE;
}
@ -218,7 +217,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
Eo_Lexer *ls = eo_lexer_new(filename);
if (!ls)
{
ERR("unable to create lexer for file %s", filename);
fprintf(stderr, "eolian: unable to create lexer for file '%s'\n", filename);
return EINA_FALSE;
}
@ -235,7 +234,7 @@ eo_parser_database_fill(const char *filename, Eina_Bool eot)
if (!eina_list_count(ls->tmp.classes))
{
ERR("No classes for file %s", filename);
fprintf(stderr, "eolian: no classes for file '%s'\n", filename);
eo_lexer_free(ls);
return EINA_FALSE;
}

View File

@ -74,9 +74,8 @@ eolian_implement_function_get(const Eolian_Implement *impl,
if (fid && tp == EOLIAN_UNRESOLVED && (fid->type == EOLIAN_PROP_GET
|| fid->type == EOLIAN_PROP_SET))
{
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_ERR,
impl->base.file, "", impl->base.line, "both get and set required "
"for property '%s' at column %d", func_name, impl->base.column);
fprintf(stderr, "eolian:%s:%d:%d: both get and set required for property '%s'\n",
impl->base.file, impl->base.line, impl->base.column, func_name);
return NULL;
}

View File

@ -11,8 +11,6 @@
#include "eo_lexer.h"
int _eo_lexer_log_dom = -1;
static int lastbytes = 0;
static void
@ -101,8 +99,8 @@ throw(Eo_Lexer *ls, const char *fmt, ...)
for (i = 0; i < ls->column; ++i)
eina_strbuf_append_char(buf, ' ');
eina_strbuf_append(buf, "^\n");
eina_log_print(_eo_lexer_log_dom, EINA_LOG_LEVEL_ERR, ls->source, "",
ls->line_number, "%s", eina_strbuf_string_get(buf));
fprintf(stderr, "eolian:%s:%d: %s\n", ls->source, ls->line_number,
eina_strbuf_string_get(buf));
eina_strbuf_free(buf);
longjmp(ls->err_jmp, EINA_TRUE);
}
@ -649,7 +647,7 @@ eo_lexer_set_input(Eo_Lexer *ls, const char *source)
Eina_File *f = eina_file_open(source, EINA_FALSE);
if (!f)
{
ERR("%s", strerror(errno));
fprintf(stderr, "eolian: %s\n", strerror(errno));
longjmp(ls->err_jmp, EINA_TRUE);
}
ls->lookahead.token = -1;
@ -837,8 +835,6 @@ eo_lexer_init()
{
eina_init();
init_hash();
eina_log_color_disable_set(EINA_FALSE);
_eo_lexer_log_dom = eina_log_domain_register("eo_lexer", EINA_COLOR_CYAN);
}
return _init_counter++;
}
@ -850,8 +846,6 @@ eo_lexer_shutdown()
_init_counter--;
if (!_init_counter)
{
eina_log_domain_unregister(_eo_lexer_log_dom);
_eo_lexer_log_dom = -1;
destroy_hash();
eina_shutdown();
}

View File

@ -186,33 +186,4 @@ void eo_lexer_context_pop (Eo_Lexer *ls);
void eo_lexer_context_restore(Eo_Lexer *ls);
void eo_lexer_context_clear (Eo_Lexer *ls);
extern int _eo_lexer_log_dom;
#ifdef CRITICAL
#undef CRITICAL
#endif
#define CRITICAL(...) EINA_LOG_DOM_CRIT(_eo_lexer_log_dom, __VA_ARGS__)
#ifdef ERR
#undef ERR
#endif
#define ERR(...) EINA_LOG_DOM_ERR(_eo_lexer_log_dom, __VA_ARGS__)
#ifdef WRN
#undef WRN
#endif
#define WRN(...) EINA_LOG_DOM_WARN(_eo_lexer_log_dom, __VA_ARGS__)
#define INF_ENABLED EINA_FALSE
#ifdef INF
#undef INF
#endif
#define INF(...) if (INF_ENABLED) EINA_LOG_DOM_INFO(_eo_lexer_log_dom, __VA_ARGS__)
#define DBG_ENABLED EINA_FALSE
#ifdef DBG
#undef DBG
#endif
#define DBG(...) if (DBG_ENABLED) EINA_LOG_DOM_DBG(_eo_lexer_log_dom, __VA_ARGS__)
#endif /* __EO_LEXER_H__ */

View File

@ -185,7 +185,7 @@ database_class_name_validate(const char *class_name, const Eolian_Class **cl)
{
if (found_class)
{
ERR("Name clash between class %s and class %s",
fprintf(stderr, "eolian: name clash between classes '%s' and '%s'\n",
candidate->full_name,
found_class->full_name);
free(name);
@ -238,7 +238,7 @@ eolian_eo_file_parse(const char *filepath)
class = eolian_class_get_by_file(bfilename);
if (!class)
{
ERR("No class for file %s", bfilename);
fprintf(stderr, "eolian: no class for file '%s'\n", bfilename);
free(bfiledup);
goto error;
}
@ -255,9 +255,8 @@ eolian_eo_file_parse(const char *filepath)
if (!eolian_class_get_by_name(dep->name) &&
!eolian_eo_file_parse(dep->filename))
{
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_ERR,
dep->base.file, "", dep->base.line, "failed to parse "
"dependency '%s' at column %d", dep->name, dep->base.column);
fprintf(stderr, "eolian:%s:%d:%d: failed to parse dependency '%s'\n",
dep->base.file, dep->base.line, dep->base.column, dep->name);
failed_dep = EINA_TRUE; /* do not parse anymore stuff */
}
free:
@ -280,7 +279,8 @@ inherits:
free(filename);
if (!filepath)
{
ERR("Unable to find a file for class %s", inherit_name);
fprintf(stderr, "eolian: unable to find a file for class '%s'\n",
inherit_name);
goto error;
}
if (!eolian_eo_file_parse(filepath)) goto error;
@ -294,7 +294,8 @@ inherits:
const Eolian_Function *impl_func = eolian_implement_function_get(impl, &impl_type);
if (!impl_func)
{
ERR("Unable to find function %s", eolian_implement_full_name_get(impl));
fprintf(stderr, "eolian: unable to find function '%s'\n",
eolian_implement_full_name_get(impl));
goto error;
}
else
@ -307,7 +308,8 @@ inherits:
const Eolian_Function *ctor_func = eolian_constructor_function_get(ctor);
if (!ctor_func)
{
ERR("Unable to find function %s", eolian_constructor_full_name_get(ctor));
fprintf(stderr, "eolian: unable to find function '%s'\n",
eolian_constructor_full_name_get(ctor));
goto error;
}
else