diff mbox

trace: Fix build warnings for Win32 build

Message ID 1392925465-14498-1-git-send-email-peter.maydell@linaro.org
State New
Headers show

Commit Message

Peter Maydell Feb. 20, 2014, 7:44 p.m. UTC
The Win32 build warns about trace/control-internal.h:

warning: 'trace_event_count' declared inline after being called

Fix this by simply reordering trace_event_id() and
trace_event_count().

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 trace/control-internal.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Stefan Weil Feb. 20, 2014, 9:41 p.m. UTC | #1
Am 20.02.2014 20:44, schrieb Peter Maydell:
> The Win32 build warns about trace/control-internal.h:
> 
> warning: 'trace_event_count' declared inline after being called
> 
> Fix this by simply reordering trace_event_id() and
> trace_event_count().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  trace/control-internal.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)


Reviewed-by: Stefan Weil <sw@weilnetz.de>

This is not OS specific, but depends on the compiler. MinGW-w64 uses a
newer gcc which does not complain. Reordering the two function is
reasonable nevertheless.

Regards
Stefan
Stefan Hajnoczi Feb. 21, 2014, 10:07 a.m. UTC | #2
On Thu, Feb 20, 2014 at 07:44:25PM +0000, Peter Maydell wrote:
> The Win32 build warns about trace/control-internal.h:
> 
> warning: 'trace_event_count' declared inline after being called
> 
> Fix this by simply reordering trace_event_id() and
> trace_event_count().
> 
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
>  trace/control-internal.h | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan
diff mbox

Patch

diff --git a/trace/control-internal.h b/trace/control-internal.h
index cce2da4..b3f587e 100644
--- a/trace/control-internal.h
+++ b/trace/control-internal.h
@@ -16,15 +16,15 @@ 
 extern TraceEvent trace_events[];
 
 
-static inline TraceEvent *trace_event_id(TraceEventID id)
+static inline TraceEventID trace_event_count(void)
 {
-    assert(id < trace_event_count());
-    return &trace_events[id];
+    return TRACE_EVENT_COUNT;
 }
 
-static inline TraceEventID trace_event_count(void)
+static inline TraceEvent *trace_event_id(TraceEventID id)
 {
-    return TRACE_EVENT_COUNT;
+    assert(id < trace_event_count());
+    return &trace_events[id];
 }
 
 static inline bool trace_event_is_pattern(const char *str)