Project

General

Profile

Bug #3871

fix issues introduced by 3604

Added by Richard Yao over 7 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
2013-07-06
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
Gerrit CR:

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

patch (1.7 KB) patch Patch to fix issues Richard Yao, 2013-07-06 05:18 PM

History

#1

Updated by Igor Pashev over 7 years ago

2013. Time to use C99. C99 is good :-)

#2

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.

#3

Updated by Yuri Pankov over 3 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)
#4

Updated by Electric Monk over 3 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>

Also available in: Atom PDF