Skip to contentSkip to conversation

trace: Fix build warnings for Win32 build

PATCH Applied Peter Maydell 3 participants 3 messages Feb 20, 2014 – Feb 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace: Fix build warnings for Win32 build

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().

---
 trace/control-internal.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
trace/control-internal.h +5 -5
index cce2da4..b3f587e 100644
@@ -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)
Signature · 1 line
1.8.5
Reviewed-by on v1 1/1
#1 lore raw

Am 20.02.2014 20:44, schrieb Peter Maydell:

Quoted 11 lines

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().

---
 trace/control-internal.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

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

#2 lore raw
In reply to Peter Maydell
Quoted 11 lines · 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().

---
 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