This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++ Patch and pubnames 2/2] Adjust c decl pretty printer to match demangler (issue6195056)


On Mon, May 7, 2012 at 6:44 PM, Gabriel Dos Reis
<gdr@integrable-solutions.net> wrote:
> On Mon, May 7, 2012 at 7:10 PM, Sterling Augustine
> <saugustine@google.com> wrote:
>> This is the second in the series of patches to make c decl pretty printing
>> more closely match the demangler. A full explanation is here:
>>
>> http://gcc.gnu.org/ml/gcc-patches/2012-05/msg00512.html
>>
>> OK for mainline?
>
> Now I realize something that is wrong with the previous patch.
> Writing 'const T*' in C++ is very much wide spread style is also the
> style used in the C++ standard, TC++PL (the de facto popular reference TC++PL),
> our own C++ standard library implementation, and many popular modern
> C++ textbooks.
> It is a strongly well established style.
> Changing the pretty printer to satisfy the demangler as opposed to users
> look wrong headed.

I'm most definitely not trying to satisfy the demangler--I'm trying to
make GCC's naming consistent with the rest of the tool chain, which
will be good for users. Consider the C++ function:

int foo(const char *bar);

The problem is that the toolchain disagrees on the canonical
pretty-name of this function. If you use nm, objdump, or readelf, or
anything that must recover the name from the binary, you will see:

int foo(char const*)

The demangler follows the documented gnu_v3 demangling convention. As
far as I can tell, the C++ front end is ad-hoc. This disagreement
creates inconsistencies in the debugging information that is confusing
to users.

Do you have a suggestion for fixing the disagreement? I would love to
add this as a parameter somewhere, but the decision is very deep in
the internals of the pretty printer.

Sterling


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]