This is an archive of the discontinued LLVM Phabricator instance.

Add secondary libstdc++ 4.8 and 5.1 detection mechanisms
ClosedPublic

Authored by hubert.reinterpretcast on Feb 26 2019, 9:07 AM.

Details

Summary

The date-based approach to detecting unsupported versions of libstdc++ does not handle bug fix releases of older versions. As an example, the __GLIBCXX__ value associated with version 5.1, 20150422, is less than the values associated with versions 4.8.5 and 4.9.3.

This patch adds secondary checks based on certain properties in sufficiently new versions of libstdc++.

Diff Detail

Repository
rL LLVM

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptFeb 26 2019, 9:07 AM
Herald added a subscriber: mgorny. · View Herald Transcript
jfb accepted this revision.Mar 4 2019, 11:19 AM

I'm not a fan of this type of detection, but unfortunately it's the best we have for now. Can you add a comment to that effect, and mention that when we go to GCC 7.1 or later we'll be able to use a better solution because of this;

_GLIBCXX_RELEASE
The major release number for libstdc++. This macro is defined to the GCC major version that the libstdc++ headers belong to, as an integer constant. When compiling with GCC it has the same value as GCC's pre-defined macro __GNUC__. This macro can be used when libstdc++ is used with a non-GNU compiler where __GNUC__ is not defined, or has a different value that doesn't correspond to the libstdc++ version. This macro first appeared in the GCC 7.1 release and is not defined for GCC 6.x or older releases.

I can't validate your heuristics, but I assume they're correct.

This revision is now accepted and ready to land.Mar 4 2019, 11:19 AM

Address review comment: Add note re: _GLIBCXX_RELEASE

This revision was automatically updated to reflect the committed changes.