diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-02-08 11:58:26 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-02-08 12:10:15 +0200 |
commit | c29506a51108d3093b323b05a4f356847c60b607 (patch) | |
tree | ad174cecf194d6073e7e62c27d7976e5dd3f26c1 | |
parent | 9cc96ff20dac0d7d2c9091937395f85dc4fc8259 (diff) | |
download | cflow-c29506a51108d3093b323b05a4f356847c60b607.tar.gz cflow-c29506a51108d3093b323b05a4f356847c60b607.tar.bz2 |
New options: --all and --no-main
* NEWS: Document --all and --no-main
* configure.ac: Version 1.5.90
* doc/cflow.texi: Document --all and --no-main
* src/cflow.h (all_functions): New extern.
* src/main.c: New options: -A (--all) and --no-main
* src/output.c (tree_output): Output all graphs if
all_functions is set or no main function is defined.
-rw-r--r-- | NEWS | 25 | ||||
-rw-r--r-- | configure.ac | 5 | ||||
-rw-r--r-- | doc/cflow.texi | 28 | ||||
-rw-r--r-- | src/cflow.h | 4 | ||||
-rw-r--r-- | src/main.c | 18 | ||||
-rw-r--r-- | src/output.c | 10 |
6 files changed, 72 insertions, 18 deletions
@@ -1,8 +1,27 @@ | |||
1 | GNU cflow NEWS -- history of user-visible changes. 2016-05-17 | 1 | GNU cflow NEWS -- history of user-visible changes. 2019-02-08 |
2 | Copyright (C) 2005-2007, 2009-2011, 2014-2017 Sergey Poznyakoff | ||
3 | See the end of file for copying conditions. | 2 | See the end of file for copying conditions. |
4 | 3 | ||
5 | Please send cflow bug reports to <bug-cflow@gnu.org>. | 4 | Please send cflow bug reports to <bug-cflow@gnu.org>. |
5 | |||
6 | Version 1.5.90 (Git) | ||
7 | |||
8 | * New option --all (-A) | ||
9 | |||
10 | Produce graphs for all global functions in the program. Use this | ||
11 | option if your program contains functions which are not directly | ||
12 | reachable from main(). | ||
13 | |||
14 | The output consist of separate flow graphs for each global function | ||
15 | defined in the program. These graphs will be placed after the graph | ||
16 | for main() (if it exists), and will be ordered lexicographically by | ||
17 | the function name. | ||
18 | |||
19 | * New option --no-main | ||
20 | |||
21 | This option has the same effect as '--all', except that the graph for | ||
22 | main() function (if it exists) is treated same way as all the other | ||
23 | graphs, i.e. it will not be placed at the top of output, but in its | ||
24 | place as per the lexicographic ordering of function names. | ||
6 | 25 | ||
7 | 26 | ||
8 | Version 1.5, 2016-05-17 | 27 | Version 1.5, 2016-05-17 |
@@ -99,7 +118,7 @@ Initial version restored from 1997 snapshots. | |||
99 | ---------------------------------------------------------------------- | 118 | ---------------------------------------------------------------------- |
100 | * Copyright information: | 119 | * Copyright information: |
101 | 120 | ||
102 | Copyright (C) 2005-2007, 2009, 2010, 2011, 2016 Sergey Poznyakoff | 121 | Copyright (C) 2005-2019 Sergey Poznyakoff |
103 | 122 | ||
104 | Permission is granted to anyone to make or distribute verbatim copies | 123 | Permission is granted to anyone to make or distribute verbatim copies |
105 | of this document as received, in any medium, provided that the | 124 | of this document as received, in any medium, provided that the |
diff --git a/configure.ac b/configure.ac index 35f55f8..4aa58aa 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,6 +1,5 @@ | |||
1 | # This file is part of GNU cflow | 1 | # This file is part of GNU cflow |
2 | # Copyright (C) 2005, 2007, 2009, 2011, 2014-2016 Free Software | 2 | # Copyright (C) 2005-2019 Free Software Foundation, Inc. |
3 | # Foundation, Inc. | ||
4 | # | 3 | # |
5 | # Written by Sergey Poznyakoff | 4 | # Written by Sergey Poznyakoff |
6 | # | 5 | # |
@@ -18,7 +17,7 @@ | |||
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 18 | ||
20 | AC_PREREQ(2.61) | 19 | AC_PREREQ(2.61) |
21 | AC_INIT([GNU cflow], [1.5], [bug-cflow@gnu.org]) | 20 | AC_INIT([GNU cflow], [1.5.90], [bug-cflow@gnu.org]) |
22 | AC_CONFIG_SRCDIR([src/cflow.h]) | 21 | AC_CONFIG_SRCDIR([src/cflow.h]) |
23 | AC_CONFIG_AUX_DIR([build-aux]) | 22 | AC_CONFIG_AUX_DIR([build-aux]) |
24 | AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options | 23 | AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options |
diff --git a/doc/cflow.texi b/doc/cflow.texi index 643a792..4d613ea 100644 --- a/doc/cflow.texi +++ b/doc/cflow.texi | |||
@@ -30,7 +30,7 @@ Published by the Free Software Foundation, | |||
30 | 51 Franklin Street, Fifth Floor | 30 | 51 Franklin Street, Fifth Floor |
31 | Boston, MA 02110-1301, USA | 31 | Boston, MA 02110-1301, USA |
32 | 32 | ||
33 | Copyright @copyright{} 2005, 2010, 2014-2017 Sergey Poznyakoff | 33 | Copyright @copyright{} 2005-2019 Sergey Poznyakoff |
34 | 34 | ||
35 | Permission is granted to copy, distribute and/or modify this document | 35 | Permission is granted to copy, distribute and/or modify this document |
36 | under the terms of the GNU Free Documentation License, Version 1.2 or | 36 | under the terms of the GNU Free Documentation License, Version 1.2 or |
@@ -209,8 +209,8 @@ main() <int () at whoami.c:25>: | |||
209 | the function called @code{main}. It is convenient when analyzing a set | 209 | the function called @code{main}. It is convenient when analyzing a set |
210 | of input files comprising an entire @code{C} program. However, there | 210 | of input files comprising an entire @code{C} program. However, there |
211 | are circumstances where a user would want to see only a part of | 211 | are circumstances where a user would want to see only a part of |
212 | the graph starting on particular function. @command{Cflow} | 212 | the graph starting on particular function. One can instruct @command{cflow} |
213 | allows to select such function using @option{--main} (@option{-m}) | 213 | to start output from the desiredfunction using @option{--main} (@option{-m}) |
214 | command line option. Thus, running | 214 | command line option. Thus, running |
215 | 215 | ||
216 | @example | 216 | @example |
@@ -231,6 +231,14 @@ who_am_i() <int who_am_i (void) at whoami.c:8>: | |||
231 | @end group | 231 | @end group |
232 | @end example | 232 | @end example |
233 | 233 | ||
234 | Many programs (such as libraries or interpreters) define functions | ||
235 | that are not directly reachable from the main function. To produce | ||
236 | flow graph for all functions in the program, use the @option{--all} | ||
237 | (@option{-A}) option. The output will then include separate flow | ||
238 | graphs for each global function defined in the program. These graphs | ||
239 | will be placed after the graph for @code{main} (if it exists), and | ||
240 | will be ordered lexicographically by the function name. | ||
241 | |||
234 | @node Direct and Reverse | 242 | @node Direct and Reverse |
235 | @chapter Two Types of Flow Graphs. | 243 | @chapter Two Types of Flow Graphs. |
236 | @cindex @option{--reverse} | 244 | @cindex @option{--reverse} |
@@ -1200,6 +1208,14 @@ configuration file. | |||
1200 | with a bullet (@bullet{}). | 1208 | with a bullet (@bullet{}). |
1201 | 1209 | ||
1202 | @table @option | 1210 | @table @option |
1211 | @cindex @option{-A} | ||
1212 | @cindex @option{--all} | ||
1213 | @item -A | ||
1214 | @itemx --all | ||
1215 | Produce graphs for all global functions in the program. Use this | ||
1216 | option if your program contains functions, which are not directly | ||
1217 | reachable from @code{main} (@pxref{start symbol}). | ||
1218 | |||
1203 | @cindex @option{-a} | 1219 | @cindex @option{-a} |
1204 | @cindex @option{--ansi} | 1220 | @cindex @option{--ansi} |
1205 | @cindex @option{--no-ansi} | 1221 | @cindex @option{--no-ansi} |
@@ -1313,6 +1329,12 @@ For more information, @xref{Symbols}. | |||
1313 | @itemx --main=@var{name} | 1329 | @itemx --main=@var{name} |
1314 | Assume main function to be called @var{name}. @xref{start symbol}. | 1330 | Assume main function to be called @var{name}. @xref{start symbol}. |
1315 | 1331 | ||
1332 | @cindex @option{--no-main} | ||
1333 | @item --no-main | ||
1334 | There's no main function in the program. This option has the | ||
1335 | same effect as @option{--all}, except that, if the program defines | ||
1336 | the @code{main} function, it will be treated as any other functions. | ||
1337 | |||
1316 | @cindex @option{-n} | 1338 | @cindex @option{-n} |
1317 | @cindex @option{--number} | 1339 | @cindex @option{--number} |
1318 | @cindex @option{--no-number} | 1340 | @cindex @option{--no-number} |
diff --git a/src/cflow.h b/src/cflow.h index 1a5ec76..8779a68 100644 --- a/src/cflow.h +++ b/src/cflow.h | |||
@@ -1,6 +1,5 @@ | |||
1 | /* This file is part of GNU cflow | 1 | /* This file is part of GNU cflow |
2 | Copyright (C) 1997, 2005, 2007, 2009-2010, 2014-2017 Sergey | 2 | Copyright (C) 1997-2019 Sergey Poznyakoff |
3 | Poznyakoff | ||
4 | 3 | ||
5 | GNU cflow is free software; you can redistribute it and/or modify | 4 | GNU cflow is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -162,6 +161,7 @@ extern int brief_listing; | |||
162 | extern int reverse_tree; | 161 | extern int reverse_tree; |
163 | extern int out_line; | 162 | extern int out_line; |
164 | extern char *start_name; | 163 | extern char *start_name; |
164 | extern int all_functions; | ||
165 | extern int max_depth; | 165 | extern int max_depth; |
166 | extern int emacs_option; | 166 | extern int emacs_option; |
167 | extern int debug; | 167 | extern int debug; |
@@ -1,6 +1,5 @@ | |||
1 | /* This file is part of GNU cflow | 1 | /* This file is part of GNU cflow |
2 | Copyright (C) 1997, 2005, 2007, 2009-2011, 2014-2017 Sergey | 2 | Copyright (C) 1997-2019 Sergey Poznyakoff |
3 | Poznyakoff | ||
4 | 3 | ||
5 | GNU cflow is free software; you can redistribute it and/or modify | 4 | GNU cflow is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 5 | it under the terms of the GNU General Public License as published by |
@@ -44,6 +43,7 @@ enum option_code { | |||
44 | OPT_NO_TREE, | 43 | OPT_NO_TREE, |
45 | OPT_NO_BRIEF, | 44 | OPT_NO_BRIEF, |
46 | OPT_NO_EMACS, | 45 | OPT_NO_EMACS, |
46 | OPT_NO_MAIN, | ||
47 | OPT_NO_VERBOSE, | 47 | OPT_NO_VERBOSE, |
48 | OPT_NO_NUMBER, | 48 | OPT_NO_NUMBER, |
49 | OPT_NO_PRINT_LEVEL, | 49 | OPT_NO_PRINT_LEVEL, |
@@ -105,6 +105,8 @@ static struct argp_option options[] = { | |||
105 | N_("Register SYMBOL with given TYPE, or define an alias (if := is used). Valid types are: keyword (or kw), modifier, qualifier, identifier, type, wrapper. Any unambiguous abbreviation of the above is also accepted"), GROUP_ID+1 }, | 105 | N_("Register SYMBOL with given TYPE, or define an alias (if := is used). Valid types are: keyword (or kw), modifier, qualifier, identifier, type, wrapper. Any unambiguous abbreviation of the above is also accepted"), GROUP_ID+1 }, |
106 | { "main", 'm', N_("NAME"), 0, | 106 | { "main", 'm', N_("NAME"), 0, |
107 | N_("Assume main function to be called NAME"), GROUP_ID+1 }, | 107 | N_("Assume main function to be called NAME"), GROUP_ID+1 }, |
108 | { "no-main", OPT_NO_MAIN, NULL, 0, | ||
109 | N_("There's no main function; print graphs for all functions in the program") }, | ||
108 | { "define", 'D', N_("NAME[=DEFN]"), 0, | 110 | { "define", 'D', N_("NAME[=DEFN]"), 0, |
109 | N_("Predefine NAME as a macro"), GROUP_ID+1 }, | 111 | N_("Predefine NAME as a macro"), GROUP_ID+1 }, |
110 | { "undefine", 'U', N_("NAME"), 0, | 112 | { "undefine", 'U', N_("NAME"), 0, |
@@ -121,6 +123,9 @@ static struct argp_option options[] = { | |||
121 | #define GROUP_ID 20 | 123 | #define GROUP_ID 20 |
122 | { NULL, 0, NULL, 0, | 124 | { NULL, 0, NULL, 0, |
123 | N_("Output control:"), GROUP_ID }, | 125 | N_("Output control:"), GROUP_ID }, |
126 | { "all", 'A', NULL, 0, | ||
127 | N_("Show all functions, not only those reachable from main"), | ||
128 | GROUP_ID+1 }, | ||
124 | { "number", 'n', NULL, 0, | 129 | { "number", 'n', NULL, 0, |
125 | N_("* Print line numbers"), GROUP_ID+1 }, | 130 | N_("* Print line numbers"), GROUP_ID+1 }, |
126 | { "no-number", OPT_NO_NUMBER, NULL, OPTION_HIDDEN, | 131 | { "no-number", OPT_NO_NUMBER, NULL, OPTION_HIDDEN, |
@@ -216,7 +221,7 @@ char *level_begin = ""; | |||
216 | int preprocess_option = 0; /* Do they want to preprocess sources? */ | 221 | int preprocess_option = 0; /* Do they want to preprocess sources? */ |
217 | 222 | ||
218 | char *start_name = "main"; /* Name of start symbol */ | 223 | char *start_name = "main"; /* Name of start symbol */ |
219 | 224 | int all_functions; | |
220 | struct linked_list *arglist; /* List of command line arguments */ | 225 | struct linked_list *arglist; /* List of command line arguments */ |
221 | 226 | ||
222 | /* Given the option_type array and (possibly abbreviated) option argument | 227 | /* Given the option_type array and (possibly abbreviated) option argument |
@@ -512,6 +517,9 @@ parse_opt (int key, char *arg, struct argp_state *state) | |||
512 | int num; | 517 | int num; |
513 | 518 | ||
514 | switch (key) { | 519 | switch (key) { |
520 | case 'A': | ||
521 | all_functions = 1; | ||
522 | break; | ||
515 | case 'a': | 523 | case 'a': |
516 | strict_ansi = 1; |