[collectd] collectd 5.3.0 / snmp.c - Unable to compile ("ISO C90 forbids mixed declarations and code")

Andreas Maus a.maus at science-computing.de
Fri Apr 12 11:03:17 CEST 2013

Good morning.

I've tried to compile the brand new collectd 5.3.0 on RHEL5
which failed with:

[.. snipp ...]
cc1: warnings being treated as errors
snmp.c: In function 'csnmp_read_table':
snmp.c:1381: warning: ISO C90 forbids mixed declarations and code
make[3]: *** [snmp_la-snmp.lo] Error 1
[.. snipp ...]

Although this is just a warning, collectd uses -Werror for
the gcc compiler which will result in this error.

Looking at the offending line, it seems that the
declaration is not neccessary. At least in the
code block.

[... snipp ...]
1379         /* Calculate the current suffix. This is later used to check that the
1380          * suffix is increasing. This also checks if we left the subtree */
1381         int ret;
1382         ret = csnmp_oid_suffix (&suffix, &vb_name, data->values + i);
1383         if (ret != 0)
1384         {
[... snipp ...]

Is there a way (except removing the -Werror option) to get a shiny new collectd
with SNMP?

Many thanks in advance,


Dipl.-Ing. Andreas Maus             science+computing ag
System Administration               Hagellocher Weg 73
tel.: +49 7071 9457 671             72070 Tuebingen, Germany
fax: +49 7071 9457 411              www.science-computing.de
Vorstandsvorsitzender/Chairman of the board of management:
Gerd-Lothar Leonhart
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Michael Heinrichs, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Philippe Miltin
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196

More information about the collectd mailing list