-
Notifications
You must be signed in to change notification settings - Fork 475
library interfaces: remove dependency on config.h #6274
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
base: master
Are you sure you want to change the base?
Conversation
We need to be able to compile with libboinc and libboinc_api without needing config.h. To do this: avoid having .h files include other .h files (in particular, avoid chains of includes that lead to str_replace.h, which is what needs config.h).
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.
Pull Request Overview
This PR removes unnecessary dependencies on config.h by reducing header interdependencies and replacing includes with forward declarations where possible.
- Updated test files to include missing headers for error numbers and parsing.
- Replaced direct inclusion of specific headers in library files with forward declarations.
- Modified MIOFILE from a class to a struct in header files to avoid including config.h unnecessarily.
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/unit-tests/lib/test_str_util.cpp | Added include for error_numbers.h to support testing functionality |
tests/unit-tests/lib/test_parse.cpp | Added include for parse.h to support testing functionality |
lib/win_util.cpp | Added include for error_numbers.h to resolve dependency |
lib/util.cpp | Added include for str_replace.h in implementation file |
lib/str_util.h | Removed include of str_replace.h to break dependency chain |
lib/proxy_info.h | Replaced a class declaration with a forward declaration for MIOFILE |
lib/opencl_boinc.h | Replaced header includes with forward declarations to eliminate dependency chains |
lib/miofile.h | Changed MIOFILE from a class to a struct to simplify interface declarations |
lib/coproc.h | Removed parse.h include while adding forward declarations |
lib/common_defs.h | Replaced includes with forward declarations to reduce dependency on config.h |
lib/app_ipc.cpp | Added include for str_replace.h as needed in the implementation |
client/hostinfo_linux.cpp | Adjusted include order to support new dependencies |
client/client_msgs.h | Updated function signature by removing redundant 'class' keyword |
Comments suppressed due to low confidence (2)
lib/miofile.h:42
- Changing MIOFILE from a class to a struct alters the default access level for its members; please confirm that all member variables and functions are intended to be public.
-class MIOFILE {
client/client_msgs.h:47
- [nitpick] Removing the redundant 'class' keyword in the function parameter improves clarity; please ensure the corresponding implementation is updated accordingly.
void write(int seqno, class MIOFILE&, bool translatable);
I keep this open for a while to make a full test with building |
BTW, the test is: compile an app that uses libboinc_api and libboinc |
That's similar to what I plan to do, with the only different that in my case I want to have these builds separated, and the app should not have physical access to the 'config.h' file to be sure that there is no other hidden place. |
We need to be able to compile with libboinc and libboinc_api without needing config.h.
To do this: avoid having .h files include other .h files
(in particular, avoid chains of includes that lead to str_replace.h,
which is what needs config.h).
Fixes #6271