1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
semantic: 0.775
mistranslation: 0.640
graphic: 0.498
assembly: 0.449
other: 0.431
instruction: 0.393
device: 0.352
vnc: 0.337
socket: 0.304
network: 0.201
boot: 0.153
KVM: 0.050
Replace comma with semicolon in trace/simple.c
In the master branch in trace/simple.c in writeout_thread (https://github.com/qemu/qemu/blob/master/trace/simple.c#L174) we currently have:
dropped.rec.length = sizeof(TraceRecord) + sizeof(uint64_t),
dropped.rec.pid = trace_pid;
It seems to me like a typo that the first line ends with a comma.
Currently this causes no harm, but I think this should be fixed.
It's perfect valid C to terminate a statement with "," instead of ";" - it just has a different meaning. Consider this:
#include <stdio.h>
int main()
{
if (0)
printf("Hello!\n"),
printf("Good bye!\n");
return 0;
}
At a first glance, you'd expect this program to print "Good bye!" - but it does not. Actually, the "," is used here to put the two printf statements into the same block, so this program is the same as:
if (0) {
printf("Hello!\n");
printf("Good bye!\n");
}
Thus, there is no real bug in simple.c here, but of course it would be better style to clean this up and use ";" instead.
By the way, two lines earlier there is another line ending in ",":
dropped.rec.event = DROPPED_EVENT_ID,
Fixed in commit 7ff5920717d413d8b7c3ba13d9, which will be in the upcoming 4.0 release.
|