Hello, Based on suggestions from Igor Mitsyanko, Anthony and Alex this series aims to expose debug output to compile-testing, so that it doesn't constantly break. The basic requirement is to move format strings and arguments out of #ifdef sections or no-op macros, so that the C compiler sees and checks them and doesn't need even more #ifdefs for variable definitions.
For one thing this is to catch format string breakages caused by type changes, so that debug output still can be enabled when needed. For another it is to assist in catching refactored, e.g., CPU_COMMON fields, to not break things further in new patches. v2 replaces macros with static functions, adopting Scott's scheme of const variables set through #ifdefs (keeping their defined() semantics) and adopting Anthony's proposal of using va_list for argument passing. v1 had changed some #ifdefs into ifs due to the #ifdef -> #if change; while not strictly necessary anymore, I have not reverted this (mostly sparc). In sparc and unicore32 macros remain as unconditional wrappers, due to hardcoded prefix strings and __func__ prefix respectively. dprintf() is available in glibc since 2.10, so we cannot use that function name. After this series for target-*, some more dprintf occurrences remain in: * hw/s390-virtio{,-bus}.c * hw/spapr_{llan,vio,vscsi}.c * spice-qemu-char.c whereas linux-user is actually using the glibc function. Patches 1-2 are more bug fixes found by enabling today's debug output. Alex, please apply to ppc-next. Patch 3 introduces a missing qemu-log varargs function variant. Patches 4-5 are preparatory Coding Style cleanups. Patches 6-15 do the actual macro refactoring per target. Available from: git://github.com/afaerber/qemu-cpu.git dprintf.v2 https://github.com/afaerber/qemu-cpu/commits/dprintf.v2 Regards, Andreas v1 -> v2: * Fixed some more broken ppc debug output. * Prepended patch to add qemu_log_mask_vprintf(). * Replaced macros with functions, dropping all G_STMT_{START,END} and do {...} while(0) silliness and marking with GCC_FMT_ATTR(). * Renamed dprintf() in target-ppc/kvm.c and target-s390x/kvm.c to kvm_dprintf() to avoid conflicts with glibc's dprintf(). * Inlined PPC_DUMP_SPR_ACCESSES checks to avoid further regressions. >From qemu-log patch v1: * Added gtk-doc documentation. Cc: Anthony Liguori <anth...@codemonkey.ws> Cc: Blue Swirl <blauwir...@gmail.com> Cc: Igor Mitsyanko <i.mitsya...@samsung.com> Cc: Fréderic Konrad <fred.kon...@greensocs.com> Cc: Alexander Graf <ag...@suse.de> Cc: Scott Wood <scottw...@freescale.com> Cc: Markus Armbruster <arm...@redhat.com> Cc: Peter Maydell <peter.mayd...@linaro.org> Cc: Edgar E. Iglesias <edgar.igles...@gmail.com> (cris, mblaze) Cc: qemu-...@nongnu.org Cc: Richard Henderson <r...@twiddle.net> (i386, s390x) Cc: Michael Walle <mich...@walle.cc> (lm32) Cc: Peter Crosthwaite <peter.crosthwa...@xilinx.com> (mblaze) Cc: Jia Liu <pro...@gmail.com> (or32) Cc: Guan Xuetao <g...@mprc.pku.edu.cn> (uc32) Cc: Gerd Hoffmann <kra...@redhat.com> (spice) Cc: David Gibson <da...@gibson.dropbear.id.au> (sPAPR) Cc: Paolo Bonzini <pbonz...@redhat.com> (sPAPR vSCSI) Cc: Christian Borntraeger <borntrae...@de.ibm.com> (s390x) Andreas Färber (15): target-ppc: Fix PPC_DUMP_SPR_ACCESS build target-ppc: Move PPC_DUMP_CPU to translate.c qemu-log: Introduce qemu_log_mask_vprintf() target-cris/helper.c: Update Coding Style target-cris/mmu.c: Update Coding Style of cris_mmu_translate_page() target-alpha: Refactor debug output macros target-cris: Refactor debug output macros target-i386: Refactor debug output macros target-lm32: Refactor debug output macros target-microblaze: Refactor debug output macros target-openrisc: Refactor debug output macros target-ppc: Refactor debug output macros target-s390x: Refactor debug output macros target-sparc: Refactor debug output macros target-unicore32: Refactor debug output macros include/qemu/log.h | 16 ++ target-alpha/translate.c | 14 +- target-cris/helper.c | 421 +++++++++++++++++++++-------------------- target-cris/mmu.c | 342 +++++++++++++++++---------------- target-cris/op_helper.c | 16 +- target-cris/translate.c | 23 +-- target-i386/helper.c | 42 ++-- target-i386/kvm.c | 16 +- target-i386/seg_helper.c | 24 ++- target-lm32/translate.c | 14 +- target-microblaze/helper.c | 48 ++++- target-microblaze/mmu.c | 38 ++-- target-microblaze/op_helper.c | 2 - target-microblaze/translate.c | 14 +- target-openrisc/translate.c | 14 +- target-ppc/excp_helper.c | 30 ++- target-ppc/kvm.c | 28 ++- target-ppc/mem_helper.c | 2 - target-ppc/mmu_helper.c | 71 +++++-- target-ppc/translate.c | 16 +- target-ppc/translate_init.c | 41 ++-- target-s390x/cc_helper.c | 14 +- target-s390x/fpu_helper.c | 7 - target-s390x/helper.c | 53 ++++-- target-s390x/int_helper.c | 14 +- target-s390x/kvm.c | 33 ++-- target-s390x/mem_helper.c | 14 +- target-s390x/misc_helper.c | 14 +- target-s390x/translate.c | 23 +-- target-sparc/cpu.c | 38 ++-- target-sparc/ldst_helper.c | 221 ++++++++++++--------- target-unicore32/helper.c | 18 +- target-unicore32/softmmu.c | 17 +- 33 Dateien geändert, 1063 Zeilen hinzugefügt(+), 635 Zeilen entfernt(-) -- 1.7.10.4