Getting Apple's libstdc++ debug mode into the FSF tree

Doug Gregor dgregor@apple.com
Wed Jul 16 00:06:00 GMT 2003


On Tuesday, July 15, 2003, at 04:35 PM, Loren James Rittle wrote:

>> 5) g++specs to deal with -lstdc++-debug: this will be a small patch
>> that teaches the driver to deal with the debug library. This is the
>> only change to the compiler that will be absolutely required.
>
> If there is a change in libraries rather than an extra library, I too
> would rather see a formal switch defined to control the selection.
> I.e. this would indeed mirror the almost portable, yet defined on
> per-port basis, -pthread flag.  Humm, I don't see the issue Benjamin
> raised since all ports get the same definition of the spec file bits
> for picking up libstdc++.
>
>> 6) Debug-mode std::map patch: this will be another small patch that
>> turns on replacement of std::map with the debug version when
>> _GLIBCXX_DEBUG is defined.
>
> I'd really be against any new code being installed in the C++ library
> which is keyed off a macro exposed to the user (_GLIBCXX_DEBUG).  We
> have been working hard to kill those regions.  I would not block such
> a change unless the implementations don't mix gracefully (even then,
> I'm only one vote of all the library implementators).  I.e. if the
> user compiles some code with _GLIBCXX_DEBUG and some without and the
> mixed code can crash, I'd be completely against the change.  I've read
> too many PRs from confused users over the years before we rectified
> the threading code situation...
>
> Regards,
> Loren

Matt was asking about precedent w.r.t. linking against different 
libraries based on a macro, and it sounds like -pthreads is it. So in 
the next revision of the patch I'll make _GLIBCXX_DEBUG an 
implementation detail, and use a formal switch that will (a) define 
_GLIBCXX_DEBUG and (b) link against the debug library. Here are some 
options for the name of the formal switch:

	-lstdc++-debug) Gaby's suggestion
	-debug or -debug=c++) Benjamin's comment
	-gc++lib) Just a thought...
	
My opinions on these:
	-lstdc++-debug) I think it will confuse users, because they won't pass 
it to the compiler thinking it only needs to be passed to the linker.
	-debug or -debug=c++) I like it.
	-gc++lib) Cute, because -g is already the debug flag and "c++lib" is 
another debug mode, but potentially dangerous because people tend to 
mix "-g" code with non-"-g" code, and might think they can do so here 
(they can't).

Anyone have a strong preference on these? Or any other flag names?

	Doug



More information about the Libstdc++ mailing list