* [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false
@ 2014-10-07 15:18 Stefan Liebler
2014-10-15 6:40 ` Stefan Liebler
2014-11-13 9:48 ` Andreas Krebbel
0 siblings, 2 replies; 3+ messages in thread
From: Stefan Liebler @ 2014-10-07 15:18 UTC (permalink / raw)
To: libc-alpha
[-- Attachment #1: Type: text/plain, Size: 2073 bytes --]
Hi,
On s390-32|64 i get the following build warning
"sysdeps/s390/s390-64/backtrace.c:133:24: warning: the comparison will
always evaluate as ‘false’ for the address of ‘_Unwind_Backtrace’ will
never be NULL [-Waddress]" for the non SHARED case.
In SHARED case, the _Unwind_Backtrace function is loaded via dlsym() and
thus needs to be NULL-checked (if (unwind_backtrace == NULL)) in order
to fallback to __backchain_backtrace() function.
In non SHARED case, the #define unwind_backtrace _Unwind_Backtrace was
introduced with "* sysdeps/s390/s390-32/backtrace.c (init): Guard with
#ifdef SHARED." (Roland McGrath <roland@gnu.org> 2004-06-11 22:12:55)
and the NULL-check will never be false for _Unwind_Backtrace() function.
Thus this NULL-check is now only evaluated in SHARED-case.
The __backchain_backtrace function is only used in the SHARED-case,
if the unwind-function is not found. Thus it is now only compiled in the
SHARED-case, to avoid the warning: warning: ‘__backchain_backtrace’
defined but not used [-Wunused-function].
On s390-32, this function is declared as static, but not on s390-64.
These functions were introduced in the same patch
"Update." (Ulrich Drepper <drepper@redhat.com> 2003-12-06 01:20:16)
and the Changelog from Martin Schwidefsky says:
* sysdeps/s390/s390-32/backtrace.c (trace_arg): New structure.
(unwind_backtrace, unwind_getip): New variables.
(init, __backchain_backtrace, backtrace_helper): New functions.
(__backtrace): Use unwind info for backtrace instead of backchain
walking if the unwind functions can be found.
* sysdeps/s390/s390-64/backtrace.c: Likewise.
On s390-64 it isn´t exported in the shared library, thus on s390-64 it
is now declared as static too!
Bye Stefan
---
2014-10-07 Stefan Liebler <stli@linux.vnet.ibm.com>
* sysdeps/s390/s390-32/backtrace.c (__backtrace):
Check for unwind_backtrace == NULL only in SHARED case.
(__backchain_backtrace): Compile only in SHARED case.
* sysdeps/s390/s390-64/backtrace.c (__backtrace):
Likewise.
(__backchain_backtrace): Declare as static.
[-- Attachment #2: backtrace_NULLcheck_20141007 --]
[-- Type: text/plain, Size: 2100 bytes --]
diff --git a/sysdeps/s390/s390-32/backtrace.c b/sysdeps/s390/s390-32/backtrace.c
index 3ade10c..e3122cf 100644
--- a/sysdeps/s390/s390-32/backtrace.c
+++ b/sysdeps/s390/s390-32/backtrace.c
@@ -77,10 +77,6 @@ init (void)
if (unwind_getip == NULL)
unwind_backtrace = NULL;
}
-#else
-# define unwind_backtrace _Unwind_Backtrace
-# define unwind_getip _Unwind_GetIP
-#endif
static int
__backchain_backtrace (void **array, int size)
@@ -107,6 +103,10 @@ __backchain_backtrace (void **array, int size)
return cnt;
}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
static _Unwind_Reason_Code
backtrace_helper (struct _Unwind_Context *ctx, void *a)
@@ -130,9 +130,10 @@ __backtrace (void **array, int size)
__libc_once_define (static, once);
__libc_once (once, init);
-#endif
+
if (unwind_backtrace == NULL)
return __backchain_backtrace (array, size);
+#endif
if (size >= 1)
unwind_backtrace (backtrace_helper, &arg);
diff --git a/sysdeps/s390/s390-64/backtrace.c b/sysdeps/s390/s390-64/backtrace.c
index 39a15e0..74b5581 100644
--- a/sysdeps/s390/s390-64/backtrace.c
+++ b/sysdeps/s390/s390-64/backtrace.c
@@ -76,12 +76,8 @@ init (void)
if (unwind_getip == NULL)
unwind_backtrace = NULL;
}
-#else
-# define unwind_backtrace _Unwind_Backtrace
-# define unwind_getip _Unwind_GetIP
-#endif
-int
+static int
__backchain_backtrace (void **array, int size)
{
/* We assume that all the code is generated with frame pointers set. */
@@ -106,6 +102,10 @@ __backchain_backtrace (void **array, int size)
return cnt;
}
+#else
+# define unwind_backtrace _Unwind_Backtrace
+# define unwind_getip _Unwind_GetIP
+#endif
static _Unwind_Reason_Code
backtrace_helper (struct _Unwind_Context *ctx, void *a)
@@ -129,9 +129,10 @@ __backtrace (void **array, int size)
__libc_once_define (static, once);
__libc_once (once, init);
-#endif
+
if (unwind_backtrace == NULL)
return __backchain_backtrace (array, size);
+#endif
if (size >= 1)
unwind_backtrace (backtrace_helper, &arg);
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false
2014-10-07 15:18 [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false Stefan Liebler
@ 2014-10-15 6:40 ` Stefan Liebler
2014-11-13 9:48 ` Andreas Krebbel
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Liebler @ 2014-10-15 6:40 UTC (permalink / raw)
To: libc-alpha
ping
On 10/07/2014 05:18 PM, Stefan Liebler wrote:
> Hi,
>
> On s390-32|64 i get the following build warning
> "sysdeps/s390/s390-64/backtrace.c:133:24: warning: the comparison will
> always evaluate as âfalseâ for the address of â_Unwind_Backtraceâ will
> never be NULL [-Waddress]" for the non SHARED case.
> In SHARED case, the _Unwind_Backtrace function is loaded via dlsym() and
> thus needs to be NULL-checked (if (unwind_backtrace == NULL)) in order
> to fallback to __backchain_backtrace() function.
>
> In non SHARED case, the #define unwind_backtrace _Unwind_Backtrace was
> introduced with "* sysdeps/s390/s390-32/backtrace.c (init): Guard with
> #ifdef SHARED." (Roland McGrath <roland@gnu.org> 2004-06-11 22:12:55)
> and the NULL-check will never be false for _Unwind_Backtrace() function.
> Thus this NULL-check is now only evaluated in SHARED-case.
>
> The __backchain_backtrace function is only used in the SHARED-case,
> if the unwind-function is not found. Thus it is now only compiled in the
> SHARED-case, to avoid the warning: warning: â__backchain_backtraceâ
> defined but not used [-Wunused-function].
>
> On s390-32, this function is declared as static, but not on s390-64.
> These functions were introduced in the same patch
> "Update." (Ulrich Drepper <drepper@redhat.com> 2003-12-06 01:20:16)
> and the Changelog from Martin Schwidefsky says:
> * sysdeps/s390/s390-32/backtrace.c (trace_arg): New structure.
> (unwind_backtrace, unwind_getip): New variables.
> (init, __backchain_backtrace, backtrace_helper): New functions.
> (__backtrace): Use unwind info for backtrace instead of backchain
> walking if the unwind functions can be found.
> * sysdeps/s390/s390-64/backtrace.c: Likewise.
>
> On s390-64 it isn´t exported in the shared library, thus on s390-64 it
> is now declared as static too!
>
> Bye Stefan
>
> ---
> 2014-10-07 Stefan Liebler <stli@linux.vnet.ibm.com>
>
> * sysdeps/s390/s390-32/backtrace.c (__backtrace):
> Check for unwind_backtrace == NULL only in SHARED case.
> (__backchain_backtrace): Compile only in SHARED case.
> * sysdeps/s390/s390-64/backtrace.c (__backtrace):
> Likewise.
> (__backchain_backtrace): Declare as static.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false
2014-10-07 15:18 [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false Stefan Liebler
2014-10-15 6:40 ` Stefan Liebler
@ 2014-11-13 9:48 ` Andreas Krebbel
1 sibling, 0 replies; 3+ messages in thread
From: Andreas Krebbel @ 2014-11-13 9:48 UTC (permalink / raw)
To: Stefan Liebler, libc-alpha
On 10/07/2014 05:18 PM, Stefan Liebler wrote:
> 2014-10-07 Stefan Liebler <stli@linux.vnet.ibm.com>
>
> * sysdeps/s390/s390-32/backtrace.c (__backtrace):
> Check for unwind_backtrace == NULL only in SHARED case.
> (__backchain_backtrace): Compile only in SHARED case.
> * sysdeps/s390/s390-64/backtrace.c (__backtrace):
> Likewise.
> (__backchain_backtrace): Declare as static.
>
Applied. Thanks!
-Andreas-
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-11-13 9:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-07 15:18 [PATCH] S/390: Get rid of warning: the comparision will always evaluate as false Stefan Liebler
2014-10-15 6:40 ` Stefan Liebler
2014-11-13 9:48 ` Andreas Krebbel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).