Synopsis - Issue Tracker

Bug116 Editing

Title Cxx parser always fails with gcc-4.1.1
Created on 2006-11-25.11:00:30 by littletux, last changed 2006-11-25.13:58:07 by stefan.
assigned to stefan priority high
type behavior severity normal
components C++ parser platform GNU/Linux
status closed resolution fixed
depends on superseded by
Add Comment:
File
CC List:? littletux, stefan

Messages
Author: littletux Date: 2006-11-25.11:00:29
This bug was reported through the Debian BTS:

----------------------------------------
I can't get synopsis to work on any C++ code. ucpp emits an error and I get
no documentation out, no matter what was in the file:

$ ls -l empty.cpp
-rw-r--r-- 1 anon anon 0 2006-10-22 12:54 empty.cpp
$ synopsis -p Cxx -f HTML -o html empty.cpp
trying to redefine the special macro __STDC__
ucpp returned error flag. ignoring error.
$

It even claims that __STDC__ is being redefined on an empty file. Something's
gone wrong here.
----------------------------------------

I analysed it and it seems that the reason is the file ~/.synopsis/parsers/cpp/emulator which is generated (*if it does not exist yet*) by
/usr/share/pycentral/synopsis/site-packages/Synopsis/Parsers/Cpp/Emulator.py
which calls an installed gcc compiler to find the necessary builtin compiler
#defines and the include file paths. This seems to fail with gcc-4.1.1 (with gcc-4.0, it still worked). A workaround is to simply edit   ~/.synopsis/parsers/cpp/emulator
and remove the __STDC__ entry of the "macros" array:

  macros=[('__STDC__', '1'), ('__STDC_HOSTED__', '1'),      ...

will become

 macros=[('__STDC_HOSTED__', '1'),       ...

Thanks,
Andreas
Author: stefan Date: 2006-11-25.12:28:26
I can easily believe that. I had to play similar
games when using the boost.wave backend, i.e.
query macros from the compiler, then filter out
special ones such as __STDC__ because the 
preprocessor (wave or ucpp) defines it itself.
Author: stefan Date: 2006-11-25.13:58:07
It appears the current code in the Synopsis_0_8
branch already removes any __STDC__ definition:
http://synopsis.fresco.org/viewsvn/Synopsis/branches/Synopsis_0_8/Synopsis/Parsers/Cpp/ucpp/ucpp.cc?rev=1672&view=markup

So, this bug will be fixed in the next release.
(You may consider backporting it to make a quick
bugfix release for debian.)
History
Date User Action Args
2006-11-25 11:00:32littletuxcreate
2006-11-25 12:28:27stefansetstatus: new
assignedto: (no value)
messages: + msg578
nosy: + stefan
2006-11-25 13:58:07stefansetstatus: open
messages: + msg579
resolution: (no value)