diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2018-09-15 02:19:34 +0200 |
|---|---|---|
| committer | Ulf Magnusson <ulfalizer@gmail.com> | 2018-09-15 03:07:11 +0200 |
| commit | 35a60b786c646c846d9bad6a5f15711acc9a62c6 (patch) | |
| tree | e0848683c8b4f39d1f0959fb6b9a95c14ca2a3f0 /examples/list_undefined.py | |
| parent | f861c271dcbb06e0101c01add3d07006c2d3a09c (diff) | |
Update some examples to use node_iter()
Simplifies the code. Should promote new APIs.
Also fix list_undefined.py for recent kernels. More environment
variables are referenced now.
Diffstat (limited to 'examples/list_undefined.py')
| -rw-r--r-- | examples/list_undefined.py | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/examples/list_undefined.py b/examples/list_undefined.py index 0207975..4a3bc9b 100644 --- a/examples/list_undefined.py +++ b/examples/list_undefined.py @@ -70,9 +70,6 @@ def all_arch_srcarch_pairs(): yield ("sh64", "sh") - yield ("tilepro", "tile") - yield ("tilegx", "tile") - yield ("um", "um") @@ -80,6 +77,13 @@ def all_arch_srcarch_kconfigs(): """ Generates Kconfig instances for all the architectures in the kernel """ + + os.environ["srctree"] = "." + os.environ["HOSTCC"] = "gcc" + os.environ["HOSTCXX"] = "g++" + os.environ["CC"] = "gcc" + os.environ["LD"] = "ld" + for arch, srcarch in all_arch_srcarch_pairs(): print(" Processing " + arch) @@ -118,21 +122,16 @@ for kconf in all_arch_srcarch_kconfigs(): print("\nFinding references to each undefined symbol") -def referencing_nodes(node, name): +def referencing_nodes(kconf, name): # Returns a list of all menu nodes that reference a symbol named 'name' in # any of their properties or property conditions res = [] - while node: + for node in kconf.node_iter(): for ref in node.referenced: if ref.name == name: res.append(node) - if node.list: - res.extend(referencing_nodes(node.list, name)) - - node = node.next - return res @@ -145,7 +144,7 @@ for kconf in all_arch_srcarch_kconfigs(): # undefined symbol, which is terribly inefficient. We could speed # things up by tweaking referencing_nodes() to compare each symbol to # multiple symbols while walking the configuration tree. - for node in referencing_nodes(kconf.top_node, name): + for node in referencing_nodes(kconf, name): refs.add("{}:{}".format(node.filename, node.linenr)) |
