[collectd] cpu.c is actually C99

Michael Shigorin mike at altlinux.org
Fri Jun 30 22:58:21 CEST 2017


	Hello,
stumbled upon this lcc error when building collectd for e2k arch:

  CC       cpufreq.lo
lcc: "cpu.c", line 443: error: expected an expression
                gauge_t rates[static COLLECTD_CPU_STATE_MAX])
                              ^

My colleague cited an explanation here:

---
This was a new overloaded meaning given to static in C99. It is more than a
decade and a half old, but not all compiler writers have embraced all of C99
features -- so C99 as a whole largely remains unknown. – Happy Green Kid Naps
--- https://stackoverflow.com/a/16314194/94687

lcc developers suggested an explicit -std=c99; leads to a bunch
of errors within client.c for me though with both lcc and gcc
then (can followup if interested, at least tomorrow -- leaving
for vacation soon).

Went with this kludgelet so far:

--- a/src/cpu.c
+++ b/src/cpu.c
 static void cpu_commit_one (int cpu_num, /* {{{ */
-               gauge_t rates[static COLLECTD_CPU_STATE_MAX])
+               gauge_t rates[])
 {

PS: glad to see the project strive!

-- 
 ---- WBR, Michael Shigorin / http://altlinux.org
  ------ http://opennet.ru / http://anna-news.info



More information about the collectd mailing list