Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build a C++ test program (cpp_dummy_build) in most tested configurations #8331

Open
gilles-peskine-arm opened this issue Oct 9, 2023 · 0 comments
Labels
component-test Test framework and CI scripts enhancement size-s Estimated task size: small (~2d)

Comments

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Oct 9, 2023

We want our public headers to work in C++. For the most part, this means our headers should contain balanced extern { … } blocks. It also means public headers must refrain from things that don't work in C++, such as using new as a variable name, using forward-defined structures as a return type, etc.

Our testing is currently limited to one program (cpp_dummy_build) that just includes all headers, which we build in the full configuration with Clang in non-pedantic mode. The goal of this task is to extend the build of cpp_dummy_build to most all.sh components.

  • Create a header file that includes all the public headers. Location and method TBD. The most obvious thing is that this should be a generated file. However, having a header file that's generated adds additional complexity to the build scripts; currently we don't have any. Since we don't often add public headers, it may be better to let this file be maintained manually; but if we do that, we should keep a script that checks its content.
    • Note that “all the public headers” must exclude a few headers that can't be excluded independently. As of 3.5.0, this means headers matching /[-_.\/]config[-_.]/ (i.e. containing config as a word). Some psa/crypto_*.h such as psa/crypto_values.h are not meant to be included independently, but they do work as of 3.5.0, so they don't need to be excluded.
  • Change cpp_dummy_build.cpp to be a committed file that includes all_headers.h.
  • Arrange for make and cmake to automatically build cpp_dummy_build.cpp if a C++ compiler is available. Use pedantic flags as much as possible (but not pedantic flags that break the build — that would be a separate issue, such as Unable to build simple c++ example with Visual Studio 15 2017 #7087 or the use of a flexible array member).

Out of scope:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-test Test framework and CI scripts enhancement size-s Estimated task size: small (~2d)
Projects
Status: No status
Development

No branches or pull requests

1 participant