Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Blue Swirl
On Tue, Jan 29, 2013 at 9:56 AM, Peter Maydell wrote: > On 29 January 2013 08:42, Andreas Färber wrote: >> Am 28.01.2013 22:10, schrieb Peter Maydell: >> Where we disagree is that you suggest that do { ... while (0) is any >> better than G_STMT_START ... G_STMT_END. I disagree and find *both* >>

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Markus Armbruster
Andreas Färber writes: > Am 29.01.2013 11:03, schrieb Markus Armbruster: >> Andreas Färber writes: >> >>> b) Working around an issue resulting from hiding C statements inside a >>> preprocessor macro is totally backwards compared to properly using the C >>> language in the first place. Its mech

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Andreas Färber
Am 29.01.2013 10:56, schrieb Peter Maydell: > On 29 January 2013 08:42, Andreas Färber wrote: >> Analysing the reasons for the obscured suggestion: >> >> a) "if (foo) MACRO1(); else MACRO2();" is forbidden by Coding Style. >> Thus, if careful review indicates there are no such Coding Style >> viol

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Andreas Färber
Am 29.01.2013 11:03, schrieb Markus Armbruster: > Andreas Färber writes: > >> b) Working around an issue resulting from hiding C statements inside a >> preprocessor macro is totally backwards compared to properly using the C >> language in the first place. Its mechanism for reuse are functions, a

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Markus Armbruster
Andreas Färber writes: > Am 28.01.2013 22:10, schrieb Peter Maydell: > [lengthy discussion of what may go wrong without do { ... } while (0)] > > We seem to to agree to disagree here. > > The use of an if (foo) { ... } inside Fred's macro (or my pseudocode?) > was what prompted this whole mess, s

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Peter Maydell
On 29 January 2013 08:42, Andreas Färber wrote: > Am 28.01.2013 22:10, schrieb Peter Maydell: > Where we disagree is that you suggest that do { ... while (0) is any > better than G_STMT_START ... G_STMT_END. I disagree and find *both* > obscuring the code. I clearly stated why.P > > Therefore I am

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Andreas Färber
Am 28.01.2013 22:10, schrieb Peter Maydell: [lengthy discussion of what may go wrong without do { ... } while (0)] We seem to to agree to disagree here. The use of an if (foo) { ... } inside Fred's macro (or my pseudocode?) was what prompted this whole mess, so there is no need to explain that to

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-29 Thread Markus Armbruster
Peter Maydell writes: > On 28 January 2013 19:14, Andreas Färber wrote: >> Am 28.01.2013 19:59, schrieb Peter Maydell: >>> Er, what? "do ... while (0)" is completely standard practice >>> for writing robust macros in C. Patches which don't do that >>> should fail code review. >> >> Oh really? No

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Peter Maydell
On 28 January 2013 19:14, Andreas Färber wrote: > Am 28.01.2013 19:59, schrieb Peter Maydell: >> Er, what? "do ... while (0)" is completely standard practice >> for writing robust macros in C. Patches which don't do that >> should fail code review. > > Oh really? None of our QOM cast macros use it

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Andreas Färber
Am 28.01.2013 19:22, schrieb Richard Henderson: > On 01/27/2013 05:32 AM, Andreas Färber wrote: >> Make LOG_DISAS() arguments compile-testable even if disabled. >> >> Signed-off-by: Andreas Färber >> --- >> target-alpha/translate.c | 12 ++-- >> 1 Datei geändert, 6 Zeilen hinzugefügt(

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Andreas Färber
Am 28.01.2013 19:59, schrieb Peter Maydell: > On 28 January 2013 18:54, Andreas Färber wrote: >> Am 28.01.2013 19:22, schrieb Richard Henderson: >>> On 01/27/2013 05:32 AM, Andreas Färber wrote: +#define LOG_DISAS(...) G_STMT_START \ +if (ALPHA_DEBUG_DISAS) { \ +qemu_log

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Andreas Färber
Am 28.01.2013 19:29, schrieb Peter Maydell: > On 28 January 2013 18:22, Richard Henderson wrote: >> On 01/27/2013 05:32 AM, Andreas Färber wrote: >>> +#define LOG_DISAS(...) G_STMT_START \ >>> +if (ALPHA_DEBUG_DISAS) { \ >>> +qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \ >>> +

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Peter Maydell
On 28 January 2013 18:54, Andreas Färber wrote: > Am 28.01.2013 19:22, schrieb Richard Henderson: >> On 01/27/2013 05:32 AM, Andreas Färber wrote: >>> +#define LOG_DISAS(...) G_STMT_START \ >>> +if (ALPHA_DEBUG_DISAS) { \ >>> +qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \ >>> +

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Peter Maydell
On 28 January 2013 18:22, Richard Henderson wrote: > On 01/27/2013 05:32 AM, Andreas Färber wrote: >> +#define LOG_DISAS(...) G_STMT_START \ >> +if (ALPHA_DEBUG_DISAS) { \ >> +qemu_log_mask(CPU_LOG_TB_IN_ASM, ## __VA_ARGS__); \ >> +} \ >> +G_STMT_END > > > I see zero advantage

Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-28 Thread Richard Henderson
On 01/27/2013 05:32 AM, Andreas Färber wrote: Make LOG_DISAS() arguments compile-testable even if disabled. Signed-off-by: Andreas Färber --- target-alpha/translate.c | 12 ++-- 1 Datei geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) Acked-by: Richard Henderson +#defin

[Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros

2013-01-27 Thread Andreas Färber
Make LOG_DISAS() arguments compile-testable even if disabled. Signed-off-by: Andreas Färber --- target-alpha/translate.c | 12 ++-- 1 Datei geändert, 6 Zeilen hinzugefügt(+), 6 Zeilen entfernt(-) diff --git a/target-alpha/translate.c b/target-alpha/translate.c index f687b95..c1da5bf 1