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

Use stricter flags for native toolchain #3100

Open
celskeggs opened this issue Jan 2, 2025 · 2 comments
Open

Use stricter flags for native toolchain #3100

celskeggs opened this issue Jan 2, 2025 · 2 comments

Comments

@celskeggs
Copy link
Contributor

F´ Version v3.5.1
Affected Component build system

Feature Description

The native toolchain uses lax compiler options defaults. I suggest defaulting to the following options:

    -std=c++14
    -pedantic
    -Wextra
    -Werror
    -Wold-style-cast
    -ggdb3

Rationale

The JPL Institutional C++ Coding Standard mandates the use of C++ 14 with "all compiler warnings enabled at the highest warning level available, with no errors or warnings resulting." The native toolchain currently defaults to -std=c++11 without -Werror, which means that flight projects need to provide their own UT toolchain configuration in order to comply with the standard. It would be sensible for F Prime to provide a default toolchain configuration that is already compliant with institutional standards to make things easier for flight projects, especially since it results in higher-quality code.

I also recommend the use of -ggdb3 to provide higher-quality debugging information than the current -g.

@astroesteban
Copy link
Contributor

To add to this great suggestion, the Open-Source Security Foundation (OpenSSF) has a compiler options hardening guide that would be useful to reference for core product security as well:
https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++.html

There is also a CMake example someone put together:
https://www.stevenengelhardt.com/2024/11/12/cmake-implementation-of-openssf-compiler-hardening-options/

@LeStarch
Copy link
Collaborator

We need to do the following:

  1. Add in default set of flags that F´ supplies
  2. Reporting for which flags are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants