From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42235) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKo3I-0005Wy-Gq for qemu-devel@nongnu.org; Tue, 04 Mar 2014 07:02:36 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WKo37-0007XH-9y for qemu-devel@nongnu.org; Tue, 04 Mar 2014 07:02:28 -0500 Received: from mail-pb0-x22e.google.com ([2607:f8b0:400e:c01::22e]:55088) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WKo37-0007X9-2p for qemu-devel@nongnu.org; Tue, 04 Mar 2014 07:02:17 -0500 Received: by mail-pb0-f46.google.com with SMTP id rq2so5091425pbb.5 for ; Tue, 04 Mar 2014 04:02:15 -0800 (PST) Message-ID: <5315C0C1.5030800@gmail.com> Date: Tue, 04 Mar 2014 20:02:09 +0800 From: Xuebing wang MIME-Version: 1.0 References: <1393901250-3922-1-git-send-email-xbing6@gmail.com> <1393901250-3922-3-git-send-email-xbing6@gmail.com> <5315A89F.40700@redhat.com> In-Reply-To: <5315A89F.40700@redhat.com> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Discussion 02/10] NEED_CPU_H: remove '#include "cpu.h"' from include/qemu-common.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: afaerber@suse.de, stefanha@redhat.com >> diff --git a/include/disas/disas.h b/include/disas/disas.h >> index c13ca9a..e5cdfd7 100644 >> --- a/include/disas/disas.h >> +++ b/include/disas/disas.h >> @@ -1,9 +1,9 @@ >> #ifndef _QEMU_DISAS_H >> #define _QEMU_DISAS_H >> >> -#include "qemu-common.h" >> - >> #ifdef NEED_CPU_H >> +#include "cpu.h" /* target-xxx/cpu.h, required for target_ulong, >> + CPUArchState */ >> /* Disassemble this for me please... (debugging). */ >> void disas(FILE *out, void *code, unsigned long size); >> void target_disas(FILE *out, CPUArchState *env, target_ulong code, >> @@ -14,7 +14,7 @@ void monitor_disas(Monitor *mon, CPUArchState *env, >> >> /* Look up symbol for debugging purpose. Returns "" if unknown. */ >> const char *lookup_symbol(target_ulong orig_addr); >> -#endif >> +#endif /* NEED_CPU_H */ > > Perhaps the file that includes disas/disas.h can instead include cpu.h > too? Most of them already do: > > $ git grep -L include.*cpu.h $(git grep -l disas/disas.h) > bsd-user/elfload.c > hw/core/loader.c > linux-user/elfload.c > vl.c > > Of these, vl.c and linux-user/elfload.c should not include > disas/disas.h at all, and hw/core/loader.c is !NEED_CPU_H. So there > are just two files where you can add a #include "cpu.h" manually. > My idea is to keep disas/disas.h correct just by itself, regardless how it's used by *.c files. I have almost zero knowledge about static code analyzer, I am not sure whether disas.h can pass it without including "cpu.h"