-
Notifications
You must be signed in to change notification settings - Fork 318
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
iio.h: Include iio/types.h when it exists #763
iio.h: Include iio/types.h when it exists #763
Conversation
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.
Just one minor comment from side... Alternatively to this we could just think about syncing the current iio uapi within libiio on every stable release . Some other projects (eg: libiouring) apparently do the same... However I'm not sure how practical that is given some potential customs things we have. @pcercuei might have a better idea for this issue
iio.h
Outdated
@@ -84,6 +84,12 @@ struct iio_context_info; | |||
struct iio_scan_context; | |||
struct iio_scan_block; | |||
|
|||
#define IIO_CHAN_TYPE_UNKNOWN INT_MAX | |||
|
|||
#if __has_include(<linux/iio/types.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.
Hmm, according to this, the right way of doing this is to first test for the existence of the macro... I'm not sure this will actually build when the compiler does not support __has_include
don't we just want to do a:
this would resolve things, but only if you included kernel headers before iio.h |
@rgetz it's not a macro, though. @gwendalcr please wrap the |
enum iio_chan_type and iio_modifier are already defined in /usr/include/linux/iio/types.h on linux systems. If an application needs to include both (to support iio events for instance), compiler will complains these enums are defined twice. This patch is not without problem: - linux system must have latest kernel-headers installed: IIO_MOD_O2 modifier has been added to linux 5.9 kernel. Alter CI/travis/check_kernel.sh accordingly, check it still passes. Fixes analogdevicesinc#758. Signed-off-by: Gwendal Grignou <[email protected]>
3b531ab
to
dfc613c
Compare
I really don't like this patch, it is an ugly band aid:
In another project, to fill |
What about we sync to the latest uapi header now, then protect libiio's copy with the kernel header's |
@gwendalcr could you try 5fc7550? |
5fc7550 is a better patch. |
enum iio_chan_type and iio_modifier are already defined in
/usr/include/linux/iio/types.h on linux systems.
If an application needs to include both (to support iio events for
instance), compiler will complains these enums are defined twice.
This patch is not without problem:
IIO_MOD_O2 modifier has been added to linux 5.9 kernel.
Alter CI/travis/check_kernel.sh accordingly, check it still passes.
Fixes #758.
Signed-off-by: Gwendal Grignou [email protected]