[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros |
Date: |
Tue, 29 Jan 2013 11:21:43 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130105 Thunderbird/17.0.2 |
Am 29.01.2013 11:03, schrieb Markus Armbruster:
> Andreas Färber <address@hidden> 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, and
>> for performance considerations static inline functions.
>
> Nobody denies inline functions are to be preferred in many cases.
>
> Valid exceptions include cases where we want genericity, which a macro
> can easily provide, but an inline function can't.
>
>> Therefore I disagree with you that b) is not an entirely different
>> disussion as you repeatedly suggest and that according to a) it is not
>> *generally* necessary to put do { ... } while (0) into any random macro
>> that one writes. It depends on the contents and on the context.
>
> I don't think Peter suggested to put do ... while (0) into random
> macros! He asked to put it exactly into *statement-like* macros, as per
> standard C practice. Most macros are expression-like.
Quoting PMM from last night:
<<<
"do ... while (0)" is completely standard practice
for writing robust macros in C. Patches which don't do that
should fail code review.
>>>
This is what sparked the most heated part of this debate! I completely
object to this generalized statement without restriction to
statement-like macros.
> I think you're overstating your case. Statement-like macros should be
> rare.
This RFC was just a beginning. An average 50%+ of per target-*/ files
contained macros that were touched here. Even more files are in hw/. Per
file it was up to ~5 such macro definitions. And my main issue is
deriving a convention for new files from this discussion.
Andreas
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, (continued)
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Andreas Färber, 2013/01/28
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Peter Maydell, 2013/01/28
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Andreas Färber, 2013/01/28
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Peter Maydell, 2013/01/28
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Markus Armbruster, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Andreas Färber, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Peter Maydell, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Andreas Färber, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Blue Swirl, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Markus Armbruster, 2013/01/29
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros,
Andreas Färber <=
- Re: [Qemu-devel] [RFC 10/19] target-alpha: Refactor debug output macros, Markus Armbruster, 2013/01/29
[Qemu-devel] [PATCH for-1.4 05/19] target-s390x: Fix debug output, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH RESEND for-1.4 01/19] target-cris: Build fix for debug output, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4 06/19] target-s390x: Fix debug output (continued), Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4 07/19] target-sparc: Fix debug output for DEBUG_MMU, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4? 09/19] target-cris/mmu.c: Update Coding Style of cris_mmu_translate_page(), Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 17/19] target-s390x: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [RFC 14/19] target-microblaze: Refactor debug output macros, Andreas Färber, 2013/01/27
[Qemu-devel] [PATCH for-1.4 02/19] target-ppc: Fix target_ulong vs. hwaddr format mismatches, Andreas Färber, 2013/01/27