Bug 174028 - [patch] Fix some warnings with fsck_ffs(8)
Summary: [patch] Fix some warnings with fsck_ffs(8)
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 9.1-STABLE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-01 06:00 UTC by Enji Cooper
Modified: 2018-01-03 05:13 UTC (History)
0 users

See Also:


Attachments
file.diff (7.68 KB, patch)
2012-12-01 06:00 UTC, Enji Cooper
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer 2012-12-01 06:00:00 UTC
I was doing a rescue(8) compile before in the past and ignorantly enabled WARNS=6 on the build and ran into a slew of warnings-related build errors with fsck_ffs.

The attached patch fixes some (but not all) of the warnings. In particular there are a large chunk of signage warnings that need to be fixed (along with some always true/false code due to the fact that some of the values being compared are unsigned), and an issue with pointer arithmetic.

The remaining warnings as errors follow...

cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/dir.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/dir.c: In function 'dircheck':
/usr/src/sbin/fsck_ffs/dir.c:227: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/dir.c: In function 'expanddir':
/usr/src/sbin/fsck_ffs/dir.c:569: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/dir.c:569: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/dir.c:571: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/dir.c:571: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/dir.c:585: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/dir.c:585: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/dir.c:601: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/dir.c:601: warning: signed and unsigned type in conditional expression
*** [dir.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/fsutil.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/fsutil.c: In function 'check_cgmagic':
/usr/src/sbin/fsck_ffs/fsutil.c:452: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/fsutil.c:453: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/fsutil.c:457: warning: comparison between signed and unsigned
*** [fsutil.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/inode.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/inode.c: In function 'getnextinode':
/usr/src/sbin/fsck_ffs/inode.c:368: warning: comparison between signed and unsigned
*** [inode.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/main.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/main.c: In function 'checkfilesys':
/usr/src/sbin/fsck_ffs/main.c:354: warning: passing argument 4 of 'build_iovec' discards qualifiers from pointer target type
/usr/src/sbin/fsck_ffs/main.c:495: warning: comparison of unsigned expression < 0 is always false
/usr/src/sbin/fsck_ffs/main.c:517: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/main.c:532: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/main.c: In function 'chkdoreload':
/usr/src/sbin/fsck_ffs/main.c:571: warning: passing argument 4 of 'build_iovec' discards qualifiers from pointer target type
*** [main.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/pass1.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/pass1.c: In function 'pass1':
/usr/src/sbin/fsck_ffs/pass1.c:72: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1.c:92: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1.c:141: warning: comparison of unsigned expression < 0 is always false
/usr/src/sbin/fsck_ffs/pass1.c: In function 'checkinode':
/usr/src/sbin/fsck_ffs/pass1.c:275: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1.c:315: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1.c:392: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/pass1.c:392: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1.c:394: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/pass1.c:406: warning: signed and unsigned type in conditional expression
*** [pass1.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/pass1b.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/pass1b.c: In function 'pass1b':
/usr/src/sbin/fsck_ffs/pass1b.c:63: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass1b.c:75: warning: comparison between signed and unsigned
*** [pass1b.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/pass2.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/pass2.c: In function 'pass2':
/usr/src/sbin/fsck_ffs/pass2.c:186: warning: comparison between signed and unsigned
*** [pass2.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/pass4.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/pass4.c: In function 'pass4':
/usr/src/sbin/fsck_ffs/pass4.c:59: warning: comparison between signed and unsigned
*** [pass4.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/pass5.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/pass5.c: In function 'pass5':
/usr/src/sbin/fsck_ffs/pass5.c:153: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass5.c:178: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/pass5.c:285: warning: comparison between signed and unsigned
*** [pass5.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/setup.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/setup.c: In function 'readsb':
/usr/src/sbin/fsck_ffs/setup.c:352: warning: comparison between signed and unsigned
*** [setup.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/suj.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/suj.c: In function 'closedisk':
/usr/src/sbin/fsck_ffs/suj.c:225: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c: In function 'cg_lookup':
/usr/src/sbin/fsck_ffs/suj.c:256: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_blkatoff':
/usr/src/sbin/fsck_ffs/suj.c:771: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:774: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:774: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_clrat':
/usr/src/sbin/fsck_ffs/suj.c:841: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:841: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_isat':
/usr/src/sbin/fsck_ffs/suj.c:891: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:891: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_visit':
/usr/src/sbin/fsck_ffs/suj.c:1047: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:1052: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c:1052: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_adjblks':
/usr/src/sbin/fsck_ffs/suj.c:1132: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c:1136: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/suj.c: In function 'ino_remref':
/store/freebsd/stable/9/sbin/fsck_ffs/suj.c:1228: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c: In function 'suj_verifyino':
/usr/src/sbin/fsck_ffs/suj.c:2393: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/suj.c: In function 'suj_read':
/usr/src/sbin/fsck_ffs/suj.c:2607: warning: pointer of type 'void *' used in arithmetic
*** [suj.o] Error code 1 (continuing)
cc -O2 -pipe -fno-strict-aliasing -O2 -march=core2 -I/usr/src/sbin/fsck_ffs -I/usr/src/sbin/fsck_ffs/../mount -std=gnu99 -fstack-protector -Wsystem-headers -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wnested-externs -Wredundant-decls -Wold-style-definition -Wno-pointer-sign -c /usr/src/sbin/fsck_ffs/gjournal.c
cc1: warnings being treated as errors
/usr/src/sbin/fsck_ffs/gjournal.c: In function 'getcg':
/usr/src/sbin/fsck_ffs/gjournal.c:109: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/gjournal.c: In function 'clear_inode':
/usr/src/sbin/fsck_ffs/gjournal.c:389: warning: comparison between signed and unsigned
/usr/src/sbin/fsck_ffs/gjournal.c:389: warning: signed and unsigned type in conditional expression
/usr/src/sbin/fsck_ffs/gjournal.c: In function 'gjournal_check':
/usr/src/sbin/fsck_ffs/gjournal.c:414: warning: comparison between signed and unsigned
1 error
*** [gjournal.o] Error code 1 (continuing)
`all' not remade because of errors.

Fix: Patch attached with submission follows:
How-To-Repeat: cd sbin/fsck_ffs; make obj depend all -k WARNS=6
Comment 1 Eitan Adler freebsd_committer freebsd_triage 2012-12-14 02:18:45 UTC
Responsible Changed
From-To: freebsd-bugs->eadler

I'll take it.
Comment 2 Eitan Adler freebsd_committer freebsd_triage 2013-01-31 13:58:32 UTC
Responsible Changed
From-To: eadler->freebsd-bugs

sorry I held on to this for so long;   at the moment I have no time to 
look at this PR so return to the pool
Comment 3 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 08:00:09 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped