Now that all offenders have been cleaned, turn on a syntax-check
rule to prevent future offenders.
* cfg.mk (sc_prohibit_static_zero_init): New rule.
* src/qemu/qemu_driver.c (qemuDomainBlockJobImpl): Avoid false
positive.
Signed-off-by: Eric Blake <eblake@redhat.com>
halt='Put space between closing parenthesis and opening brace' \
$(_sc_search_regexp)
+# C guarantees that static variables are zero initialized, and some compilers
+# waste space by sticking explicit initializers in .data instead of .bss
+sc_prohibit_static_zero_init:
+ @prohibit='\bstatic\b.*= *(0[^xX0-9]|NULL|false)' \
+ in_vc_files='\.[chx](\.in)?$$' \
+ halt='static variables do not need explicit zero initialization'\
+ $(_sc_search_regexp)
+
# FreeBSD exports the "devname" symbol which produces a warning.
sc_prohibit_devname:
@prohibit='\bdevname\b' \
* that back into the return status of this API call. */
while (1) {
/* Poll every 50ms */
- static struct timespec ts = { .tv_sec = 0,
- .tv_nsec = 50 * 1000 * 1000ull };
+ static struct timespec ts = {
+ .tv_sec = 0,
+ .tv_nsec = 50 * 1000 * 1000ull };
virDomainBlockJobInfo dummy;
qemuDomainObjEnterMonitor(driver, vm);