Re: [PATCH] Workaround apibuild.py warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/5/31 Daniel Veillard <veillard@xxxxxxxxxx>:
> 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@xxxxxxxxxxxxxx>
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, '&', '&amp;')
     raw = string.replace(raw, '<', '&lt;')
@@ -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 = ""
-- 
1.7.0.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]