https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59675

--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Jay Feldblum from comment #7)
> The caveat, not to pollute `bits/c++config` with `#include </* anything,
> really */>`. Are there more caveats to be aware of?

No, that's it. The additional overhead of calling a function defined in the
library is not a problem, because we're aborting anyway.

> 
> The suggestion, to export a helper routine that would work like `printf` but
> emit to stderr. I can't tell whether that's a strong or weak preference. The
> patch I went with - exporting a helper routine that returns the value of
> `stderr` - is a bit smaller. But if that's not the preference then I can
> change the patch.

That seems OK. Another option would be to export the existing __snprintf_lite
function and print into a buffer, then use ::write(2, ...) to output that.
Either way requires adding a new export to the library. Using write has some
other advantages, but means polluting the namespace (and isn't available on all
targets) which isn't a problem with __builtin_printf or __builtin_fprintf.


> Beyond the question of what helper routine to add, there is where to add it.
> I cam e up with a guess but perhaps a better place will be suggested.

src/c++98/compatibility.cc is definitely wrong, that's for symbols that are
only retained for backwards compatibility with previous releases. Not for new
symbols for new features.

Patches should be sent to the libstdc++ and gcc-patches mailing lists for
review though, rather than attached here.

Thanks for working on this!

Reply via email to