From patchwork Tue Mar 26 14:00:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Llu=C3=ADs_Vilanova?= X-Patchwork-Id: 231210 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 275222C0090 for ; Wed, 27 Mar 2013 01:03:16 +1100 (EST) Received: from localhost ([::1]:57305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKUT1-0001Ae-Uq for incoming@patchwork.ozlabs.org; Tue, 26 Mar 2013 10:03:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKUQn-0006OE-GS for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:00:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UKUQl-0007kz-DS for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:00:53 -0400 Received: from roura.ac.upc.es ([147.83.33.10]:37425) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UKUQk-0007kh-Ks for qemu-devel@nongnu.org; Tue, 26 Mar 2013 10:00:51 -0400 Received: from gw.ac.upc.edu (gw.ac.upc.es [147.83.30.3]) by roura.ac.upc.es (8.13.8/8.13.8) with ESMTP id r2QE0nC3005074 for ; Tue, 26 Mar 2013 15:00:49 +0100 Received: from localhost (unknown [84.88.51.85]) by gw.ac.upc.edu (Postfix) with ESMTP id 705DD6B01C4 for ; Tue, 26 Mar 2013 15:00:49 +0100 (CET) From: =?utf-8?b?TGx1w61z?= Vilanova To: qemu-devel@nongnu.org Date: Tue, 26 Mar 2013 15:00:49 +0100 Message-Id: <20130326140049.4471.82535.stgit@fimbulvetr.bsc.es> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <20130326140021.4471.99597.stgit@fimbulvetr.bsc.es> References: <20130326140021.4471.99597.stgit@fimbulvetr.bsc.es> User-Agent: StGit/0.16 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by roura.ac.upc.es id r2QE0nC3005074 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 147.83.33.10 Subject: [Qemu-devel] [PATCH 05/22] trace: Minimize inclusions of "qemu-common.h" to avoid inclusion loops 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 This problem arises in the following patches. Signed-off-by: LluĂ­s Vilanova --- hw/virtio.c | 1 + monitor.c | 4 +++- scripts/tracetool/format/h.py | 9 ++++++++- trace/control-internal.h | 2 ++ trace/control.c | 2 ++ trace/control.h | 7 ++++++- trace/default.c | 2 ++ trace/simple.c | 4 +++- trace/simple.h | 1 + trace/stderr.c | 4 +++- 10 files changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/virtio.c b/hw/virtio.c index e259348..1f26a55 100644 --- a/hw/virtio.c +++ b/hw/virtio.c @@ -14,6 +14,7 @@ #include #include "trace.h" +#include "qemu-common.h" #include "qemu/error-report.h" #include "virtio.h" #include "qemu/atomic.h" diff --git a/monitor.c b/monitor.c index e287c06..2fff049 100644 --- a/monitor.c +++ b/monitor.c @@ -22,6 +22,9 @@ * THE SOFTWARE. */ #include +#define TRACE__CONTROL__USE__TRACE_PRINT_EVENTS +#include "trace/control.h" +#undef TRACE__CONTROL__USE__TRACE_PRINT_EVENTS #include "hw/hw.h" #include "hw/qdev.h" #include "hw/usb.h" @@ -58,7 +61,6 @@ #include "qemu/osdep.h" #include "cpu.h" #include "trace.h" -#include "trace/control.h" #ifdef CONFIG_TRACE_SIMPLE #include "trace/simple.h" #endif diff --git a/scripts/tracetool/format/h.py b/scripts/tracetool/format/h.py index 575d2f1..7c5b401 100644 --- a/scripts/tracetool/format/h.py +++ b/scripts/tracetool/format/h.py @@ -22,7 +22,14 @@ def begin(events): '#ifndef TRACE__GENERATED_TRACERS_H', '#define TRACE__GENERATED_TRACERS_H', '', - '#include "qemu-common.h"') + '/* Do not directly include "qemu-common.h" to avoid circular dependencies */', + '#include ', + '#include ', + '#include ', + '#include ', + '#include ', + '', + ) def end(events): out('#endif /* TRACE__GENERATED_TRACERS_H */') diff --git a/trace/control-internal.h b/trace/control-internal.h index cce2da4..ed4ccf7 100644 --- a/trace/control-internal.h +++ b/trace/control-internal.h @@ -11,6 +11,8 @@ #define TRACE__CONTROL_INTERNAL_H #include +#include +#include extern TraceEvent trace_events[]; diff --git a/trace/control.c b/trace/control.c index 49f61e1..6d6cbea 100644 --- a/trace/control.c +++ b/trace/control.c @@ -9,6 +9,8 @@ #include "trace/control.h" +#include "qemu-common.h" + TraceEvent *trace_event_name(const char *name) { diff --git a/trace/control.h b/trace/control.h index cde8260..a125098 100644 --- a/trace/control.h +++ b/trace/control.h @@ -10,7 +10,6 @@ #ifndef TRACE__CONTROL_H #define TRACE__CONTROL_H -#include "qemu-common.h" #include "trace/generated-events.h" @@ -155,6 +154,10 @@ void trace_event_set_state_dynamic_backend(TraceEvent *ev, bool state); +#if defined(TRACE__CONTROL__USE__TRACE_PRINT_EVENTS) +/* Minimize inclusions of "qemu-common.h" to avoid circular dependencies */ +#include "qemu-common.h" + /** * trace_print_events: * @@ -164,6 +167,8 @@ void trace_event_set_state_dynamic_backend(TraceEvent *ev, bool state); */ void trace_print_events(FILE *stream, fprintf_function stream_printf); +#endif /* defined(TRACE__CONTROL__USE__TRACE_PRINT_EVENTS) */ + /** * trace_backend_init: * @events: Name of file with events to be enabled at startup; may be NULL. diff --git a/trace/default.c b/trace/default.c index 6e07a47..adb8693 100644 --- a/trace/default.c +++ b/trace/default.c @@ -7,7 +7,9 @@ * the COPYING file in the top-level directory. */ +#define TRACE__CONTROL__USE__TRACE_PRINT_EVENTS #include "trace/control.h" +#undef TRACE__CONTROL__USE__TRACE_PRINT_EVENTS void trace_print_events(FILE *stream, fprintf_function stream_printf) diff --git a/trace/simple.c b/trace/simple.c index 8b59760..cb4361f 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -19,8 +19,10 @@ #include #endif #include "qemu/timer.h" -#include "trace.h" +#define TRACE__CONTROL__USE__TRACE_PRINT_EVENTS #include "trace/control.h" +#undef TRACE__CONTROL__USE__TRACE_PRINT_EVENTS +#include "trace.h" /** Trace file header event ID */ #define HEADER_EVENT_ID (~(uint64_t)0) /* avoids conflicting with TraceEventIDs */ diff --git a/trace/simple.h b/trace/simple.h index 5260d9a..1541ea0 100644 --- a/trace/simple.h +++ b/trace/simple.h @@ -16,6 +16,7 @@ #include #include "trace/generated-events.h" +#include "qemu-common.h" void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf); diff --git a/trace/stderr.c b/trace/stderr.c index e212efd..3a6f4bd 100644 --- a/trace/stderr.c +++ b/trace/stderr.c @@ -1,5 +1,7 @@ -#include "trace.h" +#define TRACE__CONTROL__USE__TRACE_PRINT_EVENTS #include "trace/control.h" +#undef TRACE__CONTROL__USE__TRACE_PRINT_EVENTS +#include "trace.h" void trace_print_events(FILE *stream, fprintf_function stream_printf)