After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 726158 - Clang r202554 reports -Wtautological-pointer-compare warnings in libxml2
Clang r202554 reports -Wtautological-pointer-compare warnings in libxml2
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: general
2.7.7
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
libxml QA maintainers
Depends on:
Blocks:
 
 
Reported: 2014-03-12 09:02 UTC by Alexander Potapenko
Modified: 2019-11-02 20:33 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Alexander Potapenko 2014-03-12 09:02:38 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