[lkml]   [2006]   [May]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
    Patch in this message
    Subject[PATCH -mm] introduce a false positive macro

    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

    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 <>

    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];

    + * No parentheses around x = x because
    + * int (i=i);
    + * doesn't compile.
    + */
    +# define uninit_var(x) x = x
    +# define uninit_var(x) x
    #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.

    + 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
    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
    More majordomo info at
    Please read the FAQ at
     \ /
      Last update: 2006-05-11 12:11    [W:0.021 / U:7.980 seconds]
    ©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site