Remove the documentation link from the warning message because commit 3942ea7a10c9 ("deprecated.rst: Remove now removed uninitialized_var") removed the section from documentation. Update the rule documentation accordingly.
Unified · Split
| @@ -1,7 +1,9 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0-only | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | /// | 2 | /// |
| 3 | /// Please, don't reintroduce uninitialized_var(). | 3 | /// Please, don't reintroduce uninitialized_var(). |
| 4 | /// From Documentation/process/deprecated.rst: | 4 | /// |
| 5 | /// From Documentation/process/deprecated.rst, | ||
| 6 | /// commit 4b19bec97c88 ("docs: deprecated.rst: Add uninitialized_var()"): | ||
| 5 | /// For any compiler warnings about uninitialized variables, just add | 7 | /// For any compiler warnings about uninitialized variables, just add |
| 6 | /// an initializer. Using warning-silencing tricks is dangerous as it | 8 | /// an initializer. Using warning-silencing tricks is dangerous as it |
| 7 | /// papers over real bugs (or can in the future), and suppresses unrelated | 9 | /// papers over real bugs (or can in the future), and suppresses unrelated |
| @@ -11,6 +13,11 @@ · 3 unmodified lines | |||
| 11 | /// obviously redundant, the compiler's dead-store elimination pass will make | 13 | /// obviously redundant, the compiler's dead-store elimination pass will make |
| 12 | /// sure there are no needless variable writes. | 14 | /// sure there are no needless variable writes. |
| 13 | /// | 15 | /// |
| 16 | /// Later, commit 3942ea7a10c9 ("deprecated.rst: Remove now removed | ||
| 17 | /// uninitialized_var") removed this section because all initializations of | ||
| 18 | /// this kind were cleaned-up from the kernel. This cocci rule checks that | ||
| 19 | /// the macro is not explicitly or implicitly reintroduced. | ||
| 20 | /// | ||
| 14 | // Confidence: High | 21 | // Confidence: High |
| 15 | // Copyright: (C) 2020 Denis Efremov ISPRAS | 22 | // Copyright: (C) 2020 Denis Efremov ISPRAS |
| 16 | // Options: --no-includes --include-headers | 23 | // Options: --no-includes --include-headers |
| @@ -40,12 +47,10 @@ position p; · 23 unmodified lines | |||
| 40 | p << r.p; | 47 | p << r.p; |
| 41 | @@ | 48 | @@ |
| 42 | 49 | ||
| 43 | coccilib.report.print_report(p[0], | 50 | coccilib.report.print_report(p[0], "WARNING this kind of initialization is deprecated") |
| 44 | "WARNING this kind of initialization is deprecated (https://www.kernel.org/doc/html/latest/process/deprecated.html#uninitialized-var)") | ||
| 45 | 51 | ||
| 46 | @script:python depends on org@ | 52 | @script:python depends on org@ |
| 47 | p << r.p; | 53 | p << r.p; |
| 48 | @@ | 54 | @@ |
| 49 | 55 | ||
| 50 | coccilib.org.print_todo(p[0], | 56 | coccilib.org.print_todo(p[0], "WARNING this kind of initialization is deprecated") |
| 51 | "WARNING this kind of initialization is deprecated (https://www.kernel.org/doc/html/latest/process/deprecated.html#uninitialized-var)") | ||