-
Notifications
You must be signed in to change notification settings - Fork 221
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 missing includes and add simple test for includes in public headers #570
Conversation
Hi! Thanks for this PR. We have added some fixes in the most recent release. We did a quick test and segyio build fine on Fedora. Do you think that your PR is still needed? |
I can confirm that the issue persist. I could reproduce it on Red Hat Linux 8. I will push some fixups and then try to get it merged soon. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apply fixups/amends and let get this merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice! Rebase and merge.
7878718
to
92e2404
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I compiled and built it on Redhat 8.1. For some reason it still builds and passes tests with and without "#include ".
No other comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine with me, though I still suspect this new test won't catch all cases (the problem seems to be not trivial) and would give us false sense of security.
Could be worth updating commit message a bit, if you agree.
That the tests sometimes pass without includes seems to be due to the used compilers and their standard libraries. Newer versions of GCC (I tested 13) seem to complain about missing |
- `algorithm` must be included because the header uses functions like `copy_n`. - `cstdint` must be included explicitly on Fedora-based Linux distribtuions, like Red Hat Enterprise Linux 8, to make all the used integer types available. - `stdexcept` must be included for definition of exceptions such as `runtime_error`.
These tests try to check whether the inclusion of segyio headers that are part of segyio's public interface prevent other projects from compiling. We had cases in which our public facing C and C++ headers did not define all required includes. This could lead to failures depending on the compiler and what other includes were and in which order when a segyio header was included. Testing for the correct headers to be included appears to be non-trivial and it is not 100% clear if this test is sufficiently accurate to prevent further problems in the future. At least the test tries to approximate how segyio's C/C++ interfaces are included in other projects such as the the si4ti project [1] that uses the C++ interface. If our tests is too simple, we could also try a tool like "include-what-you-use" [2]. If our test does not provide sufficient value, we can remove it again in the future. Note, the added test should fail at compile time if anything is wrong with the includes. [1]: https://github.com/equinor/si4ti [2]: https://github.com/include-what-you-use/include-what-you-use
f5e4ade
to
c35e43d
Compare
No description provided.