[committed 2/5] libstdc++: Fix macro redefinition warnings

Jonathan Wakely jwakely@redhat.com
Thu Sep 10 18:19:17 GMT 2020


Including <version> after <iterator> gives a warning about redefining
the __cpp_lib_array_constexpr macro. What happens is that <iterator>
sets the C++20 value, then <version> redefines it to the C++17 value,
then undefines it and defines it again to the C++20 value.

This change avoids defining it to the C++17 value when compiling C++20
or later (which also means we no longer need the #undef).

A similar warning happens for __cpp_lib_constexpr_char_traits when
including <version> after any header that includes <bits/char_traits.h>.

libstdc++-v3/ChangeLog:

         * include/std/version (__cpp_lib_array_constexpr):
         (__cpp_lib_constexpr_char_traits): Only define C++17 value when
         compiling C++17.


Tested powerpc64le-linux. Committed to trunk.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 2165 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/libstdc++/attachments/20200910/e3b973fc/attachment.bin>


More information about the Libstdc++ mailing list