This is an archive of the discontinued LLVM Phabricator instance.

[PATCH] clang: Remove libstdc++ gets hack
AbandonedPublic

Authored by urnathan on Apr 14 2021, 4:57 AM.

Details

Summary

This hack is a libstdc++ 4.8 workaround to do with gets. It was added
by 46d04a331c1ee Richard Smith, Sun Jan 8 04:01:15 2017 +0000. The
libstdc++ bug was fixed in 2016 for gcc 6.3 (released Dec2016) and
later.

This is more recent than the other libstdc++ hackectomy, but still over 4 years with a fix. WDYT?

Diff Detail

Event Timeline

urnathan requested review of this revision.Apr 14 2021, 4:57 AM
urnathan created this revision.

I think it's reasonable to remove this hack as well, but I have similar questions about whether we should note it in the release notes and whether there's any compatibility statement we need to update elsewhere.

clang/test/SemaCXX/libstdcxx_gets_hack.cpp
11

I think we should decide what version of libstdc++ we're prepared to support and document that somewhere, and it would make sense to remove the various libstdc++ compatibility changes that target older versions. Google still has builds that use Clang trunk, recent glibc, and libstdc++ 4.9, in >=C++14 mode, though (which I think is the combination that needs this workaround), so I'm not sure that the world is ready for Clang's minimum to be increased to 6.3 or later. (Of course Google could locally patch their libstdc++, but if there's one organization building in this mode still, it seems likely that there are others, and in particular version 4.9 was the last version prior to the introduction of the dual ABI, so there may be reasons people want to stop there in particular. I think at least the need to support libstdc++ 4.2 for Apple targets has disappeared now, though, so it's possible that we could drop support for 4.8 and earlier?)

If we do keep this hack, I think it would make sense to update the comments to refer to "specific old versions of libstdc++" (ideally specifying which ones) rather than talking inaccurately about libstdc++ in general. Though perhaps even describing this as a libstdc++ workaround is inappropriate -- wasn't this issue caused by glibc removing the function in C++ compilations, while it was still part of the C++ standard?

yeah, I guess that would be a little agressive. See https://reviews.llvm.org/D100680 for a comment update

urnathan abandoned this revision.Apr 20 2021, 11:27 AM