aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-02-08 11:58:26 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-02-08 12:10:15 +0200
commitc29506a51108d3093b323b05a4f356847c60b607 (patch)
treead174cecf194d6073e7e62c27d7976e5dd3f26c1
parent9cc96ff20dac0d7d2c9091937395f85dc4fc8259 (diff)
downloadcflow-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--NEWS25
-rw-r--r--configure.ac5
-rw-r--r--doc/cflow.texi28
-rw-r--r--src/cflow.h4
-rw-r--r--src/main.c18
-rw-r--r--src/output.c10
6 files changed, 72 insertions, 18 deletions
diff --git a/NEWS b/NEWS
index 11d811d..d469db2 100644
--- a/NEWS
+++ b/NEWS
@@ -1,8 +1,27 @@
1GNU cflow NEWS -- history of user-visible changes. 2016-05-17 1GNU cflow NEWS -- history of user-visible changes. 2019-02-08
2Copyright (C) 2005-2007, 2009-2011, 2014-2017 Sergey Poznyakoff
3See the end of file for copying conditions. 2See the end of file for copying conditions.
4 3
5Please send cflow bug reports to <bug-cflow@gnu.org>. 4Please send cflow bug reports to <bug-cflow@gnu.org>.
5
6Version 1.5.90 (Git)
7
8* New option --all (-A)
9
10Produce graphs for all global functions in the program. Use this
11option if your program contains functions which are not directly
12reachable from main().
13
14The output consist of separate flow graphs for each global function
15defined in the program. These graphs will be placed after the graph
16for main() (if it exists), and will be ordered lexicographically by
17the function name.
18
19* New option --no-main
20
21This option has the same effect as '--all', except that the graph for
22main() function (if it exists) is treated same way as all the other
23graphs, i.e. it will not be placed at the top of output, but in its
24place as per the lexicographic ordering of function names.
6 25
7 26
8Version 1.5, 2016-05-17 27Version 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
102Copyright (C) 2005-2007, 2009, 2010, 2011, 2016 Sergey Poznyakoff 121Copyright (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
20AC_PREREQ(2.61) 19AC_PREREQ(2.61)
21AC_INIT([GNU cflow], [1.5], [bug-cflow@gnu.org]) 20AC_INIT([GNU cflow], [1.5.90], [bug-cflow@gnu.org])
22AC_CONFIG_SRCDIR([src/cflow.h]) 21AC_CONFIG_SRCDIR([src/cflow.h])
23AC_CONFIG_AUX_DIR([build-aux]) 22AC_CONFIG_AUX_DIR([build-aux])
24AM_INIT_AUTOMAKE([1.11 gnits tar-ustar dist-bzip2 dist-xz std-options 23AM_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,
3051 Franklin Street, Fifth Floor 3051 Franklin Street, Fifth Floor
31Boston, MA 02110-1301, USA 31Boston, MA 02110-1301, USA
32 32
33Copyright @copyright{} 2005, 2010, 2014-2017 Sergey Poznyakoff 33Copyright @copyright{} 2005-2019 Sergey Poznyakoff
34 34
35Permission is granted to copy, distribute and/or modify this document 35Permission is granted to copy, distribute and/or modify this document
36under the terms of the GNU Free Documentation License, Version 1.2 or 36under the terms of the GNU Free Documentation License, Version 1.2 or
@@ -209,8 +209,8 @@ main() <int () at whoami.c:25>:
209the function called @code{main}. It is convenient when analyzing a set 209the function called @code{main}. It is convenient when analyzing a set
210of input files comprising an entire @code{C} program. However, there 210of input files comprising an entire @code{C} program. However, there
211are circumstances where a user would want to see only a part of 211are circumstances where a user would want to see only a part of
212the graph starting on particular function. @command{Cflow} 212the graph starting on particular function. One can instruct @command{cflow}
213allows to select such function using @option{--main} (@option{-m}) 213to start output from the desiredfunction using @option{--main} (@option{-m})
214command line option. Thus, running 214command 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
234Many programs (such as libraries or interpreters) define functions
235that are not directly reachable from the main function. To produce
236flow graph for all functions in the program, use the @option{--all}
237(@option{-A}) option. The output will then include separate flow
238graphs for each global function defined in the program. These graphs
239will be placed after the graph for @code{main} (if it exists), and
240will 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.
1200with a bullet (@bullet{}). 1208with 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
1216option if your program contains functions, which are not directly
1217reachable 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
1335same effect as @option{--all}, except that, if the program defines
1336the @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;
162extern int reverse_tree; 161extern int reverse_tree;
163extern int out_line; 162extern int out_line;
164extern char *start_name; 163extern char *start_name;
164extern int all_functions;
165extern int max_depth; 165extern int max_depth;
166extern int emacs_option; 166extern int emacs_option;
167extern int debug; 167extern int debug;
diff --git a/src/main.c b/src/main.c
index e67b3e0..a5535c7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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 = "";
216int preprocess_option = 0; /* Do they want to preprocess sources? */ 221int preprocess_option = 0; /* Do they want to preprocess sources? */
217 222
218char *start_name = "main"; /* Name of start symbol */ 223char *start_name = "main"; /* Name of start symbol */
219 224int all_functions;
220struct linked_list *arglist; /* List of command line arguments */ 225struct 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;