[SSSD] [PATCH] Fix warning: equality comparison with extraneous parentheses

Lukas Slebodnik lslebodn at redhat.com
Wed Jan 28 08:22:40 UTC 2015


On (23/01/15 18:07), Michal Židek wrote:
>On 01/10/2015 06:10 PM, Lukas Slebodnik wrote:
>>ehlo,
>>
>>The attached patch fixes clang warning -Wparentheses-equality
>>
>>LS
>>
>>
>
>This patch will not apply on current master.
>
Rebased patch is attached.

LS
-------------- next part --------------
>From eec4d1555e8895be2c0f795f0e8fe014b2a28006 Mon Sep 17 00:00:00 2001
From: Lukas Slebodnik <lslebodn at redhat.com>
Date: Mon, 15 Sep 2014 16:05:30 +0200
Subject: [PATCH 1/2] Fix warning: equality comparison with extraneous
 parentheses

Example of warning:
src/sss_client/libwbclient/wbc_pwd_sssd.c:246:23:
  error: equality comparison with extraneous parentheses
  [-Werror,-Wparentheses-equality]
    if (((wbc_status) == WBC_ERR_SUCCESS)) {
         ~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
src/sss_client/libwbclient/wbc_pwd_sssd.c:246:23:
  note: remove extraneous parentheses around the comparison
  to silence this warning
    if (((wbc_status) == WBC_ERR_SUCCESS)) {
        ~             ^                 ~
src/sss_client/libwbclient/wbc_pwd_sssd.c:246:23:
  note: use '=' to turn this equality comparison into an assignment
    if (((wbc_status) == WBC_ERR_SUCCESS)) {
                      ^~
                      =

The reason is definition of some macros which were used in if conditions.
---
 src/providers/proxy/proxy_auth.c          |  6 +++---
 src/python/pyhbac.c                       |  2 +-
 src/sss_client/libwbclient/wbc_pwd_sssd.c | 12 ++++++------
 src/util/child_common.c                   |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/providers/proxy/proxy_auth.c b/src/providers/proxy/proxy_auth.c
index a901f0f1738e45f84c101d8786d9258e88e3a135..d85320cf64dc004fb0939ffc9acaf2656eed5d5b 100644
--- a/src/providers/proxy/proxy_auth.c
+++ b/src/providers/proxy/proxy_auth.c
@@ -365,7 +365,7 @@ static void pc_init_sig_handler(struct tevent_context *ev,
                       "child [%d] was stopped by signal [%d].\n", ret,
                           WSTOPSIG(child_status));
             }
-            if (WIFCONTINUED(child_status)) {
+            if (WIFCONTINUED(child_status) == true) {
                 DEBUG(SSSDBG_CRIT_FAILURE,
                       "child [%d] was resumed by delivery of SIGCONT.\n",
                           ret);
@@ -522,7 +522,7 @@ static void proxy_child_sig_handler(struct tevent_context *ev,
             DEBUG(SSSDBG_CONF_SETTINGS,
                   "child [%d] exited with status [%d].\n", ret,
                       WEXITSTATUS(child_status));
-        } else if (WIFSIGNALED(child_status)) {
+        } else if (WIFSIGNALED(child_status) == true) {
             DEBUG(SSSDBG_CONF_SETTINGS,
                   "child [%d] was terminated by signal [%d].\n", ret,
                       WTERMSIG(child_status));
@@ -532,7 +532,7 @@ static void proxy_child_sig_handler(struct tevent_context *ev,
                       "child [%d] was stopped by signal [%d].\n", ret,
                           WSTOPSIG(child_status));
             }
-            if (WIFCONTINUED(child_status)) {
+            if (WIFCONTINUED(child_status) == true) {
                 DEBUG(SSSDBG_CRIT_FAILURE,
                       "child [%d] was resumed by delivery of SIGCONT.\n",
                           ret);
diff --git a/src/python/pyhbac.c b/src/python/pyhbac.c
index c46f7c6b300df9eb82fa411673da3d77504080cd..f3aaa60f03b24c8a87d24d10fb06dd58fb3c9dae 100644
--- a/src/python/pyhbac.c
+++ b/src/python/pyhbac.c
@@ -794,7 +794,7 @@ hbac_rule_set_enabled(HbacRuleObject *self, PyObject *enabled, void *closure)
 
         Py_DECREF(utf8_str);
         return 0;
-    } else if (PyBool_Check(enabled)) {
+    } else if (PyBool_Check(enabled) == true) {
         self->enabled = (enabled == Py_True);
         return 0;
     } else if (PYNUMBER_CHECK(enabled)) {
diff --git a/src/sss_client/libwbclient/wbc_pwd_sssd.c b/src/sss_client/libwbclient/wbc_pwd_sssd.c
index 6cdea1c030a6bae4b0b9e72471720f8781f36d38..08c3b86372c86f228aeeb584068f82bd97cfe0fe 100644
--- a/src/sss_client/libwbclient/wbc_pwd_sssd.c
+++ b/src/sss_client/libwbclient/wbc_pwd_sssd.c
@@ -243,7 +243,7 @@ wbcErr wbcGetpwnam(const char *name, struct passwd **pwd)
 
     status = ctx->getpwnam_r(name, &lpwd, buffer, buflen, &nss_errno);
     wbc_status = nss_to_wbc(status);
-    if (WBC_ERROR_IS_OK(wbc_status)) {
+    if (WBC_ERROR_IS_OK(wbc_status) == true) {
         wbc_status = copy_pwd(&lpwd, pwd);
     }
 
@@ -278,7 +278,7 @@ wbcErr wbcGetpwuid(uid_t uid, struct passwd **pwd)
 
     status = ctx->getpwuid_r(uid, &lpwd, buffer, buflen, &nss_errno);
     wbc_status = nss_to_wbc(status);
-    if (WBC_ERROR_IS_OK(wbc_status)) {
+    if (WBC_ERROR_IS_OK(wbc_status) == true) {
         wbc_status = copy_pwd(&lpwd, pwd);
     }
 
@@ -401,7 +401,7 @@ wbcErr wbcGetgrnam(const char *name, struct group **grp)
         memset(grp, 0, sizeof(struct group));
         status = ctx->getgrnam_r(name, &lgrp, buffer, buflen, &nss_errno);
         wbc_status = nss_to_wbc(status);
-        if (WBC_ERROR_IS_OK(wbc_status)) {
+        if (WBC_ERROR_IS_OK(wbc_status) == true) {
             wbc_status = copy_grp(&lgrp, grp);
         }
     } while (status == NSS_STATUS_TRYAGAIN && nss_errno == ERANGE \
@@ -445,7 +445,7 @@ wbcErr wbcGetgrgid(gid_t gid, struct group **grp)
         memset(grp, 0, sizeof(struct group));
         status = ctx->getgrgid_r(gid, &lgrp, buffer, buflen, &nss_errno);
         wbc_status = nss_to_wbc(status);
-        if (WBC_ERROR_IS_OK(wbc_status)) {
+        if (WBC_ERROR_IS_OK(wbc_status) == true) {
             wbc_status = copy_grp(&lgrp, grp);
         }
     } while (status == NSS_STATUS_TRYAGAIN && nss_errno == ERANGE \
@@ -514,7 +514,7 @@ wbcErr wbcGetpwent(struct passwd **pwd)
 
     status = ctx->getpwent_r(&lpwd, buffer, buflen, &nss_errno);
     wbc_status = nss_to_wbc(status);
-    if (WBC_ERROR_IS_OK(wbc_status)) {
+    if (WBC_ERROR_IS_OK(wbc_status) == true) {
         wbc_status = copy_pwd(&lpwd, pwd);
     }
 
@@ -588,7 +588,7 @@ wbcErr wbcGetgrent(struct group **grp)
         memset(grp, 0, sizeof(struct group));
         status = ctx->getgrent_r(&lgrp, buffer, buflen, &nss_errno);
         wbc_status = nss_to_wbc(status);
-        if (WBC_ERROR_IS_OK(wbc_status)) {
+        if (WBC_ERROR_IS_OK(wbc_status) == true) {
             wbc_status = copy_grp(&lgrp, grp);
         }
     } while (status == NSS_STATUS_TRYAGAIN && nss_errno == ERANGE \
diff --git a/src/util/child_common.c b/src/util/child_common.c
index b1af02337e0bbab66e766dde7a33f3730689a20a..a6131cd20e7cfff5e5d58806aa2c178327eb9baa 100644
--- a/src/util/child_common.c
+++ b/src/util/child_common.c
@@ -568,7 +568,7 @@ static void child_sig_handler(struct tevent_context *ev,
                       "child [%d] was stopped by signal [%d].\n", ret,
                           WSTOPSIG(child_ctx->child_status));
             }
-            if (WIFCONTINUED(child_ctx->child_status)) {
+            if (WIFCONTINUED(child_ctx->child_status) == true) {
                 DEBUG(SSSDBG_TRACE_LIBS,
                       "child [%d] was resumed by delivery of SIGCONT.\n",
                           ret);
-- 
2.1.0



More information about the sssd-devel mailing list