~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/scripts/coccinelle/misc/uninitialized_var.cocci

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /scripts/coccinelle/misc/uninitialized_var.cocci (Architecture ppc) and /scripts/coccinelle/misc/uninitialized_var.cocci (Architecture m68k)


  1 // SPDX-License-Identifier: GPL-2.0-only            1 // SPDX-License-Identifier: GPL-2.0-only
  2 ///                                                 2 ///
  3 /// Please, don't reintroduce uninitialized_va      3 /// Please, don't reintroduce uninitialized_var().
  4 ///                                                 4 ///
  5 /// From Documentation/process/deprecated.rst,      5 /// From Documentation/process/deprecated.rst,
  6 /// commit 4b19bec97c88 ("docs: deprecated.rst      6 /// commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()"):
  7 ///  For any compiler warnings about uninitial      7 ///  For any compiler warnings about uninitialized variables, just add
  8 ///  an initializer. Using warning-silencing t      8 ///  an initializer. Using warning-silencing tricks is dangerous as it
  9 ///  papers over real bugs (or can in the futu      9 ///  papers over real bugs (or can in the future), and suppresses unrelated
 10 ///  compiler warnings (e.g. "unused variable"     10 ///  compiler warnings (e.g. "unused variable"). If the compiler thinks it
 11 ///  is uninitialized, either simply initializ     11 ///  is uninitialized, either simply initialize the variable or make compiler
 12 ///  changes. Keep in mind that in most cases,     12 ///  changes. Keep in mind that in most cases, if an initialization is
 13 ///  obviously redundant, the compiler's dead-     13 ///  obviously redundant, the compiler's dead-store elimination pass will make
 14 ///  sure there are no needless variable write     14 ///  sure there are no needless variable writes.
 15 ///                                                15 ///
 16 /// Later, commit 3942ea7a10c9 ("deprecated.rs     16 /// Later, commit 3942ea7a10c9 ("deprecated.rst: Remove now removed
 17 /// uninitialized_var") removed this section b     17 /// uninitialized_var") removed this section because all initializations of
 18 /// this kind were cleaned-up from the kernel.     18 /// this kind were cleaned-up from the kernel. This cocci rule checks that
 19 /// the macro is not explicitly or implicitly      19 /// the macro is not explicitly or implicitly reintroduced.
 20 ///                                                20 ///
 21 // Confidence: High                                21 // Confidence: High
 22 // Copyright: (C) 2020 Denis Efremov ISPRAS        22 // Copyright: (C) 2020 Denis Efremov ISPRAS
 23 // Options: --no-includes --include-headers        23 // Options: --no-includes --include-headers
 24 //                                                 24 //
 25                                                    25 
 26 virtual context                                    26 virtual context
 27 virtual report                                     27 virtual report
 28 virtual org                                        28 virtual org
 29                                                    29 
 30 @r@                                                30 @r@
 31 identifier var;                                    31 identifier var;
 32 type T;                                            32 type T;
 33 position p;                                        33 position p;
 34 @@                                                 34 @@
 35                                                    35 
 36 (                                                  36 (
 37 * T var =@p var;                                   37 * T var =@p var;
 38 |                                                  38 |
 39 * T var =@p *(&(var));                             39 * T var =@p *(&(var));
 40 |                                                  40 |
 41 * var =@p var                                      41 * var =@p var
 42 |                                                  42 |
 43 * var =@p *(&(var))                                43 * var =@p *(&(var))
 44 )                                                  44 )
 45                                                    45 
 46 @script:python depends on report@                  46 @script:python depends on report@
 47 p << r.p;                                          47 p << r.p;
 48 @@                                                 48 @@
 49                                                    49 
 50 coccilib.report.print_report(p[0], "WARNING th     50 coccilib.report.print_report(p[0], "WARNING this kind of initialization is deprecated")
 51                                                    51 
 52 @script:python depends on org@                     52 @script:python depends on org@
 53 p << r.p;                                          53 p << r.p;
 54 @@                                                 54 @@
 55                                                    55 
 56 coccilib.org.print_todo(p[0], "WARNING this ki     56 coccilib.org.print_todo(p[0], "WARNING this kind of initialization is deprecated")
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php