* Style of libstdc++ header files
@ 2004-09-14 19:11 Wolfgang Bangerth
2004-09-14 19:17 ` Richard Guenther
2004-09-17 17:43 ` Benjamin Kosnik
0 siblings, 2 replies; 10+ messages in thread
From: Wolfgang Bangerth @ 2004-09-14 19:11 UTC (permalink / raw)
To: gcc, libstdc++, bugzilla-masters
libstdc++ and other compiler library header file writers,
the other day I again ploughed for several hours through libstdc++ headers
trying to reduce a testcase and it occurred to me again that I had always
meant to share some piece of experience:
When we try to reduce a testcase, we try to strip away large chunks of code.
This is fairly straightforward for code like this:
class X {
void method1 ();
//...
void method100 ();
};
void X::method1 () {...}
//...
void X::method100 () {...}
The reason is this: we try to remove all the definitions of X::method1...100.
If this succeeds, then fine. If not, then we remove 50-100 and see whether
the bug is still there, and so on. Note in particular that removing the
_definition_ of a function can _never_ introduce a new compile-time error,
since the declaration is still there. Thus, if only method63 is necessary to
show a particular ICE or compiler error, we're there relatively quickly by
bisection of the whole block of function definitions.
method63 will then only call a very small number of functions in class X, so
that I can also bulk delete the declarations of the other methods.
Unfortunately, libstdc++ is, mostly, not written that way: there are a lot of
definitions of member functions inlined into the class declaration. Now
consider what happens here:
class X {
void method1 () {}
void method2 () { method1(); }
void method3 () { method2(); something_else(); }
};
Assume that the problem happens because method3 tries to do something in
something_else(). method[12] are not involved at all, and I would like to
delete their definitions because they use other stuff that I'd like to remove
as well. Alas, I can't: I can't just bulk delete the entire block
method1--method2, since method3 calls method2 which in turn calls method2.
What I need to do is painstakingly edit the contents of the inlined
definitions of these functions because I can't just delete the entire block
without also removing the necessary declarations.
In effect, the work I will have to do is more like linear in the number of
functions in a class, rather than the previous logarithmic complexity. This
can be all the difference between a quick 15 minute reduction of a 50kloc
testcase, or, like yesterday, one that takes the better part of a football
game transmission (i.e. 2-3 hours).
My request therefore would be if the libstdc++ people could comment if it is
possible to gradually move away from their style of using inlined function
definitions, and towards a style where function declarations and definitions
are always clearly separated. I understand that this is a huge change, but
one that could make the life of us bugmasters so much easier!
Thanks
Wolfgang
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:17 ` Richard Guenther
@ 2004-09-14 19:17 ` Theodore Papadopoulo
2004-09-14 19:22 ` Wolfgang Bangerth
2004-09-14 19:20 ` Wolfgang Bangerth
1 sibling, 1 reply; 10+ messages in thread
From: Theodore Papadopoulo @ 2004-09-14 19:17 UTC (permalink / raw)
To: Richard Guenther; +Cc: Wolfgang Bangerth, gcc, libstdc++, bugzilla-masters
> My request therefore would be if the libstdc++ people could comment if it is
> possible to gradually move away from their style of using inlined function
> definitions, and towards a style where function declarations and definitions
> are always clearly separated. I understand that this is a huge change, but
> one that could make the life of us bugmasters so much easier!
I surely do not understand why it would be more difficult to turn the
inline definition into a declaration instead of simply deleting it...
Theo.
--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
--------------------------------------------------------------------
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:11 Style of libstdc++ header files Wolfgang Bangerth
@ 2004-09-14 19:17 ` Richard Guenther
2004-09-14 19:17 ` Theodore Papadopoulo
2004-09-14 19:20 ` Wolfgang Bangerth
2004-09-17 17:43 ` Benjamin Kosnik
1 sibling, 2 replies; 10+ messages in thread
From: Richard Guenther @ 2004-09-14 19:17 UTC (permalink / raw)
To: Wolfgang Bangerth; +Cc: gcc, libstdc++, bugzilla-masters
On Tue, 14 Sep 2004 13:50:43 -0500, Wolfgang Bangerth
<bangerth@ices.utexas.edu> wrote:
>
> My request therefore would be if the libstdc++ people could comment if it is
> possible to gradually move away from their style of using inlined function
> definitions, and towards a style where function declarations and definitions
> are always clearly separated. I understand that this is a huge change, but
> one that could make the life of us bugmasters so much easier!
I would oppose to that as atleast short always-to-be-inlined methods are
way easier to read/find if they are defined inline. I'd rather spent
the converting time creating a more C++-syntax aware
testcase-reduction tool (like f.i. as you are suggesting, removing
method definitions but retaining/creating declarations).
If our C++ parser would only be so readable to be able to reproduce
source - I tried for a weekend, but miserably failed to even get to
the point of just re-outputting recognized tokens...
Richard.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:17 ` Richard Guenther
2004-09-14 19:17 ` Theodore Papadopoulo
@ 2004-09-14 19:20 ` Wolfgang Bangerth
2004-09-14 19:24 ` Daniel Berlin
1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Bangerth @ 2004-09-14 19:20 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc, libstdc++, bugzilla-masters
> I would oppose to that as atleast short always-to-be-inlined methods are
> way easier to read/find if they are defined inline.
In reality, I hardly ever have to _find_ a particular method. I want to
_delete_ whole blocks of code, whatever is in them. What is important is the
number of semantic connections of other parts of a code into the block I want
to delete. For member function definitions, there are no such connections
because the declarations are still there.
> I'd rather spent
> the converting time creating a more C++-syntax aware
> testcase-reduction tool (like f.i. as you are suggesting, removing
> method definitions but retaining/creating declarations).
Well, fact is: there is no such tool. People have tried to play around with
Delta, but it turns out that the fastest and most efficient method is still
brute human force. Nobody seems to know how to write a tool like you suggest.
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:17 ` Theodore Papadopoulo
@ 2004-09-14 19:22 ` Wolfgang Bangerth
0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Bangerth @ 2004-09-14 19:22 UTC (permalink / raw)
To: Theodore Papadopoulo, Richard Guenther; +Cc: gcc, libstdc++, bugzilla-masters
> I surely do not understand why it would be more difficult to turn the
> inline definition into a declaration instead of simply deleting it...
That's actually simple to illustrate: think
class X{
void method1 () {...}
void method2 () {...}
void method3 () {...}
void method4 () {...}
};
In order to convert these four definitions into declarations, four edit
operations (mark everything from "{" to "}" and delete) are necessary.
On the other hand, if the code looked like
class X{
void method1 ();
void method2 ();
void method3 ();
void method4 ();
}
void X::method1 () {...}
void X::method2 () {...}
void X::method3 () {...}
void X::method4 () {...}
then I can remove the whole block of definitions with one edit operation (mark
everything from the line of the first to the line with the last definition
and delete).
Since the STL container, string, and iostream classes usually have several
dozen functions, editing every single member function can be a very tedious
process.
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:20 ` Wolfgang Bangerth
@ 2004-09-14 19:24 ` Daniel Berlin
2004-09-14 19:44 ` Wolfgang Bangerth
0 siblings, 1 reply; 10+ messages in thread
From: Daniel Berlin @ 2004-09-14 19:24 UTC (permalink / raw)
To: Wolfgang Bangerth; +Cc: gcc, libstdc++, Richard Guenther, bugzilla-masters
On Sep 14, 2004, at 3:11 PM, Wolfgang Bangerth wrote:
>
>> I would oppose to that as atleast short always-to-be-inlined methods
>> are
>> way easier to read/find if they are defined inline.
>
> In reality, I hardly ever have to _find_ a particular method. I want to
> _delete_ whole blocks of code, whatever is in them. What is important
> is the
> number of semantic connections of other parts of a code into the block
> I want
> to delete. For member function definitions, there are no such
> connections
> because the declarations are still there.
>
>
>> I'd rather spent
>> the converting time creating a more C++-syntax aware
>> testcase-reduction tool (like f.i. as you are suggesting, removing
>> method definitions but retaining/creating declarations).
>
> Well, fact is: there is no such tool. People have tried to play around
> with
> Delta, but it turns out that the fastest and most efficient method is
> still
> brute human force. Nobody seems to know how to write a tool like you
> suggest.
>
It depends on if you are trying to minimize a testcase for C++ FE bugs,
or an optimization bug.
For the case of C++ FE bugs, yer right, you will need to integrate it
with some C++ syntax aware minimizer.
For the case of optimization bugs, you are looking at the problem the
wrong way.
See LLVM's bugpoint for a tool that does this right.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:24 ` Daniel Berlin
@ 2004-09-14 19:44 ` Wolfgang Bangerth
0 siblings, 0 replies; 10+ messages in thread
From: Wolfgang Bangerth @ 2004-09-14 19:44 UTC (permalink / raw)
To: Daniel Berlin; +Cc: gcc, libstdc++, Richard Guenther, bugzilla-masters
> It depends on if you are trying to minimize a testcase for C++ FE bugs,
> or an optimization bug.
> For the case of C++ FE bugs, yer right, you will need to integrate it
> with some C++ syntax aware minimizer.
Yes, that's the class of bugs which I am mostly concerned about. And the one
for which we regularly get the largest and hardest to reduce testcases.
W.
-------------------------------------------------------------------------
Wolfgang Bangerth email: bangerth@ices.utexas.edu
www: http://www.ices.utexas.edu/~bangerth/
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-14 19:11 Style of libstdc++ header files Wolfgang Bangerth
2004-09-14 19:17 ` Richard Guenther
@ 2004-09-17 17:43 ` Benjamin Kosnik
2004-09-17 19:27 ` Mark Mitchell
1 sibling, 1 reply; 10+ messages in thread
From: Benjamin Kosnik @ 2004-09-17 17:43 UTC (permalink / raw)
To: Wolfgang Bangerth; +Cc: gcc, libstdc++, bugzilla-masters
Thanks for your observations Wolfgang. Your efforts on g++ are
definitely appreciated, and I look on in amazement at some of the
reduction feats that you have pulled off in bugzilla.
>My request therefore would be if the libstdc++ people could comment if it is
>possible to gradually move away from their style of using inlined function
>definitions, and towards a style where function declarations and definitions
>are always clearly separated. I understand that this is a huge change, but
>one that could make the life of us bugmasters so much easier!
This will, of course, make the libstdc++ include files bigger for
everybody else... but perhaps only marginally so.
You could put a feature request in bugzilla about this so it's not
forgotten.
best,
benjamin
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-17 17:43 ` Benjamin Kosnik
@ 2004-09-17 19:27 ` Mark Mitchell
2004-09-17 19:57 ` Gabriel Dos Reis
0 siblings, 1 reply; 10+ messages in thread
From: Mark Mitchell @ 2004-09-17 19:27 UTC (permalink / raw)
To: Benjamin Kosnik; +Cc: Wolfgang Bangerth, gcc, libstdc++, bugzilla-masters
Benjamin Kosnik wrote:
>Thanks for your observations Wolfgang. Your efforts on g++ are
>definitely appreciated, and I look on in amazement at some of the
>reduction feats that you have pulled off in bugzilla.
>
>
>
>>My request therefore would be if the libstdc++ people could comment if it is
>>possible to gradually move away from their style of using inlined function
>>definitions, and towards a style where function declarations and definitions
>>are always clearly separated. I understand that this is a huge change, but
>>one that could make the life of us bugmasters so much easier!
>>
>>
>
>This will, of course, make the libstdc++ include files bigger for
>everybody else... but perhaps only marginally so.
>
>
It would be worth measuring compile times before doing that. Parsing
declarations is expensive, and you'll now have two for every function.
--
Mark Mitchell
CodeSourcery, LLC
(916) 791-8304
mark@codesourcery.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Style of libstdc++ header files
2004-09-17 19:27 ` Mark Mitchell
@ 2004-09-17 19:57 ` Gabriel Dos Reis
0 siblings, 0 replies; 10+ messages in thread
From: Gabriel Dos Reis @ 2004-09-17 19:57 UTC (permalink / raw)
To: Mark Mitchell
Cc: Benjamin Kosnik, Wolfgang Bangerth, gcc, libstdc++, bugzilla-masters
Mark Mitchell <mark@codesourcery.com> writes:
| Benjamin Kosnik wrote:
|
| >Thanks for your observations Wolfgang. Your efforts on g++ are
| >definitely appreciated, and I look on in amazement at some of the
| >reduction feats that you have pulled off in bugzilla.
| >
| >
| >> My request therefore would be if the libstdc++ people could comment
| >> if it is possible to gradually move away from their style of using
| >> inlined function definitions, and towards a style where function
| >> declarations and definitions are always clearly separated. I
| >> understand that this is a huge change, but one that could make the
| >> life of us bugmasters so much easier!
| >>
| >
| >This will, of course, make the libstdc++ include files bigger for
| >everybody else... but perhaps only marginally so.
| >
| It would be worth measuring compile times before doing that. Parsing
| declarations is expensive, and you'll now have two for every function.
While I can see the point of Wolfgang, I'm not convinced at all that
V3 should take that path.
-- Gaby
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2004-09-17 18:51 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-14 19:11 Style of libstdc++ header files Wolfgang Bangerth
2004-09-14 19:17 ` Richard Guenther
2004-09-14 19:17 ` Theodore Papadopoulo
2004-09-14 19:22 ` Wolfgang Bangerth
2004-09-14 19:20 ` Wolfgang Bangerth
2004-09-14 19:24 ` Daniel Berlin
2004-09-14 19:44 ` Wolfgang Bangerth
2004-09-17 17:43 ` Benjamin Kosnik
2004-09-17 19:27 ` Mark Mitchell
2004-09-17 19:57 ` Gabriel Dos Reis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).