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(a)redhat.com>
---
cfg.mk | 8 ++++++++
src/qemu/qemu_driver.c | 5 +++--
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 682687a..927240b 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -962,6 +962,14 @@ sc_prohibit_paren_brace:
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' \
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5eccacc..2606dd0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -15578,8 +15578,9 @@ qemuDomainBlockJobImpl(virDomainObjPtr vm,
* 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);
--
1.9.3