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 /src/main.c | |
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.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -1,9 +1,8 @@ /* This file is part of GNU cflow - Copyright (C) 1997, 2005, 2007, 2009-2011, 2014-2017 Sergey - Poznyakoff + Copyright (C) 1997-2019 Sergey Poznyakoff GNU cflow is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. @@ -41,12 +40,13 @@ enum option_code { OPT_EMACS, OPT_NO_USE_INDENTATION, OPT_NO_ANSI, OPT_NO_TREE, OPT_NO_BRIEF, OPT_NO_EMACS, + OPT_NO_MAIN, OPT_NO_VERBOSE, OPT_NO_NUMBER, OPT_NO_PRINT_LEVEL, OPT_NO_REVERSE, OPT_OMIT_ARGUMENTS, OPT_NO_OMIT_ARGUMENTS, @@ -102,12 +102,14 @@ static struct argp_option options[] = { { "pushdown", 'p', N_("NUMBER"), 0, N_("Set initial token stack size to NUMBER"), GROUP_ID+1 }, { "symbol", 's', N_("SYMBOL:[=]TYPE"), 0, 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 }, { "main", 'm', N_("NAME"), 0, N_("Assume main function to be called NAME"), GROUP_ID+1 }, + { "no-main", OPT_NO_MAIN, NULL, 0, + N_("There's no main function; print graphs for all functions in the program") }, { "define", 'D', N_("NAME[=DEFN]"), 0, N_("Predefine NAME as a macro"), GROUP_ID+1 }, { "undefine", 'U', N_("NAME"), 0, N_("Cancel any previous definition of NAME"), GROUP_ID+1 }, { "include-dir", 'I', N_("DIR"), 0, N_("Add the directory DIR to the list of directories to be searched for header files."), GROUP_ID+1 }, @@ -118,12 +120,15 @@ static struct argp_option options[] = { "", GROUP_ID+1 }, { "no-cpp", 0, NULL, OPTION_ALIAS|OPTION_HIDDEN, NULL, GROUP_ID+1 }, #undef GROUP_ID #define GROUP_ID 20 { NULL, 0, NULL, 0, N_("Output control:"), GROUP_ID }, + { "all", 'A', NULL, 0, + N_("Show all functions, not only those reachable from main"), + GROUP_ID+1 }, { "number", 'n', NULL, 0, N_("* Print line numbers"), GROUP_ID+1 }, { "no-number", OPT_NO_NUMBER, NULL, OPTION_HIDDEN, "", GROUP_ID+1 }, { "print-level", 'l', NULL, 0, N_("* Print nesting level along with the call tree"), GROUP_ID+1 }, @@ -213,13 +218,13 @@ char *level_indent[] = { NULL, NULL }; char *level_end[] = { "", "" }; char *level_begin = ""; int preprocess_option = 0; /* Do they want to preprocess sources? */ char *start_name = "main"; /* Name of start symbol */ - +int all_functions; struct linked_list *arglist; /* List of command line arguments */ /* Given the option_type array and (possibly abbreviated) option argument * find the type corresponding to that argument. * Return 0 if the argument does not match any one of OPTYPE entries */ @@ -509,12 +514,15 @@ add_preproc_option(int key, const char *arg) static error_t parse_opt (int key, char *arg, struct argp_state *state) { int num; switch (key) { + case 'A': + all_functions = 1; + break; case 'a': strict_ansi = 1; break; case OPT_NO_ANSI: strict_ansi = 0; break; @@ -613,12 +621,15 @@ parse_opt (int key, char *arg, struct argp_state *state) case OPT_NO_PRINT_LEVEL: print_levels = 0; break; case 'm': start_name = strdup(arg); break; + case OPT_NO_MAIN: + start_name = NULL; + break; case 'n': print_line_numbers = 1; break; case OPT_NO_NUMBER: print_line_numbers = 0; break; @@ -718,12 +729,13 @@ include_symbol(Symbol *sym) } void xalloc_die(void) { error(EX_FATAL, ENOMEM, _("Exiting")); + abort(); } void init() { if (level_indent[0] == NULL) |