This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] S/390: Get rid of warning: the comparision will always evaluate as false


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: backtrace_NULLcheck_20141007
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]