This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: TR library extensions
Martin Sebor <sebor@roguewave.com> writes:
| Gabriel Dos Reis wrote:
|
| ...
| > The most interesting thing is to detail the "behind the scenes".
| > You have to work that those details. You can't just hand wave.
| > -pthreads does not have the same weight as -std=tr1. What does
| > std=tr1 mean? C++98 + TR? C++03 + TR? C++0x + TR?
|
| I didn't come up with the name and I'm not advocating its choice here
still, that is what you've been doing.
| (my personal preference would have been to follow POSIX and #define
| some macro to the value of the date the standard, the TR, or a
| particular implementation thereof was released). Whatever it is,
| though, I expect you (the implementor) to define what it means if
| you plan to provide support for it, and I expect us (the C++
| committee) to require that you do so in one way or another :)
|
| >
| ...
| > If you have different thread models, you have to install different
| > compilers.
|
| I've been using gcc -threads and gcc -pthreads with the same compiler
| on Solaris (at least with 2.95.2), so unless that's changed I think
| you're mistaken (or we're talking about different things).
You've been using something not guaranteed. The (GCC-3.x) doc says:
--[ invoke.texi ]--
@item -threads
@opindex threads
Add support for multithreading with the @dfn{dce thread} library
under HP-UX. This option sets flags for both the preprocessor and
linker.
--[ install.texi ]--
@item --enable-threads
Specify that the target
supports threads. This affects the Objective-C compiler and runtime
library, and exception handling for other languages like C++ and Java.
On some systems, this is the default.
In general, the best (and, in many cases, the only known) threading
model available will be configured for use. Beware that on some
systems, gcc has not been taught what threading models are generally
available for the system. In this case, @option{--enable-threads} is
an
alias for @option{--enable-threads=single}.
The docs do not say you can change between thread model with the same
compiler.
| > [...]
| > | In this case, it seems trivial to stick these extensions in a
| > separate
| > | directory that's not on the preprocessor search patch unless -std=tr1
| > | is on the command line, or to add an #error directive to the top of
| > | each extension header guarded by an #if !__TR1__. It improves the
| > | quality of the implementation and the effort is minimal.
| > If it is that simple, then put -D__LIBCXX_TR1__ on command line.
|
| That's fine with me
so, what are we arguing about?
| (although I suspect that it is not that simple
| because of the binary compatibility issue brought up by Petur).
and that issue has a simple solution.
| Note that I didn't write specifically in support of the -std option
| but in support of any such mechanism:
|
| > a quality implementation of C++ such as gcc
| > should provide an option for programs to choose the version of the
| > C++ standard they want to conform to, and the compiler should
| > diagnose detectable violations when the option is selected.
If you use a configured a compiler not to include its semantics of TR,
you have high chance not to get them, hence issue proper diagnostics.
-- Gaby