On 05/30/2011 07:03 AM, Matthias Bolte wrote:
From 3bb05f7543f86e3b47772f0fabecbda4f167b3bc Mon Sep 17 00:00:00
2001
From: Matthias Bolte <matthias.bolte(a)googlemail.com>
Date: Mon, 30 May 2011 14:36:41 +0200
Subject: [PATCH] apibuild: Restrict long usage to existing functions and struct
New APIs have to use long long instead of long.
Also make apibuild errors fatal.
---
docs/Makefile.am | 2 +-
docs/apibuild.py | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 1 deletions(-)
Now reviewing patch 2, assuming that you go with 1B.
diff --git a/docs/Makefile.am b/docs/Makefile.am
index 59ae685..a98f08d 100644
--- a/docs/Makefile.am
+++ b/docs/Makefile.am
@@ -179,7 +179,7 @@ $(python_generated_files): $(srcdir)/apibuild.py \
$(srcdir)/../include/libvirt/*.h \
$(srcdir)/../src/libvirt.c \
$(srcdir)/../src/util/virterror.c
- -srcdir=$(srcdir) $(srcdir)/apibuild.py
+ srcdir=$(srcdir) $(srcdir)/apibuild.py
While you're touching this line, how about we also modify it to use
$(AM_V_GEN)
+++ b/docs/apibuild.py
@@ -1480,6 +1480,77 @@ class CParser:
self.signature = signature
return token
+ # this dict contains the functions that are allowed to use [unsigend]
+ # long for legacy reasons in their signature and return type. this list is
+ # fixed. new procedures and public APIs have to use [unsigend] long long
s/unsigend/unsigned/ twice (copy and paste from the last patch? :)
+ long_legacy_functions = \
+ { "virGetVersion" : (False, ("libVer",
"typeVer")),
+ "virConnectGetLibVersion" : (False, ("libVer")),
+ "virConnectGetVersion" : (False, ("hvVer")),
+ "virDomainGetMaxMemory" : (True, ()),
+ "virDomainMigrate" : (False, ("flags",
"bandwidth")),
+ "virDomainMigrate2" : (False, ("flags",
"bandwidth")),
+ "virDomainMigrateBegin3" : (False, ("flags",
"bandwidth")),
Same query to danpb about whether new migration v3 APIs should avoid
'long', and same independent patch to fix that issue.
+
+ # this dict contains the structs that are allowed to use [unsigend]
+ # long for legacy reasons. this list is fixed. new structs have to use
+ # [unsigend] long long
s/unsigend/unsigned/ twice
ACK with the spelling nits fixed.
--
Eric Blake eblake(a)redhat.com +1-801-349-2682
Libvirt virtualization library
http://libvirt.org