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] Get rid of warning comparision will always evaluate as true


Hi,

i get the following warning/error while running make xcheck:
gcc tst-mutexpp6.c -c ...
In file included from tst-mutexpp6.c:45:0:
tst-mutex6.c: In function âdo_testâ:
tst-mutex6.c:38:12: error: the comparison will always evaluate as âtrueâ for the address of âaâ will never be NULL [-Werror=address]
   if (ATTR != NULL && e == ENOTSUP)
            ^
tst-mutex6.c:49:12: error: the comparison will always evaluate as âtrueâ for the address of âaâ will never be NULL [-Werror=address]
   if (ATTR != NULL && pthread_mutexattr_destroy (ATTR) != 0)
            ^
cc1: all warnings being treated as errors


In tst-mutexpp6.c ATTR is defined to "a", which is static pthread_mutexattr_t and canÂt be NULL.
Thus ATTR_NULL is introduced like in tst-mutex1.c,
which is set to false in tst-mutexpp6.c to avoid the warning
and checks ATTR against NULL in the other cases.

Ok to commit?

Bye Stefan

---
2014-12-11  Stefan Liebler  <stli@linux.vnet.ibm.com>

	nptl/tst-mutex6.c
	(ATTR_NULL): New define checks ATTR against NULL.
	(do_test): Use !ATTR_NULL instead of ATTR != NULL.
	nptl/tst-mutexpp6.c (ATTR_NULL): New define.

Attachment: tst-mutex6_11122014
Description: Text document


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