D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 13747 - Linux CMSG_NXTHDR is private, since alias doesn't change protection level
Summary: Linux CMSG_NXTHDR is private, since alias doesn't change protection level
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-18 19:17 UTC by Paul O'Neil
Modified: 2014-12-12 10:25 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Paul O'Neil 2014-11-18 19:17:40 UTC
CMSG_NXTHDR on Linux is defined as a macro wrapping the __csmg_nxthdr function.

The translation to D in core.sys.posix.sys.socket.d has an extern __cmsg_nxthdr() function, which is private.  This is "exposed" using an alias, CMSG_NXTHDR.  But since the alias doesn't change the protection, so CMSG_NXTHDR is not usable.

I'm putting together a pull request for a bunch of CMSG changes & fixes, but I don't know what the right way to fix this part is.
Comment 1 Paul O'Neil 2014-11-21 20:16:01 UTC
Proposed fix inlcluded in https://github.com/D-Programming-Language/druntime/pull/1034
Comment 2 Paul O'Neil 2014-12-10 20:30:35 UTC
Per Martin's comments (https://github.com/D-Programming-Language/druntime/pull/1034), this is a compiler bug, not a problem with the code as originally written in druntime.

private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
alias __cmsg_nxthdr CMSG_NXTHDR;

CMSG_NXTHDR should have default protection instead of private.

In the meantime, PR 1034 has been merged; it uses a one-line function for CMSG_NXTHDR instead of an alias.
Comment 3 Martin Nowak 2014-12-12 10:25:31 UTC
Thanks