Received: from eggs.gnu.org ([2001:4830:134:3::10]:43347) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX3Ii-0006wI-Cg for qemu-devel@nongnu.org; Tue, 09 Aug 2016 05:26:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bX3If-00035K-6B for qemu-devel@nongnu.org; Tue, 09 Aug 2016 05:26:20 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:38771) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bX3Ie-00035A-TW for qemu-devel@nongnu.org; Tue, 09 Aug 2016 05:26:17 -0400 Received: by mail-wm0-x229.google.com with SMTP id o80so21423634wme.1 for ; Tue, 09 Aug 2016 02:26:16 -0700 (PDT) Sender: Paolo Bonzini References: <20160809023545.30204-1-bobby.prani@gmail.com> <4bbde3b0-d17a-e1a3-1957-432c6ae3bff2@redhat.com> From: Paolo Bonzini Message-ID: Date: Tue, 9 Aug 2016 11:26:08 +0200 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] clang: Disable warning about expansion to 'defined' List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , Pranith Kumar , "open list:All patches CC here" , Stefano Stabellini On 09/08/2016 10:17, Peter Maydell wrote: > On 9 August 2016 at 09:15, Paolo Bonzini wrote: >> >> >> On 09/08/2016 10:09, Peter Maydell wrote: >>> Is this the only thing in our code which provokes the warning? >>> If so, why don't we just fix it to not be undefined behaviour? >> >> Indeed that was my first suggestion yesterday. However, we use -Wundef >> (a good idea, I think), and fixing it would cause the -Wundef warning to >> appear instead. > > Why would > #if !defined(SPICE_SERVER_VERSION) || (SPICE_SERVER_VERSION < 0xc06) > #define SPICE_NEEDS_SET_MM_TIME 1 > #else > #define SPICE_NEEDS_SET_MM_TIME 0 > #endif > > provoke a Wundef warning? Oh, that would work indeed. I was thinking of simplifying the definition of SPICE_NEEDS_SET_MM_TIME like this: #define SPICE_NEEDS_SET_MM_TIME (SPICE_SERVER_VERSION < 0xc06) If we do this, it would make sense to add -Wexpansion-to-defined to GCC and enable it (though I still believe it's wrong to add it to -Wall). Thanks, Paolo