ehlo,

There are new warnings with gcc-6.0

LS
>From 2561af75f5d0ccff51ed8f88a48fb685b83e91e1 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <[email protected]>
Date: Sat, 5 Mar 2016 15:15:20 +0100
Subject: [PATCH 1/2] UTIL: Fix indentation in dlinklist.h

---
 src/util/dlinklist.h | 130 +++++++++++++++++++++++++--------------------------
 1 file changed, 65 insertions(+), 65 deletions(-)

diff --git a/src/util/dlinklist.h b/src/util/dlinklist.h
index 
ef09661f4be4d6e973173887f7790f214bf0f1dd..e8490496c4d8a8018edbeec776b2f09d2066236c
 100644
--- a/src/util/dlinklist.h
+++ b/src/util/dlinklist.h
@@ -27,112 +27,112 @@
 /* hook into the front of the list */
 #define DLIST_ADD(list, p) \
 do { \
-        if (!(list)) { \
-               (list) = (p); \
-               (p)->next = (p)->prev = NULL; \
-       } else { \
-               (list)->prev = (p); \
-               (p)->next = (list); \
-               (p)->prev = NULL; \
-               (list) = (p); \
-       }\
+    if (!(list)) { \
+        (list) = (p); \
+        (p)->next = (p)->prev = NULL; \
+    } else { \
+        (list)->prev = (p); \
+        (p)->next = (list); \
+        (p)->prev = NULL; \
+        (list) = (p); \
+    } \
 } while (0)
 
 /* remove an element from a list - element doesn't have to be in list. */
 #define DLIST_REMOVE(list, p) \
 do { \
-       if ((p) == (list)) { \
-               (list) = (p)->next; \
-               if (list) (list)->prev = NULL; \
-       } else { \
-               if ((p)->prev) (p)->prev->next = (p)->next; \
-               if ((p)->next) (p)->next->prev = (p)->prev; \
-       } \
-       if ((p) != (list)) (p)->next = (p)->prev = NULL; \
+    if ((p) == (list)) { \
+        (list) = (p)->next; \
+        if (list) (list)->prev = NULL; \
+    } else { \
+        if ((p)->prev) (p)->prev->next = (p)->next; \
+        if ((p)->next) (p)->next->prev = (p)->prev; \
+    } \
+    if ((p) != (list)) (p)->next = (p)->prev = NULL; \
 } while (0)
 
 /* promote an element to the top of the list */
 #define DLIST_PROMOTE(list, p) \
 do { \
-          DLIST_REMOVE(list, p); \
-          DLIST_ADD(list, p); \
+    DLIST_REMOVE(list, p); \
+    DLIST_ADD(list, p); \
 } while (0)
 
 /* hook into the end of the list - needs a tmp pointer */
 #define DLIST_ADD_END(list, p, type) \
 do { \
-               if (!(list)) { \
-                       (list) = (p); \
-                       (p)->next = (p)->prev = NULL; \
-               } else { \
-                       type tmp; \
-                       for (tmp = (list); tmp->next; tmp = tmp->next) { \
-                               /* no op */ \
-                       } \
-                       tmp->next = (p); \
-                       (p)->next = NULL; \
-                       (p)->prev = tmp; \
-               } \
+    if (!(list)) { \
+        (list) = (p); \
+        (p)->next = (p)->prev = NULL; \
+    } else { \
+        type tmp; \
+        for (tmp = (list); tmp->next; tmp = tmp->next) { \
+            /* no op */ \
+        } \
+        tmp->next = (p); \
+        (p)->next = NULL; \
+        (p)->prev = tmp; \
+    } \
 } while (0)
 
 /* insert 'p' after the given element 'el' in a list. If el is NULL then
    this is the same as a DLIST_ADD() */
 #define DLIST_ADD_AFTER(list, p, el) \
 do { \
-        if (!(list) || !(el)) { \
-               DLIST_ADD(list, p); \
-       } else { \
-               p->prev = el; \
-               p->next = el->next; \
-               el->next = p; \
-               if (p->next) p->next->prev = p; \
-       }\
+    if (!(list) || !(el)) { \
+        DLIST_ADD(list, p); \
+    } else { \
+        p->prev = el; \
+        p->next = el->next; \
+        el->next = p; \
+        if (p->next) p->next->prev = p; \
+    } \
 } while (0)
 
 /* demote an element to the end of the list, needs a tmp pointer */
 #define DLIST_DEMOTE(list, p, type) \
 do { \
-               DLIST_REMOVE(list, p); \
-               DLIST_ADD_END(list, p, type); \
+    DLIST_REMOVE(list, p); \
+    DLIST_ADD_END(list, p, type); \
 } while (0)
 
 /* concatenate two lists - putting all elements of the 2nd list at the
    end of the first list */
 #define DLIST_CONCATENATE(list1, list2, type) \
 do { \
-               if (!(list1)) { \
-                       (list1) = (list2); \
-               } else { \
-                       type tmp; \
-                       for (tmp = (list1); tmp->next; tmp = tmp->next) { \
-                               /* no op */ \
-                       } \
-                       tmp->next = (list2); \
-                       if (list2) { \
-                               (list2)->prev = tmp;    \
-                       } \
-               } \
+    if (!(list1)) { \
+        (list1) = (list2); \
+    } else { \
+        type tmp; \
+        for (tmp = (list1); tmp->next; tmp = tmp->next) { \
+            /* no op */ \
+        } \
+        tmp->next = (list2); \
+        if (list2) { \
+            (list2)->prev = tmp; \
+        } \
+    } \
 } while (0)
 
 /* insert all elements from list2 after the given element 'el' in the
  * first list */
 #define DLIST_ADD_LIST_AFTER(list1, el, list2, type) \
 do { \
-                if (!(list1) || !(el) || !(list2)) { \
-                    DLIST_CONCATENATE(list1, list2, type); \
-                } else { \
-                    type tmp; \
-                    for (tmp = (list2); tmp->next; tmp = tmp->next) { \
-                        /* no op */ \
-                    } \
-                    (list2)->prev = (el); \
-                    tmp->next = (el)->next; \
-                    (el)->next = (list2); \
-                    if (tmp->next != NULL) tmp->next->prev = tmp; \
+    if (!(list1) || !(el) || !(list2)) { \
+        DLIST_CONCATENATE(list1, list2, type); \
+    } else { \
+        type tmp; \
+        for (tmp = (list2); tmp->next; tmp = tmp->next) { \
+            /* no op */ \
+        } \
+        (list2)->prev = (el); \
+        tmp->next = (el)->next; \
+        (el)->next = (list2); \
+        if (tmp->next != NULL) tmp->next->prev = tmp; \
     } \
 } while (0);
 
 #define DLIST_FOR_EACH(p, list) \
-       for ((p) = (list); (p) != NULL; (p) = (p)->next)
+    for ((p) = (list); (p) != NULL; (p) = (p)->next)
 
 #endif /* _DLINKLIST_H */
-- 
2.7.2

>From b07533a25a0fd496cc66960b6487cb4e2e42254a Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <[email protected]>
Date: Sat, 5 Mar 2016 15:31:04 +0100
Subject: [PATCH 2/2] UTIL: Fix warning misleading-indentation
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Warnings are emited from macro generated code in dlinklist.h
e.g.
src/ldb_modules/memberof.c:4209:13: error: statement is indented as if it were
    guarded by... [-Werror=misleading-indentation]
             DLIST_DEMOTE(ctx->group_list, grp, struct mbof_member *);
             ^~~~~~~~~~~~
src/ldb_modules/memberof.c:4209:13: note: ...this ‘if’ clause, but it is not
src/ldb_modules/memberof.c: In function ‘mbof_member_update’:
src/ldb_modules/memberof.c:4305:9: error: statement is indented as if it were
    guarded by... [-Werror=misleading-indentation]
         DLIST_PROMOTE(ctx->group_list, mem);
         ^~~~~~~~~~~~~
src/ldb_modules/memberof.c:4305:9: note: ...this ‘if’ clause, but it is not
src/ldb_modules/memberof.c: In function ‘mbof_rcmp_update’:
src/ldb_modules/memberof.c:4408:9: error: statement is indented as if it were
    guarded by... [-Werror=misleading-indentation]
         DLIST_REMOVE(ctx->user_list, x);
         ^~~~~~~~~~~~
src/util/crypto/nss/nss_obfuscate.c: In function ‘sss_password_decrypt’:
src/util/crypto/nss/nss_obfuscate.c:419:5: error: statement is indented
    as if it were guarded by... [-Werror=misleading-indentation]
     SAFEALIGN_COPY_UINT16_CHECK(&meth, obfbuf+p, obflen, &p);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
src/python/pyhbac.c: In function ‘PyInit_pyhbac’:
src/python/pyhbac.c:1987:5: error: statement is indented as if it were
    guarded by... [-Werror=misleading-indentation]
     TYPE_READY(m, pyhbac_hbacrule_type, "HbacRule");
     ^~~~~~~~~~
src/python/pyhbac.c:1987:5: note: ...this ‘if’ clause, but it is not
---
 src/util/dlinklist.h      | 24 ++++++++++++++++++------
 src/util/sss_python.h     |  5 +++--
 src/util/util_safealign.h |  6 +++---
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/src/util/dlinklist.h b/src/util/dlinklist.h
index 
e8490496c4d8a8018edbeec776b2f09d2066236c..4f6aef830e914c22654970081263d43461c1750f
 100644
--- a/src/util/dlinklist.h
+++ b/src/util/dlinklist.h
@@ -43,12 +43,20 @@ do { \
 do { \
     if ((p) == (list)) { \
         (list) = (p)->next; \
-        if (list) (list)->prev = NULL; \
+        if (list) { \
+            (list)->prev = NULL; \
+        } \
     } else { \
-        if ((p)->prev) (p)->prev->next = (p)->next; \
-        if ((p)->next) (p)->next->prev = (p)->prev; \
+        if ((p)->prev) { \
+            (p)->prev->next = (p)->next; \
+        } \
+        if ((p)->next) { \
+            (p)->next->prev = (p)->prev; \
+        } \
+    } \
+    if ((p) != (list)) { \
+        (p)->next = (p)->prev = NULL; \
     } \
-    if ((p) != (list)) (p)->next = (p)->prev = NULL; \
 } while (0)
 
 /* promote an element to the top of the list */
@@ -85,7 +93,9 @@ do { \
         p->prev = el; \
         p->next = el->next; \
         el->next = p; \
-        if (p->next) p->next->prev = p; \
+        if (p->next) { \
+            p->next->prev = p; \
+        } \
     } \
 } while (0)
 
@@ -128,7 +138,9 @@ do { \
         (list2)->prev = (el); \
         tmp->next = (el)->next; \
         (el)->next = (list2); \
-        if (tmp->next != NULL) tmp->next->prev = tmp; \
+        if (tmp->next != NULL) { \
+            tmp->next->prev = tmp; \
+        } \
     } \
 } while (0);
 
diff --git a/src/util/sss_python.h b/src/util/sss_python.h
index 
7e2bac33656dcbac91bb4f4d32ec9fbc44bb4e52..b3fdaad646af430de6ad8fde7dd66efa608aa89a
 100644
--- a/src/util/sss_python.h
+++ b/src/util/sss_python.h
@@ -31,8 +31,9 @@ sss_exception_with_doc(char *name, char *doc, PyObject *base, 
PyObject *dict);
 
 /* Convenience macros */
 #define TYPE_READY(module, type, name) do {         \
-    if (PyType_Ready(&type) < 0)                    \
-       MODINITERROR;                               \
+    if (PyType_Ready(&type) < 0) {                  \
+        MODINITERROR;                               \
+    }                                               \
     Py_INCREF(&type);                               \
     PyModule_AddObject(module,                      \
                        discard_const_p(char, name), \
diff --git a/src/util/util_safealign.h b/src/util/util_safealign.h
index 
ba216f6063a34524c40f961115d79b40ec4e1641..b1c9f8a0c11f4d13fca885aa4e28e7c4750f37fe
 100644
--- a/src/util/util_safealign.h
+++ b/src/util/util_safealign.h
@@ -103,19 +103,19 @@ safealign_memcpy(void *dest, const void *src, size_t n, 
size_t *counter)
  * would excceed len. */
 #define SAFEALIGN_COPY_UINT32_CHECK(dest, src, len, pctr) do { \
     if ((*(pctr) + sizeof(uint32_t)) > (len) || \
-        SIZE_T_OVERFLOW(*(pctr), sizeof(uint32_t))) return EINVAL; \
+        SIZE_T_OVERFLOW(*(pctr), sizeof(uint32_t))) { return EINVAL; } \
     safealign_memcpy(dest, src, sizeof(uint32_t), pctr); \
 } while(0)
 
 #define SAFEALIGN_COPY_INT32_CHECK(dest, src, len, pctr) do { \
     if ((*(pctr) + sizeof(int32_t)) > (len) || \
-        SIZE_T_OVERFLOW(*(pctr), sizeof(int32_t))) return EINVAL; \
+        SIZE_T_OVERFLOW(*(pctr), sizeof(int32_t))) { return EINVAL; } \
     safealign_memcpy(dest, src, sizeof(int32_t), pctr); \
 } while(0)
 
 #define SAFEALIGN_COPY_UINT16_CHECK(dest, src, len, pctr) do { \
     if ((*(pctr) + sizeof(uint16_t)) > (len) || \
-        SIZE_T_OVERFLOW(*(pctr), sizeof(uint16_t))) return EINVAL; \
+        SIZE_T_OVERFLOW(*(pctr), sizeof(uint16_t))) { return EINVAL; } \
     safealign_memcpy(dest, src, sizeof(uint16_t), pctr); \
 } while(0)
 
-- 
2.7.2

_______________________________________________
sssd-devel mailing list
[email protected]
https://lists.fedorahosted.org/admin/lists/[email protected]

Reply via email to