This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: demengler in libstdc++ is changed
On Nov 14, 2003, at 7:59 AM, H. J. Lu wrote:
On Fri, Nov 14, 2003 at 02:28:33AM +0100, Carlo Wood wrote:
On Thu, Nov 13, 2003 at 07:36:56PM -0600, Chris Lattner wrote:
BTW, is anyone working on fixing the demangler in libiberty? There
is a replacement in C++.
If it's a problem that it is written in C++, you could always just
compile
it with the LLVM G++ compiler to C. Include _that_ in libiberty...
problem solved! :) :)
We already provided a library with C linkage (that does not need
libstdc++). But the libiberty people don't want to need a C++
compiler to compile libiberty.
My main question is, should 2 demanglers have the same correct output
on the same input? If the answer is YES, I think the testsuites should
be modified to enforce that. If the answer is NO, that is a regression
from gcc 3.2/3.3.
So far nobody has defended a NO answer. So I will. I don't think
there is any reason to expect that two demanglers should produce
the same character-by-character output. I expect that both demanglers
should produce correct output, but there are multiple correct ways to
write some constructs in C++. Users should not care which one is used
(so long as the output is clear), and the output of demanglers should
only be used for inspection by humans. Programs that want to
manipulate information about C++ programs should use some other
mechanism, such as mangled names or parse trees.
Example: _Z3fooPKi could reasonably be demangled as foo(const int*),
or foo(int const*), or foo(int const *), or a number of other
choices. All are correct; as far as the compiler is concerned, there
is no difference between them. Programmers use those forms
interchangeably, or choose between them on stylistic grounds. In
my opinion a demangler that chose any of those forms is correct.
--Matt