Author serhiy.storchaka
Recipients serhiy.storchaka
Date 2017-11-02.16:15:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509639322.53.0.213398074469.issue31927@psf.upfronthosting.co.za>
In-reply-to
Content
NetBSD 8 adds support of AF_CAN (previously it was supported only on Linux). This causes a compilation error in socketmodule.c, because AF_CAN is defined in sys/socket.h, but sys/socket.h itself doesn't contain all necessary definitions for handling AF_CAN addresses. This also exposed other errors. The braces are not balanced if AF_CAN is defined, but CAN_RAW and CAN_BCM are not. PyBytes_AS_STRING() is called for non-bytes.

The proposed patch balances #ifdef/#endif with braces, undefines AF_CAN if it is not usable (following the practice for other AF_* constants), separates support of CAN_RAW and CAN_BCM (only the former is defined on NetBSD 8), adds comments to #endif for helping with navigation, adds the const qualifier to char pointers that always point to constant data, fixes indentation.

This fixed a compilation on NetBSD 8, and I hope this will fix a compilation on other platforms that will add AF_CAN. In a separate issue I'll add a support of AF_CAN on NetBSD (in 3.7 only).
History
Date User Action Args
2017-11-02 16:15:22serhiy.storchakasetrecipients: + serhiy.storchaka
2017-11-02 16:15:22serhiy.storchakasetmessageid: <1509639322.53.0.213398074469.issue31927@psf.upfronthosting.co.za>
2017-11-02 16:15:22serhiy.storchakalinkissue31927 messages
2017-11-02 16:15:22serhiy.storchakacreate