18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only
28c2ecf20Sopenharmony_ci///
38c2ecf20Sopenharmony_ci/// Please, don't reintroduce uninitialized_var().
48c2ecf20Sopenharmony_ci/// From Documentation/process/deprecated.rst:
58c2ecf20Sopenharmony_ci///  For any compiler warnings about uninitialized variables, just add
68c2ecf20Sopenharmony_ci///  an initializer. Using warning-silencing tricks is dangerous as it
78c2ecf20Sopenharmony_ci///  papers over real bugs (or can in the future), and suppresses unrelated
88c2ecf20Sopenharmony_ci///  compiler warnings (e.g. "unused variable"). If the compiler thinks it
98c2ecf20Sopenharmony_ci///  is uninitialized, either simply initialize the variable or make compiler
108c2ecf20Sopenharmony_ci///  changes. Keep in mind that in most cases, if an initialization is
118c2ecf20Sopenharmony_ci///  obviously redundant, the compiler's dead-store elimination pass will make
128c2ecf20Sopenharmony_ci///  sure there are no needless variable writes.
138c2ecf20Sopenharmony_ci///
148c2ecf20Sopenharmony_ci// Confidence: High
158c2ecf20Sopenharmony_ci// Copyright: (C) 2020 Denis Efremov ISPRAS
168c2ecf20Sopenharmony_ci// Options: --no-includes --include-headers
178c2ecf20Sopenharmony_ci//
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_civirtual context
208c2ecf20Sopenharmony_civirtual report
218c2ecf20Sopenharmony_civirtual org
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_ci@r@
248c2ecf20Sopenharmony_ciidentifier var;
258c2ecf20Sopenharmony_citype T;
268c2ecf20Sopenharmony_ciposition p;
278c2ecf20Sopenharmony_ci@@
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci(
308c2ecf20Sopenharmony_ci* T var =@p var;
318c2ecf20Sopenharmony_ci|
328c2ecf20Sopenharmony_ci* T var =@p *(&(var));
338c2ecf20Sopenharmony_ci|
348c2ecf20Sopenharmony_ci* var =@p var
358c2ecf20Sopenharmony_ci|
368c2ecf20Sopenharmony_ci* var =@p *(&(var))
378c2ecf20Sopenharmony_ci)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci@script:python depends on report@
408c2ecf20Sopenharmony_cip << r.p;
418c2ecf20Sopenharmony_ci@@
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_cicoccilib.report.print_report(p[0],
448c2ecf20Sopenharmony_ci  "WARNING this kind of initialization is deprecated (https://www.kernel.org/doc/html/latest/process/deprecated.html#uninitialized-var)")
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci@script:python depends on org@
478c2ecf20Sopenharmony_cip << r.p;
488c2ecf20Sopenharmony_ci@@
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cicoccilib.org.print_todo(p[0],
518c2ecf20Sopenharmony_ci  "WARNING this kind of initialization is deprecated (https://www.kernel.org/doc/html/latest/process/deprecated.html#uninitialized-var)")
52