[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification |
Date: |
Tue, 23 Jul 2013 22:52:26 +0100 |
On 23 July 2013 22:36, Alexander Graf <address@hidden> wrote:
>
>
> Am 23.07.2013 um 23:16 schrieb Peter Maydell <address@hidden>:
>
>> On 23 July 2013 20:15, Peter Maydell <address@hidden> wrote:
>>> I had a thought about this. Suppose we have our class header
>>> files do something like this:
>>>
>>> #ifdef MYCLASS_IMPLEMENTATION
>>> #define PRIVATE
>>> #else
>>> #ifdef __GNUC__
>>> #define PRIVATE __attribute__((deprecated("this is a private field")))
>>> #else
>>> #define PRIVATE
>>> #endif
>>>
>>> typedef struct MyObject {
>>> int publicfield;
>>> int privatefield PRIVATE;
>>> } MyObject;
>>
>> Forgot to say, but if people don't think this is an
>> intrinsically terrible idea I'll put together a patch that
>> does this sometime this week.
>
> I like the idea, but could we make this slightly less upper case? Something
> like
>
> __private int privatefield;
>
> feels more readable imho.
Well, __ is using the reserved namespace, but we could use something
else, and it looks like gcc lets us put the attribute at the front.
Since we'll want to undef whatever we pick after the struct is defined
we can actually use pretty much anything without worrying about it
stealing namespace.
(We could even use just 'private' if we didn't mind (a) not being
able to compile with a C++ compiler and (b) confusing everybody
completely :-))
> Or maybe
>
> struct MyObject {
> PUBLIC_FIELDS
> __field int publicfield;
> PRIVATE_FIELDS
> __field int privatefield;
> }
I can't see an obvious way to make those do the right
thing with the C preprocessor... am I missing something?
-- PMM
- [Qemu-devel] [PATCH v2 12/16] cpu/a15mpcore: QOM cast cleanup, (continued)
- [Qemu-devel] [PATCH v2 12/16] cpu/a15mpcore: QOM cast cleanup, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 14/16] cpu/a15mpcore: Embed GICState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 13/16] cpu/a15mpcore: Split off instance_init, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 15/16] cpu/a15mpcore: Convert to QOM realize, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 09/16] cpu/a9mpcore: Embed ARMMPTimerState, Andreas Färber, 2013/07/22
- [Qemu-devel] [PATCH v2 16/16] cpu/a15mpcore: Prepare for QOM embedding, Andreas Färber, 2013/07/22
- Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification, Peter Maydell, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification, Andreas Färber, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification, Peter Maydell, 2013/07/23
- Re: [Qemu-devel] [PATCH v2 00/16] arm: A9MPCore+A15MPCore QOM'ification, Andreas Färber, 2013/07/23