From patchwork Sun Apr 10 02:16:26 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 65434 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp784937lbl; Sat, 9 Apr 2016 19:19:19 -0700 (PDT) X-Received: by 10.55.77.4 with SMTP id a4mr20677216qkb.57.1460254759138; Sat, 09 Apr 2016 19:19:19 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id l20si15397656qhc.62.2016.04.09.19.19.18 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 09 Apr 2016 19:19:19 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3A2GT4B000359; Sat, 9 Apr 2016 22:16:30 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3A2GRNs007116 for ; Sat, 9 Apr 2016 22:16:28 -0400 Received: from [10.3.113.40] (ovpn-113-40.phx2.redhat.com [10.3.113.40]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3A2GQPs026921; Sat, 9 Apr 2016 22:16:27 -0400 To: Andrea Bolognani , Martin Kletzander , Eric Blake References: <1456349398-23304-1-git-send-email-eblake@redhat.com> <20160229144119.GB28809@wheatley> <1460132843.3940.34.camel@redhat.com> From: Cole Robinson Message-ID: <5709B77A.80706@redhat.com> Date: Sat, 9 Apr 2016 22:16:26 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <1460132843.3940.34.camel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: libvir-list@redhat.com Subject: Re: [libvirt] [PATCH] build: work around gcc 6.0 warnings X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com On 04/08/2016 12:27 PM, Andrea Bolognani wrote: > On Mon, 2016-02-29 at 15:41 +0100, Martin Kletzander wrote: >> On Wed, Feb 24, 2016 at 02:29:58PM -0700, Eric Blake wrote: >>> >>> gcc 6.0 added an annoying warning: >>> >>> fdstream.c: In function 'virFDStreamWrite': >>> fdstream.c:390:29: error: logical 'or' of equal expressions [-Werror=logical-op] >>> if (errno == EAGAIN || errno == EWOULDBLOCK) { >>> ^~ >>> fdstream.c: In function 'virFDStreamRead': >>> fdstream.c:440:29: error: logical 'or' of equal expressions [-Werror=logical-op] >>> if (errno == EAGAIN || errno == EWOULDBLOCK) { >>> ^~ >>> >>> This makes it impossible to build out-of-the-box on rawhide, >>> and we aren't guaranteed that the gcc bug will be fixed in a >>> timely manner: >>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602 >>> >>> So work around it by further complicating the logic to thwart the >>> compiler. >>> >>> Signed-off-by: Eric Blake >>> --- >>> >>> This is a build-breaker fix for rawhide; but I'll wait for a day >>> for any reasons why I should not push it during freeze. >>> >> It looks like you're still talking this over and thinking about >> approaches. But could we push the fix for the time being so that the >> release is nicely buildable and then work on making it nicer later? I'd >> vote ACK for that. > > Update: the libvirt-fedora-rawhide build host on CentOS CI > has been updated and it's now running gcc 6.0. The immediate > result is that build jobs have started to fail (see [1] for > an example). > > Looking at the gcc bug, it doesn't look like there's been > much movement in that area, so I think we should take some > action on our side... > > Eric, you mentioned proposing a v2 that would use #pragma > instead of uglifying the current checks. Do you still > intend to work on such alternative approach? > I've attached a patch with the pragma push/pop approach Eric mentioned. Unfortunately it doesn't work as is on RHEL6 vintage gcc so it's probably not a realistic option. > Failing that, I'm personally okay with pushing this. > I agree - Cole -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list >From 5df55b50e143677d0b47b0e67ffd28184e4c0556 Mon Sep 17 00:00:00 2001 Message-Id: <5df55b50e143677d0b47b0e67ffd28184e4c0556.1460254498.git.crobinso@redhat.com> From: Cole Robinson Date: Sat, 9 Apr 2016 21:46:52 -0400 Subject: [PATCH] build: Avoid -Wlogical-op bug on gcc6 Use pragma push/pop to disable -Wlogical-op for the problematic conditionals. gcc bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602 https://www.redhat.com/archives/libvir-list/2016-February/msg00054.html --- Unfortunately this doesn't work on RHEL6... gcc errors about #pragma in a function call src/fdstream.c | 6 ++++++ src/rpc/virnetsshsession.c | 9 +++++++++ src/security/security_selinux.c | 6 +++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/fdstream.c b/src/fdstream.c index a85cf9d..0422ac5 100644 --- a/src/fdstream.c +++ b/src/fdstream.c @@ -387,7 +387,10 @@ static int virFDStreamWrite(virStreamPtr st, const char *bytes, size_t nbytes) retry: ret = write(fdst->fd, bytes, nbytes); if (ret < 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (errno == EAGAIN || errno == EWOULDBLOCK) { +#pragma GCC diagnostic pop ret = -2; } else if (errno == EINTR) { goto retry; @@ -437,7 +440,10 @@ static int virFDStreamRead(virStreamPtr st, char *bytes, size_t nbytes) retry: ret = read(fdst->fd, bytes, nbytes); if (ret < 0) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (errno == EAGAIN || errno == EWOULDBLOCK) { +#pragma GCC diagnostic pop ret = -2; } else if (errno == EINTR) { goto retry; diff --git a/src/rpc/virnetsshsession.c b/src/rpc/virnetsshsession.c index 406a831..a77571f 100644 --- a/src/rpc/virnetsshsession.c +++ b/src/rpc/virnetsshsession.c @@ -545,9 +545,12 @@ virNetSSHAuthenticateAgent(virNetSSHSessionPtr sess, agent_identity))) return 0; /* key accepted */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (ret != LIBSSH2_ERROR_AUTHENTICATION_FAILED && ret != LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED && ret != LIBSSH2_ERROR_PUBLICKEY_UNVERIFIED) { +#pragma GCC diagnostic pop libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, _("failed to authenticate using SSH agent: %s"), @@ -605,9 +608,12 @@ virNetSSHAuthenticatePrivkey(virNetSSHSessionPtr sess, priv->password)) == 0) return 0; /* success */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (priv->password || ret == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED || ret == LIBSSH2_ERROR_AUTHENTICATION_FAILED) { +#pragma GCC diagnostic pop libssh2_session_last_error(sess->session, &errmsg, NULL, 0); virReportError(VIR_ERR_AUTH_FAILED, _("authentication with private key '%s' " @@ -673,11 +679,14 @@ virNetSSHAuthenticatePrivkey(virNetSSHSessionPtr sess, "has failed: %s"), priv->filename, errmsg); +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" if (ret == LIBSSH2_ERROR_PUBLICKEY_UNRECOGNIZED || ret == LIBSSH2_ERROR_AUTHENTICATION_FAILED) return 1; else return -1; +#pragma GCC diagnostic pop } return 0; diff --git a/src/security/security_selinux.c b/src/security/security_selinux.c index 26d95d1..b702fb3 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -911,8 +911,12 @@ virSecuritySELinuxSetFileconHelper(const char *path, char *tcon, * hopefully sets one of the necessary SELinux virt_use_{nfs,usb,pci} * boolean tunables to allow it ... */ - if (setfilecon_errno != EOPNOTSUPP && setfilecon_errno != ENOTSUP && +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wlogical-op" + if (setfilecon_errno != EOPNOTSUPP && + setfilecon_errno != ENOTSUP && setfilecon_errno != EROFS) { +#pragma GCC diagnostic pop virReportSystemError(setfilecon_errno, _("unable to set security context '%s' on '%s'"), tcon, path); -- 2.7.3