After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763227 - [PATCH] Linux.Network.IfFlag enum produces C compiler error
[PATCH] Linux.Network.IfFlag enum produces C compiler error
Status: RESOLVED FIXED
Product: vala
Classification: Core
Component: Bindings
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks:
 
 
Reported: 2016-03-07 13:09 UTC by Al Thomas
Modified: 2016-03-08 15:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Resolves C compiler error when using Linux.Network.IfFlags (841 bytes, patch)
2016-03-07 13:10 UTC, Al Thomas
none Details | Review
Patch to include <sys/socket.h> when using <linux/if.h> (2.50 KB, patch)
2016-03-07 16:36 UTC, Al Thomas
committed Details | Review

Description Al Thomas 2016-03-07 13:09:55 UTC
The following code:

// valac linux-test.vala --pkg linux
public static void main() {
  var flags = Linux.Network.IfFlag.UP;
}

produces the following C compiler errors:

/usr/include/linux/if.h:211:19: error: field ‘ifru_addr’ has incomplete type
   struct sockaddr ifru_addr;
                   ^
/usr/include/linux/if.h:212:19: error: field ‘ifru_dstaddr’ has incomplete type
   struct sockaddr ifru_dstaddr;
                   ^
/usr/include/linux/if.h:213:19: error: field ‘ifru_broadaddr’ has incomplete type
   struct sockaddr ifru_broadaddr;
                   ^
/usr/include/linux/if.h:214:19: error: field ‘ifru_netmask’ has incomplete type
   struct sockaddr ifru_netmask;
                   ^
/usr/include/linux/if.h:215:20: error: field ‘ifru_hwaddr’ has incomplete type
   struct  sockaddr ifru_hwaddr;
                    ^
error: cc exited with status 256
Compilation failed: 1 error(s), 1 warning(s)


Changing the binding to use <net/if.h> instead of <linux/if.h> resolves this.
Comment 1 Al Thomas 2016-03-07 13:10:59 UTC
Created attachment 323268 [details] [review]
Resolves C compiler error when using Linux.Network.IfFlags
Comment 2 Maciek Borzecki 2016-03-07 13:19:03 UTC
Looks good to me.
Comment 3 Al Thomas 2016-03-07 16:36:57 UTC
Created attachment 323295 [details] [review]
Patch to include <sys/socket.h> when using <linux/if.h>

Updated patch.

<linux/if.h> includes <linux/socket.h>.
<linux/socket.h> relies on the definition of the sockaddr type to be in <sys/socket.h>
For example see: https://lkml.org/lkml/2015/3/10/850

This patch resolves that dependency in the Vala binding.
Comment 4 Rico Tzschichholz 2016-03-08 15:44:11 UTC
Review of attachment 323295 [details] [review]:

Looks good