On 02/06/2014 11:09 AM, Christophe Fergeau wrote:
I've played a bit with adding some compile time checks to avoid this in the future,
but
while they work, they are a bit ugly-looking, and they would require some changes in
docs/apibuild.py to teach it to parse 1 << N, or to make it ignore values
in #ifdef VIR_ENUM_SENTINELS, so before spending too much time on this, I'd like to
know
if these checks would be a welcome/useful addition.
Hmm, we don't add pools every day.
+/* Check if VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE seems to
+ * contain all virConnectListAllStoragePoolsFlags elements
+ */
+verify(VIR_CONNECT_LIST_STORAGE_POOLS_LAST <
VIR_CONNECT_LIST_STORAGE_POOLS_FILTERS_POOL_TYPE);
+
+/* Check if virConnectListAllStorageFlags has one flag per known storage
+ * pool type */
+verify(1 << (5+VIR_STORAGE_POOL_LAST) == VIR_CONNECT_LIST_STORAGE_POOLS_LAST - 1);
Wow, that does look pretty ugly and hard-coded. At this point, I'm not
sure that adding it buys us much.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org