Skip to content

Commit 0218103

Browse files
committed
gen_provides: make no matching symbols just a warning
There is no reason to fail the script if no symbols are found matching the criteria; simply log a warning and generate an empty provides file. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
1 parent e55de8b commit 0218103

1 file changed

Lines changed: 15 additions & 14 deletions

File tree

extra/gen_provides.py

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,6 @@ def main():
220220
if name in sized_syms:
221221
out_syms[name + "_size"] = (sym['st_size'], [f"size of {name}"])
222222

223-
if not out_syms:
224-
sys.stderr.write("No symbols found matching the criteria.\n")
225-
fail = True
226-
227223
if fail:
228224
sys.exit(1)
229225

@@ -235,16 +231,21 @@ def main():
235231
* SHA256: {elf_sha}
236232
*/
237233
""")
238-
sym_comment = nul_comment = ""
239-
for name, (value, comments) in sorted(out_syms.items(), key=lambda x: x[0]):
240-
if args.verbose:
241-
comment = ', '.join(sorted(comments))
242-
sym_comment = f"/* {comment} */"
243-
nul_comment = f" ({comment})"
244-
if value:
245-
print(f"PROVIDE({name} = {value:#010x});{sym_comment}")
246-
else:
247-
print(f"/* NULL {name}{nul_comment} */")
234+
235+
if not out_syms:
236+
print("/* No symbols found matching the criteria */")
237+
sys.stderr.write("warning: no symbols found matching the criteria.\n")
238+
else:
239+
sym_comment = nul_comment = ""
240+
for name, (value, comments) in sorted(out_syms.items(), key=lambda x: x[0]):
241+
if args.verbose:
242+
comment = ', '.join(sorted(comments))
243+
sym_comment = f"/* {comment} */"
244+
nul_comment = f" ({comment})"
245+
if value:
246+
print(f"PROVIDE({name} = {value:#010x});{sym_comment}")
247+
else:
248+
print(f"/* NULL {name}{nul_comment} */")
248249

249250
#-------------------------------------------------------------------------------
250251
if __name__ == '__main__':

0 commit comments

Comments
 (0)