tpm2-tss
tpm2-tss copied to clipboard
Unnecessary includes
Many files in FAPI include <dirent.h>
and <poll.h>
(and probably other headers) unnecessarily:
akuli@akuli-desktop:/tmp/tpm2-tss/src/tss2-fapi$ git grep -E '#include <(dirent|poll)'
api/Fapi_List.c:#include <dirent.h>
fapi_int.h:#include <poll.h>
fapi_util.c:#include <dirent.h>
ifapi_helpers.c:#include <dirent.h>
ifapi_io.c:#include <poll.h>
ifapi_io.c:#include <dirent.h>
ifapi_keystore.c:#include <dirent.h>
ifapi_policy_store.c:#include <dirent.h>
If I comment out all except the ones in ifapi_io.c
, FAPI still compiles, because other files call wrapper functions defined in ifapi_io.c
.
For context, I now have two blank files named dirent.h
and poll.h
just to satisfy the unnecessary includes on a system that doesn't provide <dirent.h>
and <poll.h>
. I already have a custom implementation of ifapi_io.c
, so the two dummy files would be unnecessary if includes were cleaned up.
This isn't really a big deal to me though. Feel free to close if you don't care :)
Good point. Thanks for pointing that out :)
@JuergenReppSIT we might want to consider compiling with include-what-you-use in our ci to ensure include correctness. I might have a look at this once I'm available again.
@JuergenReppSIT we might want to consider compiling with include-what-you-use in our ci to ensure include correctness. I might have a look at this once I'm available again.
Yes that's a good idea.