xfsprogs: enable sparse checking
PATCH 1/1 xfsprogs: enable sparse checking
Enable "make C=1" or "make C=2" to do sparse checking. Blatantly ripped off from djwong's patch in e2fsprogs to do the same.
Note, this requires unreleased sparse after v0.5, which enables the CHAR_BIT definition; otherwise it chokes.
---
Makefile +14 -0
@@ -15,6 +15,20 @@ else Q = @ endif +CHECK=sparse +CHECK_OPTS=-Wsparse-all -Wno-transparent-union -Wno-return-void -Wno-undef \ + -Wno-non-pointer-null -D__linux__ +ifeq ("$(C)", "2") + CHECK_CMD=$(CHECK) $(CHECK_OPTS) -Wbitwise -D__CHECK_ENDIAN__ +else + ifeq ("$(C)", "1") + CHECK_CMD=$(CHECK) $(CHECK_OPTS) + else + CHECK_CMD=@true + endif +endif +export CHECK_CMD + MAKEOPTS = --no-print-directory Q=$(Q) TOPDIR = .
include/buildrules +2 -0
@@ -41,10 +41,12 @@ $(LTLIBRARY) : $(SUBDIRS) $(LTOBJECTS) %.lo: %.c @echo " [CC] $@" $(Q)$(LTCOMPILE) -c $< + $(Q)$(CHECK_CMD) $(CFLAGS) $< else %.o: %.c @echo " [CC] $@" $(Q)$(CC) $(CFLAGS) -c $< + $(Q)$(CHECK_CMD) $(CFLAGS) $< endif
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Eric Sandeen
Enable "make C=1" or "make C=2" to do sparse checking. Blatantly ripped off from djwong's patch in e2fsprogs to do the same.
Note, this requires unreleased sparse after v0.5, which enables the
CHAR_BITdefinition; otherwise it chokes.
I'm pretty sure I used to be able to do sparse checks on xfsprogs using
CC=cgcc make
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 11 lines · Christoph Hellwig
Quoted 6 lines · Eric Sandeen
Enable "make C=1" or "make C=2" to do sparse checking. Blatantly ripped off from djwong's patch in e2fsprogs to do the same.
Note, this requires unreleased sparse after v0.5, which enables the
CHAR_BITdefinition; otherwise it chokes.I'm pretty sure I used to be able to do sparse checks on xfsprogs using
CC=cgcc make
Hm, so you can.
Ok, so maybe this is dumb, or is it convenient (to work like it does in the kernel tree?)
Thanks,
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 4 lines · Eric Sandeen
Hm, so you can.
Ok, so maybe this is dumb, or is it convenient (to work like it does in the kernel tree?)
The cgcc way seems easier for userspace, but I don't really have a strong opinion. It's not like your patch prevents me from using CC=cgcc
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 1 line · Christoph Hellwig
strong opinion. It's not like your patch prevents me from using CC=cgcc
To get endian checking with your method, you'd need to edit the Makefile to add the -D define, right?
Thanks,
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 5 lines · Eric Sandeen
Quoted 1 line · Christoph Hellwig
strong opinion. It's not like your patch prevents me from using CC=cgcc
To get endian checking with your method, you'd need to edit the
Makefileto add the -D define, right?
That's a kernel special, I just did a test run using CC=cgcc and I get endianess warnings:
rdwr.c:190:21: warning: incorrect type in assignment (different base types)
rdwr.c:190:21: expected restricted __le32 [usertype] h_crc
rdwr.c:190:21: got restricted __be32 [usertype] <noident>
log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64 log_misc.c:621:59: warning: cast to restricted __be64
There's also tons of noise that should be easily upgradeable, but let me check latests xfsprogs first..
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 7 lines · Christoph Hellwig
Quoted 5 lines · Eric Sandeen
Quoted 1 line · Christoph Hellwig
strong opinion. It's not like your patch prevents me from using CC=cgcc
To get endian checking with your method, you'd need to edit the
Makefileto add the -D define, right?
Quoted 6 lines
That's a kernel special, I just did a test run using CC=cgcc and I get endianess warnings:
rdwr.c:190:21: warning: incorrect type in assignment (different base types)
rdwr.c:190:21: expected restricted__le32[usertype]h_crc
rdwr.c:190:21: got restricted__be32[usertype] <noident>
Oh, without an extra define? Hrm. Ok I guess I need to read up on what enables it.
I did send a couple patches to fix some of these. Sorry, didn't do it in a series:
[PATCH] xfsprogs: fix endian mishap in xfs_dialloc_ag() [PATCH] xfsprogs: fix harmless sparse endian nit
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs
Quoted 6 lines · Eric Sandeen
Enable "make C=1" or "make C=2" to do sparse checking. Blatantly ripped off from djwong's patch in e2fsprogs to do the same.
Note, this requires unreleased sparse after v0.5, which enables the
CHAR_BITdefinition; otherwise it chokes.
Ok, NAK to this one I guess, hch has sufficiently pointed out that I don't quite know what I'm doing here ;)
-Eric
_______________________________________________
xfs mailing list
[email protected]
http://oss.sgi.com/mailman/listinfo/xfs