Re: [Qemu-devel] [RFC PATCH 02/10] Fix errors and warnings while compiling with c++ compilier

2013-02-15 Thread Paolo Bonzini
Il 15/02/2013 04:56, Tomoki Sekiyama ha scritto:
> 
>> > Now, is using C++ required? Why can't you use plain C?
> It is because Windows COM+ framework (which VSS uses) is designed based
> on C++ objective programming interface. Implementing this with plain C
> is theoretically possible, but that will require parsing C++ objects'
> vtables manually so the code would be much complex.
> (However, It might be possible to push Windows-specific C++ stuff into
>  a DLL to and avoid involving qemu related headers.)

I don't think this is necessary.  Use C++ where you see fit, as long as
it's a separate file it should not be a problem.

The only problem could be that we need to use the C++ compiler to link,
instead of the C compiler.

Paolo



Re: [Qemu-devel] [RFC PATCH 02/10] Fix errors and warnings while compiling with c++ compilier

2013-02-14 Thread Tomoki Sekiyama
On 2013/02/14 21:27, Luiz Capitulino wrote:
> On Thu, 14 Feb 2013 15:10:36 +0900
> Tomoki Sekiyama  wrote:
> 
>> Rename 'class' member in class_info of PciDeviceInfo to 'dev_class', and
>> add some casts to avoid errors from c++ compiler.
> 
> [...]
> 
>>  #
>>  # @class_info.desc: #optional a string description of the device's class
>>  #
>> -# @class_info.class: the class code of the device
>> +# @class_info.dev_class: the class code of the device
>>  #
>>  # @id.device: the PCI device id
>>  #
>> @@ -1171,7 +1171,7 @@
>>  ##
>>  { 'type': 'PciDeviceInfo',
>>'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
>> -   'class_info': {'*desc': 'str', 'class': 'int'},
>> +   'class_info': {'*desc': 'str', 'dev_class': 'int'},
>> 'id': {'device': 'int', 'vendor': 'int'},
>> '*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo',
>> 'regions': ['PciMemoryRegion']} }
> 
> The right way of doing this is to add 'class' to the set of reserved
> words in scripts/qapi.py:c_var(). Then you'll have to adapt the code to
> use the 'q_' prefix.

Thank you for the information, I will try that.

> Now, is using C++ required? Why can't you use plain C?

It is because Windows COM+ framework (which VSS uses) is designed based
on C++ objective programming interface. Implementing this with plain C
is theoretically possible, but that will require parsing C++ objects'
vtables manually so the code would be much complex.
(However, It might be possible to push Windows-specific C++ stuff into
 a DLL to and avoid involving qemu related headers.)

Thanks,
-- 
Tomoki Sekiyama




Re: [Qemu-devel] [RFC PATCH 02/10] Fix errors and warnings while compiling with c++ compilier

2013-02-14 Thread Luiz Capitulino
On Thu, 14 Feb 2013 15:10:36 +0900
Tomoki Sekiyama  wrote:

> Rename 'class' member in class_info of PciDeviceInfo to 'dev_class', and
> add some casts to avoid errors from c++ compiler.

[...]

>  #
>  # @class_info.desc: #optional a string description of the device's class
>  #
> -# @class_info.class: the class code of the device
> +# @class_info.dev_class: the class code of the device
>  #
>  # @id.device: the PCI device id
>  #
> @@ -1171,7 +1171,7 @@
>  ##
>  { 'type': 'PciDeviceInfo',
>'data': {'bus': 'int', 'slot': 'int', 'function': 'int',
> -   'class_info': {'*desc': 'str', 'class': 'int'},
> +   'class_info': {'*desc': 'str', 'dev_class': 'int'},
> 'id': {'device': 'int', 'vendor': 'int'},
> '*irq': 'int', 'qdev_id': 'str', '*pci_bridge': 'PciBridgeInfo',
> 'regions': ['PciMemoryRegion']} }

The right way of doing this is to add 'class' to the set of reserved
words in scripts/qapi.py:c_var(). Then you'll have to adapt the code to
use the 'q_' prefix.

Now, is using C++ required? Why can't you use plain C?