[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] RFC: mass comment conversion from C99 to C89
From: |
Laurent Vivier |
Subject: |
Re: [Qemu-devel] RFC: mass comment conversion from C99 to C89 |
Date: |
Sat, 15 Jan 2011 18:20:15 +0100 |
Le samedi 15 janvier 2011 à 16:02 +0000, Blue Swirl a écrit :
> With the sed script below (my first I think), I'm able to convert most
nice script. Did you try awk ?
> files in QEMU from C99 comment style to C89. When successive line with
> C99 comments are converted, the comments are merged. Two files
[ This remembers me the port of gstreamer to AIX using xlc, which was
C89 only... ]
> (hw/rtl8139.c and microblaze-dis.c) still fail.
>
> Is this a good idea?
I think line like:
//#define DEBUG
should be changed to
#if 0
#define DEBUG
#endif
as it is not really a comment but a flag.
Of course a new challenge appears: identify block of following
"//#define" (like in linux-user/sparc64/termbits.h ;-) )
> If yes, what should be the commit approach? This could be split very
> easily even into 141 patch series if desired, but probably a
> combination of per directory patches would make more sense.
>
> Most files only have a few C99 comments, the worst offenders hide in
> target-sparc. ;-)
>
> block.c | 42 +--
> block/bochs.c | 44 +--
> block/curl.c | 24 -
> block/parallels.c | 6
> block/qcow2.h | 2
> block/vdi.c | 4
> block/vmdk.c | 40 +--
> block/vpc.c | 94 +++----
> block/vvfat.c | 2
> bsd-user/bsd-mman.h | 2
> bsd-user/elfload.c | 4
> bsd-user/main.c | 14 -
> bsd-user/qemu.h | 8
> bsd-user/x86_64/syscall.h | 2
> check-qdict.c | 14 -
> check-qfloat.c | 2
> check-qint.c | 2
> check-qlist.c | 6
> check-qstring.c | 2
> cpu-exec.c | 64 ++--
> darwin-user/main.c | 4
> darwin-user/syscall.c | 18 -
> exec.c | 2
> hw/acpi_piix4.c | 4
> hw/bitbang_i2c.c | 2
> hw/cirrus_vga.c | 468 ++++++++++++++++++------------------
> hw/cs4231.c | 8
> hw/cuda.c | 2
> hw/e1000.c | 50 +--
> hw/eccmemctl.c | 2
> hw/eeprom93xx.c | 4
> hw/escc.c | 56 ++--
> hw/esp.c | 8
> hw/etraxfs_dma.c | 6
> hw/fdc.c | 4
> hw/firmware_abi.h | 6
> hw/fmopl.c | 10
> hw/grackle_pci.c | 2
> hw/hpet.c | 10
> hw/hw.h | 2
> hw/ide/ahci.c | 2
> hw/ide/cmd646.c | 6
> hw/ide/core.c | 2
> hw/ide/piix.c | 2
> hw/integratorcp.c | 2
> hw/lan9118.c | 4
> hw/m48t59.c | 8
> hw/mac_nvram.c | 8
> hw/macio.c | 2
> hw/mips_malta.c | 4
> hw/ne2000.c | 2
> hw/omap_sx1.c | 2
> hw/openpic.c | 10
> hw/pcnet-pci.c | 2
> hw/pflash_cfi01.c | 4
> hw/pflash_cfi02.c | 8
> hw/piix4.c | 14 -
> hw/piix_pci.c | 10
> hw/ppc.c | 2
> hw/ppc405_boards.c | 6
> hw/ppc405_uc.c | 4
> hw/ppc440.c | 2
> hw/ppc_prep.c | 16 -
> hw/prep_pci.c | 8
> hw/qxl.c | 2
> hw/rtl8139.c | 64 ++--
> hw/scsi-disk.c | 40 +--
> hw/slavio_intctl.c | 16 -
> hw/slavio_misc.c | 6
> hw/slavio_timer.c | 68 ++---
> hw/smbios.h | 2
> hw/sun4m.c | 48 +--
> hw/sun4m_iommu.c | 4
> hw/sun4u.c | 34 +-
> hw/syborg_timer.c | 2
> hw/tc6393xb.c | 18 -
> hw/tcx.c | 6
> hw/unin_pci.c | 24 -
> hw/usb-serial.c | 26 +-
> hw/usb-uhci.c | 6
> hw/vga-pci.c | 4
> hw/virtio-net.c | 4
> hw/virtio-net.h | 12
> hw/xen.h | 6
> hw/xen_domainbuild.c | 6
> linux-user/alpha/syscall.h | 14 -
> linux-user/elfload.c | 2
> linux-user/main.c | 4
> linux-user/signal.c | 26 +-
> linux-user/socket.h | 2
> linux-user/x86_64/syscall.h | 2
> microblaze-dis.c | 30 +-
> monitor.c | 2
> net-checksum.c | 6
> net/checksum.c | 6
> net/tap-solaris.c | 2
> net/tap-win32.c | 50 +--
> qemu-char.c | 2
> qemu-img.c | 2
> qemu-option.c | 14 -
> qemu-timer.c | 8
> qerror.c | 2
> target-alpha/translate.c | 18 -
> target-i386/kvm.c | 2
> target-i386/op_helper.c | 6
> target-m68k/translate.c | 4
> target-microblaze/helper.c | 2
> target-mips/cpu.h | 6
> target-mips/op_helper.c | 30 +-
> target-mips/translate.c | 202 +++++++--------
> target-mips/translate_init.c | 6
> target-ppc/helper.c | 8
> target-ppc/machine.c | 4
> target-ppc/op_helper.c | 4
> target-ppc/translate.c | 36 +-
> target-ppc/translate_init.c | 10
> target-s390x/exec.h | 2
> target-sh4/op_helper.c | 4
> target-sparc/cpu.h | 26 +-
> target-sparc/helper.c | 74 ++---
> target-sparc/machine.c | 4
> target-sparc/op_helper.c | 552
> +++++++++++++++++++++----------------------
> target-sparc/translate.c | 220 ++++++++---------
> tcg/arm/tcg-target.h | 8
> tcg/hppa/tcg-target.h | 4
> tcg/i386/tcg-target.h | 20 -
> tcg/s390/tcg-target.h | 24 -
> tcg/sparc/tcg-target.c | 12
> tcg/sparc/tcg-target.h | 46 +--
> tcg/tcg.c | 2
> tests/cris/sys.c | 2
> tests/linux-test.c | 2
> tests/qruncom.c | 6
> tests/runcom.c | 2
> ui/keymaps.c | 6
> ui/sdl.c | 4
> ui/vnc-enc-tight.c | 4
> ui/vnc-enc-zlib.c | 22 -
> ui/vnc.h | 2
> usb-bsd.c | 4
> vl.c | 2
> 141 files changed, 1570 insertions(+), 1570 deletions(-)
>
>
> #!/bin/sed -nf
>
> :restart
> # convert // to /* */
> s/\(^\|[^:"]\)\/\/[ ]*\([^#].*\)$/\1\/* \2 *\//; t convertedfirst
> p
> b end
>
> :convertedfirst
> # match */ at the end of line
> s/\(\*\/$\)/\1/; t firstfound
> p
> b end
>
> :firstfound
> h
> n
>
> # convert // to /* */
> s/\(^\|[^:"]\)\/\/[ ]*\([^#].*\)$/\1\/* \2 *\//; t ignorematch
>
> :ignorematch
> # match /* at the beginning of line
> s/^\( *\/\*.*\)/\1/; t secondfound
> x
> p
> x
> b convertedfirst
>
> # found both
> :secondfound
> x
> # delete */ at the end of line
> s/ *\*\/$//
> p
> x
> # delete /* at the beginning of line
> s/^\( *\)\/\*/\1 /
> b convertedfirst
>
> :end
>
--
--------------------- address@hidden ----------------------
"Tout ce qui est impossible reste à accomplir" Jules Verne
"Things are only impossible until they're not" Jean-Luc Picard