forked from enlightenment/efl
eolian: strict validation for EFL (errors by default)
This commit is contained in:
parent
8c1933c388
commit
21a2a8007d
|
@ -15,21 +15,21 @@ SUFFIXES = .eo .eo.c .eo.h .eo.legacy.h .eot .eot.h
|
||||||
%.eo.c: %.eo ${_EOLIAN_GEN_DEP}
|
%.eo.c: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
$(AM_V_EOL) \
|
$(AM_V_EOL) \
|
||||||
$(MKDIR_P) $(dir $@); \
|
$(MKDIR_P) $(dir $@); \
|
||||||
$(EOLIAN_GEN) --legacy --silent-types $(EOLIAN_FLAGS) --gc -o $@ $<
|
EOLIAN_VALIDATE_STRICT=1 $(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gc -o $@ $<
|
||||||
|
|
||||||
%.eo.h: %.eo ${_EOLIAN_GEN_DEP}
|
%.eo.h: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
$(AM_V_EOL) \
|
$(AM_V_EOL) \
|
||||||
$(MKDIR_P) $(dir $@); \
|
$(MKDIR_P) $(dir $@); \
|
||||||
EOLIAN_VERBOSE_TYPES=1 $(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o $@ $<
|
EOLIAN_VALIDATE_STRICT=1 $(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||||
|
|
||||||
%.eot.h: %.eot ${_EOLIAN_GEN_DEP}
|
%.eot.h: %.eot ${_EOLIAN_GEN_DEP}
|
||||||
$(AM_V_EOL) \
|
$(AM_V_EOL) \
|
||||||
$(MKDIR_P) $(dir $@); \
|
$(MKDIR_P) $(dir $@); \
|
||||||
EOLIAN_VERBOSE_TYPES=1 $(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o $@ $<
|
EOLIAN_VALIDATE_STRICT=1 $(EOLIAN_GEN) $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||||
|
|
||||||
%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
|
%.eo.legacy.h: %.eo ${_EOLIAN_GEN_DEP}
|
||||||
$(AM_V_EOL) \
|
$(AM_V_EOL) \
|
||||||
$(MKDIR_P) $(dir $@); \
|
$(MKDIR_P) $(dir $@); \
|
||||||
$(EOLIAN_GEN) --legacy --silent-types $(EOLIAN_FLAGS) --gh -o $@ $<
|
EOLIAN_VALIDATE_STRICT=1 $(EOLIAN_GEN) --legacy $(EOLIAN_FLAGS) --gh -o $@ $<
|
||||||
|
|
||||||
CLEANFILES += $(BUILT_SOURCES)
|
CLEANFILES += $(BUILT_SOURCES)
|
||||||
|
|
|
@ -174,9 +174,10 @@ _ef_map_cb(const Eina_Hash *hash EINA_UNUSED, const void *key EINA_UNUSED,
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
_type_error(const Validator *vs, const Eolian_Type *tp, const char *msg)
|
_type_error(const Validator *vs, const Eolian_Type *tp, const char *msg)
|
||||||
{
|
{
|
||||||
|
Eina_Bool weak = !getenv("EOLIAN_VALIDATE_STRICT");
|
||||||
if (vs->silent_types)
|
if (vs->silent_types)
|
||||||
return EINA_FALSE;
|
return weak;
|
||||||
if (getenv("EOLIAN_VERBOSE_TYPES"))
|
if (!weak)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "eolian:%s:%d:%d: %s\n", tp->base.file, tp->base.line,
|
fprintf(stderr, "eolian:%s:%d:%d: %s\n", tp->base.file, tp->base.line,
|
||||||
tp->base.column, msg);
|
tp->base.column, msg);
|
||||||
|
@ -184,7 +185,7 @@ _type_error(const Validator *vs, const Eolian_Type *tp, const char *msg)
|
||||||
}
|
}
|
||||||
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_WARN, tp->base.file, "",
|
eina_log_print(_eolian_log_dom, EINA_LOG_LEVEL_WARN, tp->base.file, "",
|
||||||
tp->base.line, "%s at column %d", msg, tp->base.column);
|
tp->base.line, "%s at column %d", msg, tp->base.column);
|
||||||
return EINA_FALSE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Eina_Bool
|
static Eina_Bool
|
||||||
|
@ -212,8 +213,7 @@ _validate_type(const Validator *vs, const Eolian_Type *tp)
|
||||||
{
|
{
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
|
snprintf(buf, sizeof(buf), "undefined type %s", tp->full_name);
|
||||||
_type_error(vs, tp, buf);
|
return _type_error(vs, tp, buf);
|
||||||
return EINA_TRUE; /* for now only warn */
|
|
||||||
}
|
}
|
||||||
return _validate_type(vs, tpp);
|
return _validate_type(vs, tpp);
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ _validate_type(const Validator *vs, const Eolian_Type *tp)
|
||||||
char buf[256];
|
char buf[256];
|
||||||
snprintf(buf, sizeof(buf), "undefined class %s "
|
snprintf(buf, sizeof(buf), "undefined class %s "
|
||||||
"(likely wrong namespacing)", tp->full_name);
|
"(likely wrong namespacing)", tp->full_name);
|
||||||
_type_error(vs, tp, buf);
|
return _type_error(vs, tp, buf);
|
||||||
}
|
}
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue