[collectd] cpu.c is actually C99

Konstantin Tokarev annulen at yandex.ru
Fri Nov 24 19:51:52 CET 2017



27.10.2017, 19:59, "Michael Shigorin" <mike at altlinux.org>:
>         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

...and compilers without C99 support remain unusable for many software packages

https://github.com/collectd/collectd/blob/master/README#L709-L710

>
> 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
>
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> https://mailman.verplant.org/listinfo/collectd

-- 
Regards,
Konstantin



More information about the collectd mailing list