Bug #3871
fix issues introduced by 3604
100%
Description
GCC 4.5.3 on Gentoo Linux did not like a few of the changes made in the issue 3604 patch. It printed an error and a couple of warnings:
../../cmd/zdb/zdb.c: In function 'dump_bpobj':
../../cmd/zdb/zdb.c:1257:3: error: 'for' loop initial declarations are only allowed in C99 mode
../../cmd/zdb/zdb.c:1257:3: note: use option -std=c99 or -std=gnu99 to compile your code
../../cmd/zdb/zdb.c: In function 'dump_deadlist':
../../cmd/zdb/zdb.c:1323:8: warning: too many arguments for format
../../cmd/zdb/zdb.c:1323:8: warning: too many arguments for format
I have attached a patch to fix these issues. It is against a development branch where I am merging changes from Illumos into the ZFSOnLinux codebase for testing purposes. It is against a single file, so it should be easy to apply to Illumos.
Files
Updated by Richard Yao over 7 years ago
Igor Pashev wrote:
2013. Time to use C99. C99 is good :-)
There are two problems here. One is that the use of a variable declaration inside a for loop is inconsistent with the rest of the code. This is a Linux-specific problem because ZFSOnLinux is not telling GCC to use C99, but that has worked so far. The other is that there is an incorrect format string.
At least the format string should be fixed. With that said, using variable declarations inside a single for loop when the rest of the code has avoided it seems like a regression.
Updated by Yuri Pankov almost 4 years ago
- Subject changed from GCC 4.5.3 does not like issue 3604 patch to fix issues introduced by 3604
- Status changed from New to In Progress
- Assignee set to Yuri Pankov
- % Done changed from 0 to 50
- Tags deleted (
needs-triage)
Updated by Electric Monk almost 4 years ago
- Status changed from In Progress to Closed
- % Done changed from 50 to 100
git commit de05b58863498b10283637eb9ac85e92fe85150e
commit de05b58863498b10283637eb9ac85e92fe85150e Author: Richard Yao <ryao@gentoo.org> Date: 2017-04-07T21:14:46.000Z 3871 fix issues introduced by 3604 Reviewed by: Paul Dagnelie <pcd@delphix.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Serapheim Dimitropoulos <serapheim@delphix.com> Approved by: Dan McDonald <danmcd@omniti.com>