This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: throw(), pure and const flags on functions
Hi,
> Well, I have my warning ready, so lets see if we all understand what
> this is about. This is first patch I would like to propose adding
> nothrow markers to the rbtrees functions.
> I noticed that there are also two functions that are used internally
> only in .cc file but not marked static. Why this is so? I added static
> keyword there.
>
Unfortunately, you can't do that so easily, because those symbols are
exported and we break the ABI if we just mark those functions as static,
they just disappear from the *.so. If you really want to accomplish
something to the same effect, for now, until we break the ABI, you have
to keep exporting the symbols, thus just invent a tiny wrapper around
each functions, not marked as static, forwarding to the real renamed
function, marked as static and used as such elsewhere in the .cc. I hope
it's clear ;)
> Does the following patch look OK? If so, i would like to commit it and
> follo9wup with more .cc files.
>
Makes perfect sense to me. Just wait a bit, say 24h, in case of comments
from the other maintainers, then just go ahead.
> We also need to decide how to handle the attributes. Are we going to
> use direct __attribute__ ((pure)) or have some kind of ATTRIBUTE_PURE
> define somewhere? And if so, where it should be defined?
>
I see. Remember to "uglify" always "uglify" in the library, thus it
would be _ATTRIBUTE_PURE, or something like that, with an underscore at
the beginning. Indeed, we have a place for those things,
include/bits/c++config, should be ok.
... and, remember to be very careful with the testsuite, your first
draft does *not* pass it, because of the ABI thing ;)
Paolo.