* [PATCH] xfsprogs: enable sparse checking
@ 2014-10-23 23:29 Eric Sandeen
2014-10-24 6:17 ` Christoph Hellwig
2014-10-27 18:50 ` Eric Sandeen
0 siblings, 2 replies; 8+ messages in thread
From: Eric Sandeen @ 2014-10-23 23:29 UTC (permalink / raw)
To: xfs-oss
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.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/Makefile b/Makefile
index f56aebd..bd0f9ee 100644
--- a/Makefile
+++ b/Makefile
@@ -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 = .
diff --git a/include/buildrules b/include/buildrules
index 399635e..feae376 100644
--- a/include/buildrules
+++ b/include/buildrules
@@ -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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-23 23:29 [PATCH] xfsprogs: enable sparse checking Eric Sandeen
@ 2014-10-24 6:17 ` Christoph Hellwig
2014-10-24 13:53 ` Eric Sandeen
2014-10-27 18:50 ` Eric Sandeen
1 sibling, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2014-10-24 6:17 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Thu, Oct 23, 2014 at 06:29:14PM -0500, Eric Sandeen wrote:
> 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.
I'm pretty sure I used to be able to do sparse checks on xfsprogs using
CC=cgcc make
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-24 6:17 ` Christoph Hellwig
@ 2014-10-24 13:53 ` Eric Sandeen
2014-10-24 15:40 ` Christoph Hellwig
0 siblings, 1 reply; 8+ messages in thread
From: Eric Sandeen @ 2014-10-24 13:53 UTC (permalink / raw)
To: Christoph Hellwig, Eric Sandeen; +Cc: xfs-oss
On 10/24/14 1:17 AM, Christoph Hellwig wrote:
> On Thu, Oct 23, 2014 at 06:29:14PM -0500, Eric Sandeen wrote:
>> 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.
>
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-24 13:53 ` Eric Sandeen
@ 2014-10-24 15:40 ` Christoph Hellwig
2014-10-24 15:48 ` Eric Sandeen
0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2014-10-24 15:40 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Eric Sandeen, xfs-oss
On Fri, Oct 24, 2014 at 08:53:59AM -0500, Eric Sandeen wrote:
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-24 15:40 ` Christoph Hellwig
@ 2014-10-24 15:48 ` Eric Sandeen
2014-10-27 9:48 ` Christoph Hellwig
0 siblings, 1 reply; 8+ messages in thread
From: Eric Sandeen @ 2014-10-24 15:48 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Eric Sandeen, xfs-oss
On 10/24/14 10:40 AM, Christoph Hellwig wrote:
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-24 15:48 ` Eric Sandeen
@ 2014-10-27 9:48 ` Christoph Hellwig
2014-10-27 13:25 ` Eric Sandeen
0 siblings, 1 reply; 8+ messages in thread
From: Christoph Hellwig @ 2014-10-27 9:48 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Christoph Hellwig, Eric Sandeen, xfs-oss
On Fri, Oct 24, 2014 at 10:48:55AM -0500, Eric Sandeen wrote:
> On 10/24/14 10:40 AM, Christoph Hellwig wrote:
> > 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?
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-27 9:48 ` Christoph Hellwig
@ 2014-10-27 13:25 ` Eric Sandeen
0 siblings, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2014-10-27 13:25 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: Eric Sandeen, xfs-oss
On 10/27/14 4:48 AM, Christoph Hellwig wrote:
> On Fri, Oct 24, 2014 at 10:48:55AM -0500, Eric Sandeen wrote:
>> On 10/24/14 10:40 AM, Christoph Hellwig wrote:
>>> 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?
>
> 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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] xfsprogs: enable sparse checking
2014-10-23 23:29 [PATCH] xfsprogs: enable sparse checking Eric Sandeen
2014-10-24 6:17 ` Christoph Hellwig
@ 2014-10-27 18:50 ` Eric Sandeen
1 sibling, 0 replies; 8+ messages in thread
From: Eric Sandeen @ 2014-10-27 18:50 UTC (permalink / raw)
To: Eric Sandeen, xfs-oss
On 10/23/14 6:29 PM, Eric Sandeen wrote:
> 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.
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
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2014-10-27 18:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-23 23:29 [PATCH] xfsprogs: enable sparse checking Eric Sandeen
2014-10-24 6:17 ` Christoph Hellwig
2014-10-24 13:53 ` Eric Sandeen
2014-10-24 15:40 ` Christoph Hellwig
2014-10-24 15:48 ` Eric Sandeen
2014-10-27 9:48 ` Christoph Hellwig
2014-10-27 13:25 ` Eric Sandeen
2014-10-27 18:50 ` Eric Sandeen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox