Skip to contentSkip to conversation

trivial: disable sparse' warning for "potentially expensive pointer subtraction".

PATCH Jiri Kosina 2 participants 2 messages Sep 23, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 1282321333.25235.0.camel@thorin

#1 lore raw
Quoted 23 lines · Bernd Petrovitsch

Rationale: With a somewhat current gcc (or a somewhat sane peephole optimizer), the (expensive) "div" is converted to a "shift" or "mul" with the inverse.
This warning is disabled per default in sparse but the "-Wall" in the kernels CFLAGS enables it.

---
This patch is trivial and affects only calls to sparse (read: make C=1) and removes false warnings. So it should be considered for inclusion immediately.

Sorry for the long Cc: - I included everyone in the thread and added linux-kbuild@ (as it IMHO belongs there) and trivial@ (because of the complexity of the patch).

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +0 -0
index f3bdff8..851c0fa 100644

Makefile PERL = perl · line 336

Quoted 8 lines
Makefile +1 -1
@@ -330,7 +330,7 @@ PERL		= perl
 CHECK		= sparse
 
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-		  -Wbitwise -Wno-return-void $(CF)
+		  -Wbitwise -Wno-return-void -Wno-ptr-subtraction-blows $(CF)
 CFLAGS_MODULE   =
 AFLAGS_MODULE   =
 LDFLAGS_MODULE  =

What is the status of this patch? I don't see it Nacked, but it's not in linux-next either.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs, Novell Inc.
#2 lore raw

Also Cc:ed [email protected]

Quoted 27 lines · Jiri Kosina
Quoted 25 lines · Bernd Petrovitsch

Rationale: With a somewhat current gcc (or a somewhat sane peephole optimizer), the (expensive) "div" is converted to a "shift" or "mul" with the inverse.
This warning is disabled per default in sparse but the "-Wall" in the kernels CFLAGS enables it.

---
This patch is trivial and affects only calls to sparse (read: make C=1) and removes false warnings. So it should be considered for inclusion immediately.

Sorry for the long Cc: - I included everyone in the thread and added linux-kbuild@ (as it IMHO belongs there) and trivial@ (because of the complexity of the patch).

 Makefile |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Makefile +0 -0
index f3bdff8..851c0fa 100644
@@ -330,7 +330,7 @@ PERL		= perl
 CHECK		= sparse
 
Quoted 9 lines

Makefile PERL = perl · line 336

Quoted 6 lines
Makefile +1 -1
 CHECKFLAGS     := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
-		  -Wbitwise -Wno-return-void $(CF)
+		  -Wbitwise -Wno-return-void -Wno-ptr-subtraction-blows $(CF)
 CFLAGS_MODULE   =
 AFLAGS_MODULE   =
 LDFLAGS_MODULE  =

What is the status of this patch? I don't see it Nacked, but it's not in linux-next either.

More details:

The head (as in
git://git.kernel.org/pub/scm/devel/sparse/chrisl/sparse.git) has "-Wall" renamed to "-Wsparse-all". So the above patch is pretty pointless.

But sparse-0.4.2 - the latest release according to
https://sparse.wiki.kernel.org/index.php/Main_Page - hasn't that renamed.

Bernd

Signature · 2 lines
mobile: +43 664 4416156              http://www.sysprog.at/
    Linux Software Development, Consulting and Services