[Development] <version> (was: Re: C++20 @ Qt)

Marc Mutz marc.mutz at qt.io
Thu Nov 10 09:25:38 CET 2022


Hi,

Given that Integrity seems to be the only tool-chain missing <version> 
in dev, I propose the following policy going forward:

 > To detect post-C++17 library features, we require that <version> exists.

That means that if <version> does not exist, we will not detect 
post-C++17 library features on that platform, even if they should exist.

Practically, this means that qglobal.h (or one if it's offspring) would 
contain

   #if __has_include(<version>)
   #  include <version>
   #

unconditionally and we will detect post-C++17 library features only this 
way, going forward:

   #ifdef __cpp_lib_foo
   # include <foo>
   #endif

and no longer this way:

   #if __has_include(<foo>) && __cplusplus > 201703L
   #  include <foo>
   #endif

To not break existing uses, however, existing checks that do the 
__has_include dance should not be cleaned up before we require the resp. 
library feature unconditionally.

What do you think?

Thanks,
Marc

On 06.11.22 19:58, Marc Mutz via Development wrote:
> Hi all,
> 
> [https://bugreports.qt.io/browse/QTBUG-108228 for details]
> 
> After looking at libc++, libstdc++ and MS STL's <version>, it seemed
> like it wouldn't #error out if #included in a C++17 project. So I've
> kicked off a precheck on Gerrit, and so far, it looks like Integrity is
> the only tool-chain that doesn't have a <version> header, yet:
> 
>     https://codereview.qt-project.org/c/qt/qtbase/+/441821
> 
> On other tool-chains, it appears to be usable in C++17 builds, too.
> 
> I'll ask our Integrity experts to find out whether there are any plans
> by GHS to add this header before their next major release, or as a
> patch that Qt users could apply to their installation.
> 
> Thanks,
> Marc
> 
-- 
Marc Mutz <marc.mutz at qt.io>
Principal Software Engineer

The Qt Company
Erich-Thilo-Str. 10 12489
Berlin, Germany
www.qt.io

Geschäftsführer: Mika Pälsi, Juha Varelius, Jouni Lintunen
Sitz der Gesellschaft: Berlin,
Registergericht: Amtsgericht Charlottenburg,
HRB 144331 B



More information about the Development mailing list