This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] RFC: PR78905 define _GLIBCXX_RELEASE macro


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]