[libvirt] [PATCH] Workaround apibuild.py warnings
Matthias Bolte
matthias.bolte at googlemail.com
Tue May 31 14:20:21 UTC 2011
2011/5/31 Daniel Veillard <veillard at redhat.com>:
> On Tue, May 31, 2011 at 10:43:16AM +0200, Matthias Bolte wrote:
>> 2011/5/31 Daniel Veillard <veillard at redhat.com>:
>> > On Sun, May 29, 2011 at 05:14:46PM +0200, Matthias Bolte wrote:
>> >> Parsing ./../include/libvirt/libvirt.h
>> >> Misformatted macro comment for _virSchedParameter
>> >> Expecting '* _virSchedParameter:' got '* virSchedParameter:'
>> >> Misformatted macro comment for _virBlkioParameter
>> >> Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
>> >> Misformatted macro comment for _virMemoryParameter
>> >> Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
>> >>
>> >> Replace '#define' with '# define' for the backward compatibility
>> >> defines to keep apibuild.py from parsing them and expecting
>> >> documentation comments for them.
>> >> ---
>> >> include/libvirt/libvirt.h.in | 6 +++---
>> >> 1 files changed, 3 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
>> >> index 8058229..424e49b 100644
>> >> --- a/include/libvirt/libvirt.h.in
>> >> +++ b/include/libvirt/libvirt.h.in
>> >> @@ -2569,7 +2569,7 @@ typedef enum {
>> >> * Provided for backwards compatibility; virTypedParameter is the
>> >> * preferred alias since 0.9.2.
>> >> */
>> >> -#define _virSchedParameter _virTypedParameter
>> >> +# define _virSchedParameter _virTypedParameter
>> >> typedef struct _virTypedParameter virSchedParameter;
>> >>
>> >> /**
>> >> @@ -2613,7 +2613,7 @@ typedef enum {
>> >> * Provided for backwards compatibility; virTypedParameter is the
>> >> * preferred alias since 0.9.2.
>> >> */
>> >> -#define _virBlkioParameter _virTypedParameter
>> >> +# define _virBlkioParameter _virTypedParameter
>> >> typedef struct _virTypedParameter virBlkioParameter;
>> >>
>> >> /**
>> >> @@ -2657,7 +2657,7 @@ typedef enum {
>> >> * Provided for backwards compatibility; virTypedParameter is the
>> >> * preferred alias since 0.9.2.
>> >> */
>> >> -#define _virMemoryParameter _virTypedParameter
>> >> +# define _virMemoryParameter _virTypedParameter
>> >> typedef struct _virTypedParameter virMemoryParameter;
>> >
>> > That's a bit odd ... it should be possibe to avoid those complaints
>> > from the generator, I can't look right now though
>> >
>> > Daniel
>>
>> Well, yes this was more like a hackish approach. Here's a v2 that
>> allows apibuild.py to ignore macros like it can already ignore
>> functions.
>>
>> Matthias
>
>> From ac679b3a929c22ae6cd3bf8733f57dca408f4e3b Mon Sep 17 00:00:00 2001
>> From: Matthias Bolte <matthias.bolte at googlemail.com>
>> Date: Tue, 31 May 2011 10:41:37 +0200
>> Subject: [PATCH] Ignore backward compatibility macros in apibuild.py
>>
>> This fixes this three warnings from the parser by allowing the parser
>> to ignore some macros in the same way as it can ignore functions.
>>
>> Parsing ./../include/libvirt/libvirt.h
>> Misformatted macro comment for _virSchedParameter
>> Expecting '* _virSchedParameter:' got '* virSchedParameter:'
>> Misformatted macro comment for _virBlkioParameter
>> Expecting '* _virBlkioParameter:' got '* virBlkioParameter:'
>> Misformatted macro comment for _virMemoryParameter
>> Expecting '* _virMemoryParameter:' got '* virMemoryParameter:'
>> ---
>> docs/apibuild.py | 10 ++++++++++
>> 1 files changed, 10 insertions(+), 0 deletions(-)
>>
>> diff --git a/docs/apibuild.py b/docs/apibuild.py
>> index 2ab0599..f160c47 100755
>> --- a/docs/apibuild.py
>> +++ b/docs/apibuild.py
>> @@ -58,6 +58,12 @@ ignored_functions = {
>> "virEventRemoveTimeout": "internal function in event.c",
>> }
>>
>> +ignored_macros = {
>> + "_virSchedParameter": "backward compatibility macro for virTypedParameter",
>> + "_virBlkioParameter": "backward compatibility macro for virTypedParameter",
>> + "_virMemoryParameter": "backward compatibility macro for virTypedParameter",
>> +}
>> +
>> def escape(raw):
>> raw = string.replace(raw, '&', '&')
>> raw = string.replace(raw, '<', '<')
>> @@ -716,8 +722,12 @@ class CParser:
>> # Parse a comment block associate to a macro
>> #
>> def parseMacroComment(self, name, quiet = 0):
>> + global ignored_macros
>> +
>> if name[0:2] == '__':
>> quiet = 1
>> + if ignored_macros.has_key(name):
>> + quiet = 1
>>
>> args = []
>> desc = ""
>
> Excellent, thanks ! ACK :-)
>
> Daniel
>
Thanks, pushed.
Matthias
More information about the libvir-list
mailing list