This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


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

Re: V3 fixes for classes.exp


* Make the "void" optional in constructors with no params

At first, I thought that MichaelS was talking about the "void" return
type that gdb is showing for constructors.  This is bogus and the test
suite is correct when it FAILs this output.

But when I actually read the patch, I saw that he was talking about
parameter types for functions that have no params:

  - \\(void\\)
  + \\((void|)\\)

With v2 g++, I see a lot of "foo(void)".   With v3 g++, these show
up as "foo()".

I think these changes are fine.

I haven't reviewed and tested the whole patch yet so I can't
recommend it yet.

History note: in the beginning, there were a lot of C header files with
declarations like "foo()", with no parameters (to be compatible with K&R
C).  Ansi C and C++ wanted to glom onto those header files, so they had
to adopt the convention that "foo()" declares a function with unspecified
parameters, whereas "foo(void)" declares a function with zero parameters.

C++ is abandoning K&R C, so the C++ convention is that "foo()" declares
a function with zero parameters.  So header files from 1985 don't work
anymore.

This history gets reflected in the demangler output.  So we have to cope
with both "foo(void)" and "foo()", depending on the compiler.  This is
easy to do when parsing output.  It requires more work when the test
script is providing input (such as breaking on either "foo(void)" or
"foo()".

MichaelC


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