native type issues
Submitted by David Zeuthen
Link to original bug (#584517)
Description
So I have this typedef in one of my projects
/**
* GUdevDeviceNumber:
*
* Corresponds to the standard #dev_t type as defined by POSIX.
*/
typedef dev_t GUdevDeviceNumber;
which gives me
<alias name="DeviceNumber" target="dev_t" c:type="GUdevDeviceNumber"/>
in the GIR file.
Of course, this is not very useful for e.g. seed or gjs, they simply don't understand what dev_t is. And I'd argue they shouldn't have to know.
Wouldn't it be better if g-ir-scanner resolved 'dev_t' to 'int' at scan time?
The easy fix is to do
typedef int GUdevDeviceNumber;
but that's not really a solution since dev_t, as specified by POSIX, can be any arithmetic type (e.g. int16_t, int32_t, whatever) and the decomposition into major:minor (and even existance of major:minor) is platform specific (e.g. can different on Linux and Solaris and why makedev(3) isn't specified by POSIX).
Maybe it's just easier to teach g-ir-scanner about such POSIX types and then alias them to the right int... there's not a lot of them (other types include pid_t etc.).
Thoughts?