From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYJXx-0006sy-Ge for qemu-devel@nongnu.org; Wed, 18 Mar 2015 15:22:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YYJXu-0001fl-7j for qemu-devel@nongnu.org; Wed, 18 Mar 2015 15:22:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42606) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YYJXt-0001fX-WE for qemu-devel@nongnu.org; Wed, 18 Mar 2015 15:22:26 -0400 Message-ID: <5509D06E.4060507@redhat.com> Date: Wed, 18 Mar 2015 15:22:22 -0400 From: John Snow MIME-Version: 1.0 References: <550880E5.8020505@redhat.com> <5508879E.2050809@redhat.com> In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] clang 3.5.0 errors List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel , Stefan Hajnoczi On 03/17/2015 07:07 PM, Peter Maydell wrote: > On 17 March 2015 at 19:59, John Snow wrote: >> On 03/17/2015 03:34 PM, Peter Maydell wrote: >>> On 17 March 2015 at 19:30, John Snow wrote: >>>> -Wunused-command-line-argument currently complains about the >>>> many include flags passed to each CC incantation > >>> Do you see this with really just --cc=clang ? I see these warnings >>> if I try to use clang with ccache, but I believe that's a ccache bug. > >> Not /intentionally/ invoking ccache: >> >> ../../configure --cc=clang --host-cc=clang --enable-debug >> --extra-cflags="-Werror -Wno-unknown-attributes -Wno-parentheses-equality >> -Wno-self-assign -Wno-tautological-compare" >> >> But that's because: >> >> which clang >> /usr/lib64/ccache/clang >> >> Which is definitely not of my own doing -- seems to be a default in Fedora >> 21. > > Brave of them :-) > > Supposedly this bug is fixed in ccache 3.2: > https://bugzilla.samba.org/show_bug.cgi?id=8118 > > You can probably work around it by telling QEMU's configure > --extra-cflags=-Qunused-arguments or something similar. > > -- PMM > Ah, yes; many of these wind up being ccache problems, but not all of them. There's one case of error here that's interesting that ccache unearths: we use a gnu extension to give return values to compound statement blocks, then wrap these blocks into macros as if they were functions. The practical outcome here is that these blocks have return codes that we often don't check, so clang will spit out "unused value" warnings if we compile these after preprocessing, like ccache will tend to do. This warning is potentially valid: if these calls can fail, we should probably either be asserting that a failure did not occur OR we should switch to a variant without a return code, if failure is impossible in these locations. An example of this is in linux-user/elfload.c where we define the NEW_AUX_ENT() macro which in turn uses the put_user_ual(val, sp) macro. When this is expanded, it turns into a compound statement where we discard the expression result, so clang whines. Of course, this all goes away if you disable ccache, but is it worth adjusting this particular usage anyway? --js