All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick Williams <patrick@stwcx.xyz>
To: OpenBMC List <openbmc@lists.ozlabs.org>
Subject: Time for C++20.
Date: Wed, 14 Apr 2021 15:11:56 -0500	[thread overview]
Message-ID: <YHdMjAsKKA+BKW8X@heinlein> (raw)

[-- Attachment #1: Type: text/plain, Size: 1910 bytes --]

Hello.

Per [1], as a project we've generally committed to using the latest C++
standard.  C++20 was released in early Sept. 2020 and already had pretty
decent compiler support at the time it was released.  We're currently
using GCC10 and according to [2] it has support for nearly every C++20
feature I could see us regularly wanting to use(*).  It seems like it
is a reasonable time for us to move on to it.

* - Except I recall seeing some mention of std::source_location being
    useful to fix some of the issues with phosphor-logging, but that
    won't be available until GCC11.

In general the C++ standard is backwards compatible.  This shouldn't
have any impact if you are writing C++17-only code.  What it allows us
to do is to start using features out of C++20 like the spaceship
operator and ranges.

I've put up some commits to start this process.  So far the only hiccup
I've ran into is that you need Meson 0.57.0 or higher in order for it to
recognize the 'cpp_std=c++20' option.  I am adding code to our unit-test
framework to ensure you have this specified in your `meson.build` if you
are requesting C++20.

    - https://gerrit.openbmc-project.xyz/c/openbmc/openbmc-build-scripts/+/42252
        * Adds some checking to ensure you've specified a meson_version
          in your meson.build that can handle C++20.

    - https://gerrit.openbmc-project.xyz/c/openbmc/docs/+/42255
        * Update C++ style doc from C++17 to C++20.

    - https://gerrit.openbmc-project.xyz/c/openbmc/sdbusplus/+/42256
        * Update sdbusplus to use C++20.

Please let me know if you have any concerns with this upgrade; I'll be
surprised if this not a fairly low-contention move.

1. https://github.com/openbmc/docs/blob/master/cpp-style-and-conventions.md#code-should-be-written-with-modern-practices
2. https://en.cppreference.com/w/cpp/20
-- 
Patrick Williams

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2021-04-14 20:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-14 20:11 Patrick Williams [this message]
2021-04-14 21:12 ` Time for C++20 Bills, Jason M
2021-04-14 23:13   ` Vernon Mauery
2021-04-15 18:05     ` Patrick Williams
2021-05-17 15:18 ` Bills, Jason M
2021-05-17 18:46   ` William Kennington

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YHdMjAsKKA+BKW8X@heinlein \
    --to=patrick@stwcx.xyz \
    --cc=openbmc@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.