Debian Codegraph @

share/analysis-scripts/detect_recursion.py

raw
1 #!/usr/bin/env python3
2 # -*- coding: utf-8 -*-
3 ##########################################################################
4 # #
5 # This file is part of Frama-C. #
6 # #
7 # Copyright (C) 2007-2022 #
8 # CEA (Commissariat à l'énergie atomique et aux énergies #
9 # alternatives) #
10 # #
11 # you can redistribute it and/or modify it under the terms of the GNU #
12 # Lesser General Public License as published by the Free Software #
13 # Foundation, version 2.1. #
14 # #
15 # It is distributed in the hope that it will be useful, #
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
18 # GNU Lesser General Public License for more details. #
19 # #
20 # See the GNU Lesser General Public License version 2.1 #
21 # for more details (enclosed in the file licenses/LGPLv2.1). #
22 # #
23 ##########################################################################
24
25 """This script finds files containing likely declarations and definitions
26 for a given function name, via heuristic syntactic matching."""
27
28 import sys
29 import build_callgraph
30
31 arg = ""
32 if len(sys.argv) < 2:
33 print(f"usage: {sys.argv[0]} [file1 file2 ...]")
34 print(" prints a heuristic callgraph for the specified files.")
35 sys.exit(1)
36 else:
37 files = sys.argv[1:]
38
39 cg = build_callgraph.compute(files)
40 build_callgraph.detect_recursion(cg)