Tweaked generation of .cgi files, error code for recursion in stack.py

GCC is a bit annoying here, it can't generate .cgi files without
generating the related .o files, though I suppose the alternative risks
duplicating a large amount of compilation work (littlefs is really
a small project).

Previously we rebuilt the .o files anytime we needed .cgi files
(callgraph info used for stack.py). This changes it so we always
built .cgi files as a side-effect of compilation. This is similar
to the .d file generation, though may be annoying if the system
cc doesn't support --callgraph-info.
This commit is contained in:
Christopher Haster
2022-05-15 16:18:36 -05:00
parent 1616115662
commit 2b11f2b426
2 changed files with 11 additions and 15 deletions

View File

@@ -384,6 +384,11 @@ def main(**args):
print_entries(by='name')
print_totals()
# catch recursion
if args.get('error_on_recursion') and any(
m.isinf(limit) for _, _, _, limit, _ in results):
sys.exit(2)
if __name__ == "__main__":
import argparse
@@ -424,6 +429,8 @@ if __name__ == "__main__":
help="Show file-level calls.")
parser.add_argument('-Y', '--summary', action='store_true',
help="Only show the total stack size.")
parser.add_argument('-e', '--error-on-recursion', action='store_true',
help="Error if any functions are recursive.")
parser.add_argument('--build-dir',
help="Specify the relative build directory. Used to map object files \
to the correct source files.")