diff options
author | Ivan Maidanski <ivmai@mail.ru> | 2018-11-13 11:02:49 +0300 |
---|---|---|
committer | Ivan Maidanski <ivmai@mail.ru> | 2018-11-13 11:02:49 +0300 |
commit | eb81ab1b1c543f6f37cbb46a676a9549096ecc47 (patch) | |
tree | f83613daa7a7ec687f39411a244c482f0d722262 | |
parent | 077a359bfcde6b24f598df6d876a51f4e58a5cd1 (diff) | |
download | bdwgc-eb81ab1b1c543f6f37cbb46a676a9549096ecc47.tar.gz |
Workaround 'local address assignment to a global variable' CSA warning
* include/gc.h [(!__GNUC__ || __INTEL_COMPILER) && LINT2]
(GC_reachable_here): Transform ptr in the same way as COVERT_DATAFLOW()
does.
* mach_dep.c (GC_with_callee_saves_pushed): Transform the argument of
GC_noop1() by COVERT_DATAFLOW().
* misc.c [!ASM_CLEAR_CODE] (GC_clear_stack_inner): Likewise.
* misc.c (GC_call_with_stack_base, GC_call_with_gc_active): Likewise.
* pthread_support.c (GC_call_with_gc_active): Likewise.
* win32_threads.c (GC_call_with_gc_active): Likewise.
* misc.c (GC_call_with_gc_active): Transform &stacksect by
COVERT_DATAFLOW() when storing to GC_stackbottom.
* pthread_support.c (GC_call_with_gc_active): Likewise.
-rw-r--r-- | include/gc.h | 7 | ||||
-rw-r--r-- | mach_dep.c | 2 | ||||
-rw-r--r-- | misc.c | 8 | ||||
-rw-r--r-- | pthread_support.c | 4 | ||||
-rw-r--r-- | win32_threads.c | 2 |
5 files changed, 14 insertions, 9 deletions
diff --git a/include/gc.h b/include/gc.h index b952285b..753b5c9a 100644 --- a/include/gc.h +++ b/include/gc.h @@ -1328,7 +1328,12 @@ GC_API int GC_CALL GC_invoke_finalizers(void); __asm__ __volatile__(" " : : "X"(ptr) : "memory") #else GC_API void GC_CALL GC_noop1(GC_word); -# define GC_reachable_here(ptr) GC_noop1((GC_word)(ptr)) +# ifdef LINT2 +# define GC_reachable_here(ptr) GC_noop1(~(GC_word)(ptr)^(~(GC_word)0)) + /* The expression matches the one of COVERT_DATAFLOW(). */ +# else +# define GC_reachable_here(ptr) GC_noop1((GC_word)(ptr)) +# endif #endif /* GC_set_warn_proc can be used to redirect or filter warning messages. */ @@ -334,7 +334,7 @@ GC_INNER void GC_with_callee_saves_pushed(void (*fn)(ptr_t, void *), /* Strongly discourage the compiler from treating the above */ /* as a tail-call, since that would pop the register */ /* contents before we get a chance to look at them. */ - GC_noop1((word)(&dummy)); + GC_noop1(COVERT_DATAFLOW(&dummy)); } #endif /* !SN_TARGET_ORBIS && !SN_TARGET_PSP2 */ @@ -314,7 +314,7 @@ STATIC void GC_init_size_map(void) } /* Make sure the recursive call is not a tail call, and the bzero */ /* call is not recognized as dead code. */ - GC_noop1((word)dummy); + GC_noop1(COVERT_DATAFLOW(dummy)); return(arg); } # endif /* !ASM_CLEAR_CODE */ @@ -2130,7 +2130,7 @@ GC_API void * GC_CALL GC_call_with_stack_base(GC_stack_base_func fn, void *arg) result = fn(&base, arg); /* Strongly discourage the compiler from treating the above */ /* as a tail call. */ - GC_noop1((word)(&base)); + GC_noop1(COVERT_DATAFLOW(&base)); return result; } @@ -2155,13 +2155,13 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, /* GC_get_main_stack_base() is unimplemented or broken for */ /* the platform). */ if ((word)GC_stackbottom HOTTER_THAN (word)(&stacksect)) - GC_stackbottom = (ptr_t)(&stacksect); + GC_stackbottom = (ptr_t)COVERT_DATAFLOW(&stacksect); if (GC_blocked_sp == NULL) { /* We are not inside GC_do_blocking() - do nothing more. */ client_data = fn(client_data); /* Prevent treating the above as a tail call. */ - GC_noop1((word)(&stacksect)); + GC_noop1(COVERT_DATAFLOW(&stacksect)); return client_data; /* result */ } diff --git a/pthread_support.c b/pthread_support.c index 8738732d..4105077f 100644 --- a/pthread_support.c +++ b/pthread_support.c @@ -1424,7 +1424,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, } else { /* The original stack. */ if ((word)GC_stackbottom HOTTER_THAN (word)(&stacksect)) - GC_stackbottom = (ptr_t)(&stacksect); + GC_stackbottom = (ptr_t)COVERT_DATAFLOW(&stacksect); } if (!me->thread_blocked) { @@ -1432,7 +1432,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, UNLOCK(); client_data = fn(client_data); /* Prevent treating the above as a tail call. */ - GC_noop1((word)(&stacksect)); + GC_noop1(COVERT_DATAFLOW(&stacksect)); return client_data; /* result */ } diff --git a/win32_threads.c b/win32_threads.c index d5a59809..e2fc9e15 100644 --- a/win32_threads.c +++ b/win32_threads.c @@ -923,7 +923,7 @@ GC_API void * GC_CALL GC_call_with_gc_active(GC_fn_type fn, UNLOCK(); client_data = fn(client_data); /* Prevent treating the above as a tail call. */ - GC_noop1((word)(&stacksect)); + GC_noop1(COVERT_DATAFLOW(&stacksect)); return client_data; /* result */ } |