summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2017-10-31 13:58:31 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2017-10-31 14:52:34 +0900
commit1adb93b3e5ebee9ebc2c9d9a867d70099f27bbad (patch)
tree8442fd5bc4586c7108e7b2839c7b5cf76036ee5b /src
parent02206f252f51abd11ae60c61bb400401a909b605 (diff)
eolian: Skip @beta APIs for duplicate warnings
No warnings: export EOLIAN_WARN_FUNC_DUPLICATES=0 No beta warnings: export EOLIAN_WARN_FUNC_DUPLICATES=1 All warnings including beta: export EOLIAN_WARN_FUNC_DUPLICATES=2 EOLIAN_WARN_FUNC_DUPLICATES is not an API and may change in the future as we improve the tool :)
Diffstat (limited to 'src')
-rw-r--r--src/lib/eolian/database_validate.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/lib/eolian/database_validate.c b/src/lib/eolian/database_validate.c
index 28ffd5fe58..ed005edb3b 100644
--- a/src/lib/eolian/database_validate.c
+++ b/src/lib/eolian/database_validate.c
@@ -290,14 +290,22 @@ _validate_function(Eolian_Function *func, Eina_Hash *nhash)
290 Eolian_Function_Parameter *param; 290 Eolian_Function_Parameter *param;
291 char buf[512]; 291 char buf[512];
292 292
293 static int _duplicates_warn = -1;
294 if (EINA_UNLIKELY(_duplicates_warn < 0))
295 {
296 const char *s = getenv("EOLIAN_WARN_FUNC_DUPLICATES");
297 if (!s) _duplicates_warn = 0;
298 else _duplicates_warn = atoi(s);
299 }
300
293 const Eolian_Function *ofunc = eina_hash_find(nhash, func->name); 301 const Eolian_Function *ofunc = eina_hash_find(nhash, func->name);
294 if (ofunc) 302 if (EINA_UNLIKELY(ofunc && (_duplicates_warn > 0)))
295 { 303 {
296 snprintf(buf, sizeof(buf), 304 snprintf(buf, sizeof(buf),
297 "function '%s' redefined (originally at %s:%d:%d)", 305 "%sfunction '%s' redefined (originally at %s:%d:%d)",
298 func->name, ofunc->base.file, 306 func->is_beta ? "beta " : "", func->name, ofunc->base.file,
299 ofunc->base.line, ofunc->base.column); 307 ofunc->base.line, ofunc->base.column);
300 if (getenv("EOLIAN_WARN_FUNC_DUPLICATES")) 308 if (!func->is_beta || (_duplicates_warn > 1))
301 _obj_error(&func->base, buf); 309 _obj_error(&func->base, buf);
302 } 310 }
303 311