RFC-0193: Supported C++ Versions

RFC-0193: Supported C++ Versions
StatusAccepted
Areas
  • Build
  • Developer
  • Toolchain
Description

Drop C++14 support from the SDK and clarify how support for C++ versions will be decided and supported in the future.

Gerrit change
Authors
Reviewers
Date submitted (year-month-day)2022-07-29
Date reviewed (year-month-day)2022-10-03

Summary

Drop C++14 support from the SDK and clarify how support for C++ versions will be decided and supported in the future.

Motivation

The C++ SDK currently claims to support C++14 but there aren't effective tests in the Fuchsia tree to prevent C++14 incompatible code from making its way into the SDK. This breaks users and results in roll-backs.

The Fuchsia tree is built with C++17. Many libraries and frameworks in the Fuchsia tree that would be useful for out of tree developers depend on C++17 features. In particular the new FIDL C++ bindings require C++17.

There are no longer any users of the SDK that compile as C++14 so changing the supported version is just a matter of changing the documentation.

Stakeholders

Facilitator: cpu@google.com

Reviewers: johngro@google.com, dschuyler@google.com, abarth@google.com

Consulted: yifeit@google.com, sebmarchand@google.com, phosek@google.com, eieio@google.com, schottm@google.com, jamesr@google.com, gevalentino@google.com, jyknight@google.com

Design

Terminology

A C++ version refers to a revision of the ISO C++ standard. We refer to it by short-hand like C++14, C++17, C++20, etc.

The SDK C++ versions is a list of C++ versions that are documented to be supported by the Fuchsia SDK and are used by the build systems shipped as part of the SDK. That list currently includes C++14 and C++17.

Dropping C++14

The SDK documentation and C++ in Zircon SHALL be updated to reflect that C++14 is no longer supported.

Fuchsia Tree C++ Version

The C++ version used to compile most code that runs on Fuchsia in the Fuchsia tree MUST be an SDK C++ version. Other C++ versions MAY be used in the Fuchsia tree for small, isolated codebases or for host-only code, but this is discouraged.

C++ Version Testing

A core set of tests MUST be built and run for every SDK C++ version as part of the Fuchsia commit queue. This set of tests includes all C++ tests in the CTS and API tests for C++ FIDL bindings, but may include more.

Adding C++ Versions

A new SDK C++ version may be added by writing an RFC to propse that addition and having it approved.

Only C++ versions that are published by the ISO C++ committee may be added to the C++ versions.

As part of adding an SDK C++ version the Fuchsia build MUST be updated to build and run the C++ tests identified above with the added C++ version.

Removing C++ Versions

_SDK C++ version_s may be removed by writing an RFC to propose that removal and having it approved.

When removing an SDK C++ version it MUST be removed from the SDK documentation and SHOULD be removed from the Fuchsia build system.

Implementation

Dropping C++14

This is just a documentation change.

C++ Version Testing

After C++14 is dropped C++17 will be the only SDK C++ version. Tests are already built and run with C++17.

Before another version can be added the Fuchsia build system will need to be updated to allow tests to be built and run with multiple C++ versions.

Performance

N/A

Ergonomics

It will be much easier to update C++ code that is shipped in the SDK because every change will be tested against every supported C++ version.

Backwards Compatibility

All current (in October 2022) Fuchsia users build with C++17 so there are no backwards compatibility issues.

Security considerations

N/A

Privacy considerations

N/A

Testing

See above.

Documentation

The SDK documentation and C++ in Zircon will be updated to reflect that C++14 is no longer supported.

This RFC serves as the documentation for the policy for adding and removing C++ versions in the future.

Drawbacks, alternatives, and unknowns

Prior art and references