[PATCH] RFC: PR78905 define _GLIBCXX_RELEASE macro

Ed Smith-Rowland 3dw4rd@verizon.net
Tue Jan 17 21:56:00 GMT 2017


On 01/17/2017 12:25 PM, Jonathan Wakely wrote:
> As I said in https://gcc.gnu.org/ml/libstdc++/2017-01/msg00109.html
> the __GLIBCXX__ macro is useless, but is the closest thing we have to
> a version macro for libstdc++. This matters when using libstdc++ with
> Clang or Intel icc or other compilers, because you can't check the
> __GNUC__ macro. I've seen several requests for a way to check the
> libstdc++ version, or complaints that there is no way to do it.
>
> This patch adds a new _GLIBCXX_RELEASE macro that contains the same
> value as __GNUC__ i.e. the major release number.
>
> - Yes, it only contains the major number. We could in theory have
>  _GLIBCXX_MAJOR and _GLIBCXX_MINOR instead, but between
>  _GLIBCXX_RELEASE and __GLIBCXX__ you can identify the release branch
>  and a date within that branch.
>
> - The name is "RELEASE" because we used to define _GLIBCXX_VERSION
>  many years ago, but it was a string literal and this is an integer.
>  To avoid problems for any old code checking for _GLIBCXX_VERSION I
>  chose a different name.
>
> Thoughts?
>
>
>     PR libstdc++/78905
>     * include/Makefile.am (_GLIBCXX_RELEASE): Set value.
>     * include/Makefile.in: Regenerate.
>     * include/bits/c++config (_GLIBCXX_RELEASE): Add #define.
>     * testsuite/ext/profile/mutex_extensions_neg.cc: Use lineno of 0 in
>     dg-error.
>
This might stop people from complaining about stub implementations.

It would also help with ABI breaks and as a coarse-grained feature-macro.

It seems like we'd want to backport this of course.

Of course you want more feedback from packagers.

Ed



More information about the Libstdc++ mailing list