diff options
author | Eugene Tarassov | 2020-11-23 02:38:17 +0000 |
---|---|---|
committer | Eugene Tarassov | 2020-11-23 02:38:17 +0000 |
commit | 5aa3cebbdbf837cfc97a507409c3c2ef8f0362d4 (patch) | |
tree | 1b12c8cab8d4a58dee45fd1be109f968e114ef69 | |
parent | 0b8fbdf9a6a54cfe461c1edca7e2845b8e031bf1 (diff) | |
download | org.eclipse.tcf.agent-5aa3cebbdbf837cfc97a507409c3c2ef8f0362d4.tar.gz org.eclipse.tcf.agent-5aa3cebbdbf837cfc97a507409c3c2ef8f0362d4.tar.xz org.eclipse.tcf.agent-5aa3cebbdbf837cfc97a507409c3c2ef8f0362d4.zip |
Fixed build error when some (but not all) files are compiled with NDEBUG
-rw-r--r-- | agent/tcf/framework/cache.c | 18 | ||||
-rw-r--r-- | agent/tcf/framework/cache.h | 3 | ||||
-rw-r--r-- | agent/tcf/framework/errors.c | 2 | ||||
-rw-r--r-- | agent/tcf/framework/errors.h | 3 |
4 files changed, 17 insertions, 9 deletions
diff --git a/agent/tcf/framework/cache.c b/agent/tcf/framework/cache.c index 62fb03dc..bd268a39 100644 --- a/agent/tcf/framework/cache.c +++ b/agent/tcf/framework/cache.c @@ -174,16 +174,25 @@ void cache_exit(void) { } #ifdef NDEBUG + void cache_wait(AbstractCache * cache) { + if (current_client.client != NULL) { + current_cache = cache; + cache_miss_cnt++; + } + exception(ERR_CACHE_MISS); +} + #else + +void (cache_wait)(AbstractCache * cache) { cache_wait(cache); } + void cache_wait_dbg(const char * file, int line, AbstractCache * cache) { -#endif assert(is_dispatch_thread()); assert(current_client.client != NULL); if (current_client.client != NULL) { current_cache = cache; cache_miss_cnt++; -#ifndef NDEBUG current_client.file = file; current_client.line = line; current_client.time_stamp = time(NULL); @@ -191,16 +200,15 @@ void cache_wait_dbg(const char * file, int line, AbstractCache * cache) { post_event_with_delay(cache_timer, NULL, 5000000); cache_timer_posted = 1; } -#endif } -#ifndef NDEBUG else { trace(LOG_ALWAYS, "Illegal cache access at %s:%d", file, line); } -#endif exception(ERR_CACHE_MISS); } +#endif + void cache_notify(AbstractCache * cache) { unsigned i; unsigned cnt = cache->wait_list_cnt; diff --git a/agent/tcf/framework/cache.h b/agent/tcf/framework/cache.h index 590f6888..4f389241 100644 --- a/agent/tcf/framework/cache.h +++ b/agent/tcf/framework/cache.h @@ -133,9 +133,8 @@ extern void cache_exit(void); * Cache data handling code call cache_wait() to suspend current client * until cache validation is done. */ -#ifdef NDEBUG extern void cache_wait(AbstractCache * cache); -#else +#ifndef NDEBUG #define cache_wait(cache) cache_wait_dbg(__FILE__, __LINE__, cache) extern void cache_wait_dbg(const char * file, int line, AbstractCache * cache); #endif diff --git a/agent/tcf/framework/errors.c b/agent/tcf/framework/errors.c index ddee358c..641346cd 100644 --- a/agent/tcf/framework/errors.c +++ b/agent/tcf/framework/errors.c @@ -657,6 +657,8 @@ void check_error(int error) { #else /* NDEBUG */ +void (check_error)(int error) { check_error(error); } + void check_error_debug(const char * file, int line, int error) { if (error == 0) return; #if ENABLE_Trace diff --git a/agent/tcf/framework/errors.h b/agent/tcf/framework/errors.h index b7030886..f8e73a76 100644 --- a/agent/tcf/framework/errors.h +++ b/agent/tcf/framework/errors.h @@ -163,9 +163,8 @@ extern void release_error_report(ErrorReport * report); * check_error(): Check error code. * If the code is not zero, add error report into trace log and call exit(1) */ -#ifdef NDEBUG extern void check_error(int error); -#else +#ifndef NDEBUG extern void check_error_debug(const char * file, int line, int error); #define check_error(error) check_error_debug(__FILE__, __LINE__, error) #endif |