fileio_types.h : avoid dependency on mem.h #3232
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fileio_types.h
cannot be parsed by itselfbecause it relies on basic types defined in
lib/common/mem.h
.As for #3231, it likely wasn't detected because
mem.h
was probably included beforefileio_types.h
in target files.An "easy" solution would be to just add the missing include,
but each
#include
dependency must be considered "bad" by default,and only allowed if it brings some tangible value.
In this case, since these types are only used to declare internal structure variables
which are effectively only flags,
I believe it's not valuable to add a dependency on
mem.h
for this purposewhile the standard
int
type can do the same job.I was expecting some compiler warnings following this change,
but it turns out we don't use
-Wconversion
by default onzstd
source code,so there is none.
Nevertheless, I enabled
-Wconversion
locally and proceeded to fix a few conversion warnings in the process.Sidenote:
Adding
-Wconversion
to the list of flags used forzstd
is something I would be favorable over the long term,but it cannot be done overnight,
because the nb of places where this warning is triggered is daunting.
Better progressively reduce the nb of triggered
-Wconversion
warnings before enabling this flag by default.