how to handle redefines, in particular the ellipsis symbol

View: New views
3 Messages — Rating Filter:   Alert me  

how to handle redefines, in particular the ellipsis symbol

by Larry Evans-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

While running cflow on gcc's preprocessed gcc/cp/pt.c, I get:

> cflow:/usr/include/stdio.h:404: .../-1 redefined
> cflow:/usr/include/stdio.h:362: this is the place of previous definition
> cflow:/usr/include/fcntl.h:120: .../-1 redefined
> cflow:/usr/include/stdio.h:404: this is the place of previous definition
> cflow:/usr/include/malloc.h:50: malloc/1 redefined
> cflow:/usr/include/stdlib.h:471: this is the place of previous definition
> cflow:/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../include/libiberty.h:149:
> .../-1 redefined
> cflow:/usr/include/fcntl.h:120: this is the place of previous definition
> cflow:/usr/include/gmp.h:1643: __gmpz_fits_ulong_p/1 redefined
> cflow:/usr/include/gmp.h:845: this is the place of previous definition
I attempted to workaround the problem by using a cflow option:

  --symbol <SomeRedefinedSymbol>:wrapper

where <SomeRedefinedSymbol> is one of the symbols preceding the
'/-redefined'
in the aforementioned error messages.  This seems to work for some
symbols; however, for ..., it doesn't.  I tried:

  --symbol ...:type

and:

  --symbol \.\.\.:type

however, neither worked.

How can I get cflow to not diagnose ... as a redefined symbol?
My Makefile, cflow.mk, and a perl program, cflow.redefined.pl,
used to generate the --symbol options, are attached.

TIA.

-regards,
Larry



SRC.name=pt
TAR.path=cp
SRC.dir=/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc

CFLOW.redefined.syms:= $(shell cat cflow.redefined.out)

CFLOW.wrappers= \
  --symbol GTY:wrapper \
  --symbol __MALLOC_P:wrapper \
  --symbol __attribute_malloc__:wrapper \
  --symbol \.\.\.:type \
  $(CFLOW.redefined.syms)

.PHONY: cflow.redefined.inp

###The following was based on copying part of the output from:
#
#  make -W ./gcc/cp/pt.c -n
#
#The part copied was the output showing the command line for
#compiling cp/pt.c
#

#C.flags= -DIN_GCC -DHAVE_CONFIG_H -I. -Icp -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/cp -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../include -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libcpp/include  -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libdecnumber -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libdecnumber/bid -I../libdecnumber

C.flags=-g -fkeep-inline-functions -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Werror -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -Icp -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/cp -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../include -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libcpp/include  -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libdecnumber -I/home/evansl/download/gcc/svn/patch.none.gdb/build/../src/gcc/../libdecnumber/bid -I../libdecnumber

###Create preprocessor output files.
%.E.c: %.c
        gcc -E $(C.flags) $< -o $@

###The following is based on:
#
#  http://www.gnu.org/software/cflow/manual/cflow.html#Makefiles
#
GCC.srcs=$(SRC.dir)/$(TAR.path)/$(SRC.name).E.c

cflow.gcc: $(GCC.srcs) cflow.mk cflow.redefined.out
        cflow $(CFLOW.wrappers) -o $@ $(GCC.srcs)

cflow.redefined.inp:
        cflow $(CFLOW.wrappers)-o /dev/null $(GCC.srcs) 2> $@.temp
        cat $@.temp>>$@

cflow.redefined.out: cflow.redefined.inp cflow.redefined.pl
        ./cflow.redefined.pl < $< > $@

echo:
        @echo CFLOW.redefined.syms=$(CFLOW.redefined.syms)


_______________________________________________
bug-cflow mailing list
bug-cflow@...
http://lists.gnu.org/mailman/listinfo/bug-cflow

cflow.redefined.pl (932 bytes) Download Attachment

Re: how to handle redefines, in particular the ellipsis symbol

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Larry,

Cflow handles ellipsis by default, since it is required by the standard.
If it fails to do so, that's probably some preceding symbol that makes the
things go out of whack. You have not given enough information for
me to be able to reproduce the situation. In particular, you have
forgotten to say: (1) what version of GNU cflow you are using, (2) how
do you invoke it, and (3) what is the contents of gcc/cp/pt.c.

Regards,
Sergey


_______________________________________________
bug-cflow mailing list
bug-cflow@...
http://lists.gnu.org/mailman/listinfo/bug-cflow

Parent Message unknown Re: how to handle redefines, in particular the ellipsis symbol

by Sergey Poznyakoff-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Larry Evans <cppljevans@...> ha escrit:

> evansl@evansl-desktop:~$ cflow --version
> cflow (GNU cflow) 1.2

That version is old, but it turned out that 1.3 performs poorly on
gcc sources as well. Thanks for reporting. This led me to fixing
a minor bug in the parser and improving performance on deeply nested
recursive calls. The fixed version is available here:

  ftp://download.gnu.org.ua/pub/alpha/cflow/cflow-1.3.1-20091109.tar.bz2

Please give it a try.
 
> This is given by the attached cflow.mk file.

Oh my :) That's clearly an overkill. You are trying to define
all preprocessor symbols instead of leaving this job to the cpp.

I used the following cflow.rc (of course, you would need to
adjust include paths):

# cflow.rc begins
-I /home/gray/src/gcc
-I /home/gray/src/gcc/gcc
-I /home/gray/src/gcc/include
-I /home/gray/src/gcc/host-i686-pc-linux-gnu/gcc
-I /home/gray/src/gcc/libcpp/include/
--symbol __const:type
--symbol __restrict:type
-D__extension__=
-D__attribute__\\(c\\)=
-D__asm__\\(c\\)=
-D__inline__
-D__inline
# cflow.rc ends

Cflow was called from /home/gray/src/gcc/gcc/cp this way:

  CFLOWRC=./cflow.rc cflow -b *.c > out.cf
 
The version 1.3.1 produced a flowchart without warnings.

Regards,
Sergey


_______________________________________________
bug-cflow mailing list
bug-cflow@...
http://lists.gnu.org/mailman/listinfo/bug-cflow