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

Improve path names of config headers #2640

Open
bocchino opened this issue Mar 28, 2024 · 0 comments
Open

Improve path names of config headers #2640

bocchino opened this issue Mar 28, 2024 · 0 comments

Comments

@bocchino
Copy link
Collaborator

@LeStarch and I have discussed the following issue with the path names of header files included from config:

  • In a typical project, many headers in config exist in two versions: the default one in [fprime root]/config and the project-specific one in [project-root]/config.
  • The build system includes only one of [fprime root]/config and [project root]/config in the list of include header paths. The idea is that for any header H.hpp, only one of [fprime root]/config/H.hpp and [project root]/config/H.hpp is included, and this choice is made consistently everywhere.
  • However, if one writes #include "config/H.hpp", then there is a danger that the wrong header will be picked up, because [fprime root] and [project root] are both in the list of include paths.
  • The current approach is to write #include <H.hpp> when H.hpp is a manually written file (so that there's a corresponding version in [fprime root]/config). For example, we write #include <FpConfig.hpp> and not #include "config/FpConfig.hpp". However, (1) this approach is brittle, because the compiler cannot enforce it; and (2) for auto-generated files like FppConstantsAc.hpp we need to write #include "config/FppConstantsAc.hpp" to distinguish files in located in config from files located elsewhere.

A better solution would be to allow and require the spelling #include "config/H.hpp" everywhere, and have the build system ensure that this spelling specifies an unambiguous location. We could do this by putting config in another directory, and having the build system place that directory, instead of config, in the list of include paths.

Here is the suggestion from @LeStarch:

I would suggest for F´:
default/config/….headers…

I would suggest for projects:
project/config/….headers…

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

1 participant