bug-cflow
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-cflow] cflow-1.1 doesn't find main


From: Sergey Poznyakoff
Subject: Re: [Bug-cflow] cflow-1.1 doesn't find main
Date: Mon, 11 Sep 2006 23:14:51 +0300

Sergey Poznyakoff <address@hidden> wrote:

> Right from the top of my head I'd
> propose an option telling cflow to display only those symbols
> that are defined anywhere in the sources it is given in the command
> line. Will such an option help?

As a test implementation of this thought, please try the enclosed
patch.  It adds the new symbol class 'u', which stands for 'undefined
symbols'.  Running `cflow -i^u' will omit from the output all symbols,
not defined in the sources.

Regards,
Sergey

Index: src/main.c
===================================================================
RCS file: /cvsroot/cflow/cflow/src/main.c,v
retrieving revision 1.38
diff -p -u -r1.38 main.c
--- src/main.c  11 Sep 2006 18:28:51 -0000      1.38
+++ src/main.c  11 Sep 2006 20:11:05 -0000
@@ -214,11 +214,13 @@ int omit_symbol_names_option; /* Omit sy
 #define SM_STATIC      0x0004
 #define SM_UNDERSCORE  0x0008
 #define SM_TYPEDEF     0x0010
+#define SM_UNDEFINED   0x0020
 
 #define CHAR_TO_SM(c) ((c)=='x' ? SM_DATA : \
                         (c)=='_' ? SM_UNDERSCORE : \
                          (c)=='s' ? SM_STATIC : \
-                          (c)=='t' ? SM_TYPEDEF : 0)
+                          (c)=='t' ? SM_TYPEDEF : \
+                           (c)=='u' ? SM_UNDEFINED : 0)
 #define SYMBOL_INCLUDE(c) (symbol_map |= CHAR_TO_SM(c))
 #define SYMBOL_EXCLUDE(c) (symbol_map &= ~CHAR_TO_SM(c))
 int symbol_map;  /* A bitmap of symbols included in the graph. */
@@ -593,6 +595,7 @@ parse_opt (int key, char *arg, struct ar
               case '_':
               case 's':
               case 't':
+              case 'u':
                    if (num)
                         SYMBOL_INCLUDE(*arg);
                    else
@@ -710,6 +713,10 @@ include_symbol(Symbol *sym)
               type |= SM_DATA;
          else if (sym->arity >= 0)
               type |= SM_FUNCTIONS;
+
+         if (!sym->source)
+              type |= SM_UNDEFINED;
+         
      } else if (sym->type == SymToken) {
          if (sym->token_type == TYPE && sym->source)
               type |= SM_TYPEDEF;
@@ -755,7 +762,7 @@ main(int argc, char **argv)
      register_output("gnu", gnu_output_handler, NULL);
      register_output("posix", posix_output_handler, NULL);
 
-     symbol_map = SM_FUNCTIONS|SM_STATIC;
+     symbol_map = SM_FUNCTIONS|SM_STATIC|SM_UNDEFINED;
 
      if (getenv("POSIXLY_CORRECT")) {
          if (select_output_driver("posix"))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]