From patchwork Tue Apr 16 09:22:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 236874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C7E0A2C00C7 for ; Tue, 16 Apr 2013 19:23:13 +1000 (EST) Received: from localhost ([::1]:39581 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US26a-0002oQ-0T for incoming@patchwork.ozlabs.org; Tue, 16 Apr 2013 05:23:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43009) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US26J-0002o8-9W for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:22:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1US26E-0000mf-AI for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:22:55 -0400 Received: from mx1.redhat.com ([209.132.183.28]:59818) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1US26E-0000mb-2N for qemu-devel@nongnu.org; Tue, 16 Apr 2013 05:22:50 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r3G9MjNJ024482 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 16 Apr 2013 05:22:46 -0400 Received: from yakj.usersys.redhat.com (ovpn-112-41.ams2.redhat.com [10.36.112.41]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r3G9Mdda001216; Tue, 16 Apr 2013 05:22:41 -0400 Message-ID: <516D1859.5040703@redhat.com> Date: Tue, 16 Apr 2013 11:22:33 +0200 From: Paolo Bonzini User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 MIME-Version: 1.0 To: Markus Armbruster References: <1365993073-4659-1-git-send-email-aik@ozlabs.ru> <8761zofezy.fsf@blackfin.pond.sub.org> <516BA87A.2020107@ozlabs.ru> <874nf8cidj.fsf@blackfin.pond.sub.org> <516BCD71.9070905@ozlabs.ru> <516BDBFB.5070602@ozlabs.ru> <87vc7ovtnm.fsf@blackfin.pond.sub.org> <516BFAA7.1000208@ozlabs.ru> <87zjwzu6tl.fsf@blackfin.pond.sub.org> <516C83AE.9040800@ozlabs.ru> <516CC295.8010505@ozlabs.ru> <87r4ianc11.fsf@blackfin.pond.sub.org> In-Reply-To: <87r4ianc11.fsf@blackfin.pond.sub.org> X-Enigmail-Version: 1.5.1 X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Peter Maydell , Alexey Kardashevskiy , qemu-devel@nongnu.org, Blue Swirl , Gerd Hoffmann , Stefan Hajnoczi , David Gibson Subject: Re: [Qemu-devel] [PATCH] pixman: remove -Wredundand-decls X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Il 16/04/2013 09:57, Markus Armbruster ha scritto: >> >> I think this is just beautiful. Fedora18, x86_64, NO cross >> compiler. gcc does not apply -Wredundant-decls to /usr/include/* but >> does it for all other headers and in the case of cross compilation I >> hit this case. '-Wsystem-headers' Print warning messages for constructs found in system header files. Warnings from system headers are normally suppressed, on the assumption that they usually do not indicate real problems and would only make the compiler output harder to read. >> Does anyone know the way to tell gcc that libc headers are not at >> /usr/include but somewhere else? I think this helps: '--sysroot=DIR' Use DIR as the logical root directory for headers and libraries. For example, if the compiler normally searches for headers in '/usr/include' and libraries in '/usr/lib', it instead searches 'DIR/usr/include' and 'DIR/usr/lib'. but you shouldn't need it. Just configure your GCC with --with-sysroot=/foo and it should just work. Also: > This workaround does NOT work if pragmas used. "#pragma GCC diagnostic > error "-Wredundant-decls"" re-enables warnings as errors. The solution is to use push/pop like this: Untested, feel free to resubmit with my Signed-off-by. Paolo diff --git a/coroutine-ucontext.c b/coroutine-ucontext.c index 867a662..4bf2cde 100644 --- a/coroutine-ucontext.c +++ b/coroutine-ucontext.c @@ -169,6 +169,7 @@ Coroutine *qemu_coroutine_new(void) #ifdef CONFIG_VALGRIND_H #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE /* Work around an unused variable in the valgrind.h macro... */ +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-but-set-variable" #endif static inline void valgrind_stack_deregister(CoroutineUContext *co) @@ -176,7 +177,7 @@ static inline void valgrind_stack_deregister(CoroutineUContext *co) VALGRIND_STACK_DEREGISTER(co->valgrind_stack_id); } #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE -#pragma GCC diagnostic error "-Wunused-but-set-variable" +#pragma GCC diagnostic pop #endif #endif diff --git a/include/ui/qemu-pixman.h b/include/ui/qemu-pixman.h index b032f52..882e2a3 100644 --- a/include/ui/qemu-pixman.h +++ b/include/ui/qemu-pixman.h @@ -8,11 +8,12 @@ /* pixman-0.16.0 headers have a redundant declaration */ #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE +#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wredundant-decls" #endif #include #ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE -#pragma GCC diagnostic error "-Wredundant-decls" +#pragma GCC diagnostic pop #endif #include "qemu/typedefs.h"