This is a patch to introduce a macro that can be used to suppress false
positives caused by GCC and looked at by a developer to turn off the
warning.
It does NOT turn off the warnings by default!!!
This is to give developers that usually ignore all the "uninitialized
variable" warings an opportunity to turn off these warnings to concentrate
on the ones that they make.
The only true arguement against this is that it makes the code not so
pretty. Otherwise, it causes no more bloat and may even allow those to
debug better.
Now kernel hacking has an option for developers to turn off the warnings
that were looked at and marked.
This patch only introduces the macro. If it is accepted, then more
patches need to be made to mark the variables.
Even if a variable is marked incorrectly as not a bug, it's still not
bad, in fact, I would say is better. Only those that need to look at that
that code should keep this off. Remember, this only turns off the
warnings if you explicitly do so yourself.
-- Steve
Signed-off-by: Steven Rostedt <[email protected]>
Index: linux-2.6.17-rc3-mm1/include/linux/types.h
===================================================================
--- linux-2.6.17-rc3-mm1.orig/include/linux/types.h 2006-05-11 05:35:33.000000000 -0400
+++ linux-2.6.17-rc3-mm1/include/linux/types.h 2006-05-11 05:49:06.000000000 -0400
@@ -192,4 +192,15 @@ struct ustat {
char f_fpack[6];
};
+#ifdef CONFIG_HIDE_FALSE_POSITIVES
+/*
+ * No parentheses around x = x because
+ * int (i=i);
+ * doesn't compile.
+ */
+# define uninit_var(x) x = x
+#else
+# define uninit_var(x) x
+#endif
+
#endif /* _LINUX_TYPES_H */
Index: linux-2.6.17-rc3-mm1/lib/Kconfig.debug
===================================================================
--- linux-2.6.17-rc3-mm1.orig/lib/Kconfig.debug 2006-05-11 05:37:58.000000000 -0400
+++ linux-2.6.17-rc3-mm1/lib/Kconfig.debug 2006-05-11 05:48:28.000000000 -0400
@@ -254,6 +254,22 @@ config FORCED_INLINING
become the default in the future, until then this option is there to
test gcc for this.
+config HIDE_FALSE_POSITIVES
+ bool "Hide gcc false positives of unititialized variables"
+ depends on DEBUG_KERNEL
+ help
+ gcc sometimes shows that a variable is uninitialized when the logic
+ actually does initialize it before use. The kernel has lots of these
+ warnings. This option hides those warnings that were actually looked
+ at by a human, and decided (right or wrong) that this variable is indeed
+ properly initialized.
+
+ If you are a developer that doesn't care about these warnings, and trust
+ that the one that marked these variables, did so correctly. Then you
+ may turn on this option, to look for your own mistakes.
+
+ Otherwise, say N
+
config DEBUG_SYNCHRO_TEST
tristate "Synchronisation primitive testing module"
depends on DEBUG_KERNEL
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]