Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 //
0003 /// Adds missing MODULE_IMPORT_NS statements to source files
0004 ///
0005 /// This script is usually called from scripts/nsdeps with -D ns=<namespace> to
0006 /// add a missing namespace tag to a module source file.
0007 ///
0008 
0009 virtual nsdeps
0010 virtual report
0011 
0012 @has_ns_import@
0013 declarer name MODULE_IMPORT_NS;
0014 identifier virtual.ns;
0015 @@
0016 MODULE_IMPORT_NS(ns);
0017 
0018 // Add missing imports, but only adjacent to a MODULE_LICENSE statement.
0019 // That ensures we are adding it only to the main module source file.
0020 @do_import depends on !has_ns_import && nsdeps@
0021 declarer name MODULE_LICENSE;
0022 expression license;
0023 identifier virtual.ns;
0024 @@
0025 MODULE_LICENSE(license);
0026 + MODULE_IMPORT_NS(ns);
0027 
0028 // Dummy rule for report mode that would otherwise be empty and make spatch
0029 // fail ("No rules apply.")
0030 @script:python depends on report@
0031 @@