Replace comma with semicolon in trace/simple.c

Bug #1798659 reported by Oren Milman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
QEMU
Fix Released
Undecided
Unassigned

Bug Description

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.

Revision history for this message
Thomas Huth (th-huth) wrote :

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,

summary: - A typo in trace/simple.c
+ Replace comma with semicolon in trace/simple.c
Revision history for this message
Peter Maydell (pmaydell) wrote :

Fixed in commit 7ff5920717d413d8b7c3ba13d9, which will be in the upcoming 4.0 release.

Changed in qemu:
status: New → Fix Committed
Thomas Huth (th-huth)
Changed in qemu:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.