Re: [GIT PULL] core/locking changes for v3.1

From: Ingo Molnar
Date: Mon Jul 25 2011 - 16:02:53 EST



* Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> On Mon, Jul 25, 2011 at 12:04 PM, Ingo Molnar <mingo@xxxxxxx> wrote:
> > ..
> > net/netfilter/nf_conntrack_core.c: In function ânf_conntrack_initâ:
> > net/netfilter/nf_conntrack_core.c:1579:3: warning: the comparison
> > will always evaluate as âtrueâ for the address of
> > ânf_conntrack_attachâ will never be NULL [-Waddress]
>
> These all seem to be essentially compiler bugs.
>
> We have macros that do generic things (in this case
> "rcu_assign_pointer()" and tests their values. The fact that the tests
> sometimes end up being statically true (or false) is not something the
> compiler should complain about - it should use it to optimize the
> code.
>
> Sad.
>
> We can make a compiler bug-report, or disable -Waddress. Or maybe we
> can write the tests in a way that doesn't trigger the compiler bug.
>
> This same issue is why I hated -Wsign-compare. Some of the things
> gcc complained about were just technically moronic. So compiler
> warnings are not always a good thing.

With -Wno-address added (see the first patch below) it looks a lot
more useful:

aldebaran:~/linux/linux> make -j32 >e
sound/pci/hda/patch_sigmatel.c: In function âstac92xx_initâ:
sound/pci/hda/patch_sigmatel.c:4385:3: warning: statement with no
effect [-Wunused-value]
sound/pci/hda/patch_sigmatel.c: In function âstac92xx_resumeâ:
sound/pci/hda/patch_sigmatel.c:4925:3: warning: statement with no
effect [-Wunused-value]
sound/pci/hda/patch_realtek.c: In function âalc_initâ:
sound/pci/hda/patch_realtek.c:4176:2: warning: statement with no
effect [-Wunused-value]
sound/pci/hda/patch_realtek.c: In function âalc_resumeâ:
sound/pci/hda/patch_realtek.c:4558:2: warning: statement with no
effect [-Wunused-value]
sound/pci/hda/hda_codec.c: In function
âsnd_hda_mixer_amp_switch_putâ:
sound/pci/hda/hda_codec.c:2320:2: warning: statement with no effect
[-Wunused-value]
sound/pci/hda/patch_realtek.c: In function âalc269_resumeâ:
sound/pci/hda/patch_realtek.c:14878:2: warning: statement with no
effect [-Wunused-value]
drivers/md/dm.c: In function âsplit_bvecâ:
drivers/md/dm.c:1052:3: warning: statement with no effect
[-Wunused-value]
drivers/md/dm.c: In function âclone_bioâ:
drivers/md/dm.c:1079:3: warning: statement with no effect
[-Wunused-value]
drivers/md/dm-table.c: In function âdm_table_set_integrityâ:
drivers/md/dm-table.c:1193:2: warning: statement with no effect
[-Wunused-value]
Setup is 15260 bytes (padded to 15360 bytes).
System is 4654 kB
CRC 6d1b94ea

those unused-x warnings seem legit and should be fixed. For example
the second patch below fixed the dm.c warnings.

That's with:

gcc version 4.6.0 20110509 (Red Hat 4.6.0-7) (GCC)

so a reasonably recent GCC. I think we should kill -Waddress.

Thanks,

Ingo

diff --git a/Makefile b/Makefile
index d018956..e651294 100644
--- a/Makefile
+++ b/Makefile
@@ -559,9 +559,9 @@ endif # $(dot-config)
all: vmlinux

ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS += -Os
+KBUILD_CFLAGS += -Os -Wno-address
else
-KBUILD_CFLAGS += -O2
+KBUILD_CFLAGS += -O2 -Wno-address
endif

include $(srctree)/arch/$(SRCARCH)/Makefile

diff --git a/include/linux/bio.h b/include/linux/bio.h
index ce33e68..283250a 100644
--- a/include/linux/bio.h
+++ b/include/linux/bio.h
@@ -527,7 +527,7 @@ extern void bio_integrity_init(void);
#define bioset_integrity_create(a, b) (0)
#define bio_integrity_prep(a) (0)
#define bio_integrity_enabled(a) (0)
-#define bio_integrity_clone(a, b, c, d) (0)
+#define bio_integrity_clone(a, b, c, d) ({0;})
#define bioset_integrity_free(a) do { } while (0)
#define bio_integrity_free(a, b) do { } while (0)
#define bio_integrity_endio(a, b) do { } while (0)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/