Matthias Maennich | eb8305a | 2019-09-06 11:32:32 +0100 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
| 2 | // |
| 3 | /// Adds missing MODULE_IMPORT_NS statements to source files |
| 4 | /// |
| 5 | /// This script is usually called from scripts/nsdeps with -D ns=<namespace> to |
| 6 | /// add a missing namespace tag to a module source file. |
| 7 | /// |
| 8 | |
YueHaibing | c7c4e29 | 2019-10-06 12:44:56 +0800 | [diff] [blame] | 9 | virtual report |
| 10 | |
Matthias Maennich | eb8305a | 2019-09-06 11:32:32 +0100 | [diff] [blame] | 11 | @has_ns_import@ |
| 12 | declarer name MODULE_IMPORT_NS; |
| 13 | identifier virtual.ns; |
| 14 | @@ |
| 15 | MODULE_IMPORT_NS(ns); |
| 16 | |
| 17 | // Add missing imports, but only adjacent to a MODULE_LICENSE statement. |
| 18 | // That ensures we are adding it only to the main module source file. |
| 19 | @do_import depends on !has_ns_import@ |
| 20 | declarer name MODULE_LICENSE; |
| 21 | expression license; |
| 22 | identifier virtual.ns; |
| 23 | @@ |
| 24 | MODULE_LICENSE(license); |
| 25 | + MODULE_IMPORT_NS(ns); |