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

add_project_dependencies() ignores 'preserve' include_type property #13858

Open
artem opened this issue Nov 2, 2024 · 4 comments · May be fixed by #13861
Open

add_project_dependencies() ignores 'preserve' include_type property #13858

artem opened this issue Nov 2, 2024 · 4 comments · May be fixed by #13861

Comments

@artem
Copy link

artem commented Nov 2, 2024

Describe the bug
If the dependency passed to add_project_dependencies has 'preserve' include_type property (default), Meson downgrades it to 'non-system'

To Reproduce

add_project_dependencies(
  declare_dependency(
    include_directories: include_directories('third_party/my_3p_dep', is_system: true),
  )
)

Related code: https://github.com/mesonbuild/meson/blob/6736a54/mesonbuild/interpreter/interpreter.py#L2961-L2966

Expected behavior
Meson produces -isystemthird_party/my_3p_dep cmdline argument instead of -Ithird_party/my_3p_dep

system parameters

  • Meson 1.5.1
@eli-schwartz
Copy link
Member

This is your daily reminder that -isystem is a flag for controlling the #include_next priority ordering etc. and only makes sense to use when you are implementing a libc or something along those lines -- "my_3p_dep" seems like a very bad and off-target thing to be using this for?

@artem
Copy link
Author

artem commented Nov 3, 2024

only makes sense to use when you are implementing a libc

Actually not. -isystem is the only viable way to silence warnings coming from 3rd party headers. Silencing them in entire project is not an option, and fixing them is problematic, since you do not own the code you want to use. A real pain with C++ header-only libraries, I would say.

Anyway, it's an off-topic discussion that does not belittle the importance of this issue.

@eli-schwartz
Copy link
Member

eli-schwartz commented Nov 3, 2024

only makes sense to use when you are implementing a libc

Actually not. -isystem is the only viable way to silence warnings coming from 3rd party headers. Silencing warnings is not an option, and fixing them is problematic, since you do not own the code you want to use.

It is literally not documented to silence warnings, even as a side effect of the thing it is actually documented to do. You have no guarantee that it will or won't do any such thing.

In return for this, you break the C++ compilation model.

Anyway, it's an off-topic discussion that does not belittle the importance of this issue.

If there is no real world use case of this "feature" then that affects whether people are interested in working on it.

Patches welcome, I guess.

@artem
Copy link
Author

artem commented Nov 3, 2024

It is literally not documented to silence warnings

I think, the documentation says for itself: https://gcc.gnu.org/onlinedocs/cpp/System-Headers.html

All warnings, other than those generated by ‘#warning’ (see Diagnostics), are suppressed while GCC is processing a system header.

In return for this, you break the C++ compilation model.

I have a problem understanding what compilation model you are referring to. Could you please elaborate for the sake of completeness of the discussion?

Patches welcome, I guess

If this is an acknowledgment of the bug, I am happy to prepare the patches.

artem added a commit to artem/meson that referenced this issue Nov 3, 2024
artem added a commit to artem/meson that referenced this issue Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants