Re: [PATCH] domain_capabilities: Assert enums fit into unsigned int bitmask

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

 



On 11/19/20 9:48 AM, Erik Skultety wrote:

where VIR_DECLARE_MEMBER() would assert() that 1 <<
VIR_DOMAIN_VIDEO_TYPE_LAST fits into 'unsigned int' (or whatever type we
will use), and also declare 'modelType' member for the struct. I'm not sure
a tags generator would be capable of seeing that.

Why do you have to do both at the same time? Why not putting the assert right
after the virDomainVideoType enum typedef? I think it's much more obvious if
the guard comes right after what it actually guards.

You mean to put the assert into domain_conf.h? I'm not sure it would make sense. Because the assert actually guides virDomainCapsEnum struct and the way we store info there and not virDomainVideoType per se. For instance for enums not (yet) exposed on domCaps we don't care about their size.

Moreover, if I leave those asserts where they are now, then during compilation the compiler reports error right where the problem is and not at a place where it leaves you wondering why the assert is there.

Michal




[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]

  Powered by Linux