GNOME Bugzilla – Bug 726158
Clang r202554 reports -Wtautological-pointer-compare warnings in libxml2
Last modified: 2019-11-02 20:33:37 UTC
../../third_party/libxml/src/threads.c:876:14: error: comparison of function 'pthread_equal' not equal to a null pointer is always true [-Werror,-Wtautological-pointer-compare] (pthread_equal != NULL) && ^~~~~~~~~~~~~ ~~~~ ../../third_party/libxml/src/threads.c:876:14: note: prefix with the address-of operator to silence this warning (pthread_equal != NULL) && ^ & ../../third_party/libxml/src/debugXML.c:2939:11: error: comparison of array 'arg' equal to a null pointer is always false [-Werror,-Wtautological-pointer-compare] if ((arg == NULL) || (arg[0] == 0)) ^~~ ~~~~ The patch below fixes the warnings for me: Index: libxml/src/threads.c =================================================================== --- libxml/threads.c (revision 256151) +++ libxml/threads.c (working copy) @@ -873,7 +873,7 @@ (pthread_cond_init != NULL) && (pthread_cond_destroy != NULL) && (pthread_cond_wait != NULL) && - (pthread_equal != NULL) && + (&pthread_equal != NULL) && (pthread_self != NULL) && (pthread_cond_signal != NULL)) { libxml_is_threaded = 1; Index: third_party/libxml/src/debugXML.c =================================================================== --- libxml/debugXML.c (revision 256151) +++ libxml/debugXML.c (working copy) @@ -2936,7 +2936,7 @@ } else if (!strcmp(command, "save")) { xmlShellSave(ctxt, arg, NULL, NULL); } else if (!strcmp(command, "write")) { - if ((arg == NULL) || (arg[0] == 0)) + if (arg[0] == 0) xmlGenericError(xmlGenericErrorContext, "Write command requires a filename argument\n"); else
Fixed here: https://gitlab.gnome.org/GNOME/libxml2/commit/2677fbf4a4a6dec69ff52265addab713fe48ad1f