diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-11-02 13:24:07 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2023-11-02 14:54:13 +0100 |
commit | 04802ed3b94bdc3083547ac08bca71764a004d01 (patch) | |
tree | 2d492f8013b9bdb4af409c973fdd3990ab34dd31 /libphobos | |
parent | 8a4cde6319b40802a842a8fe71267524dd8af828 (diff) | |
download | gcc-04802ed3b94bdc3083547ac08bca71764a004d01.zip gcc-04802ed3b94bdc3083547ac08bca71764a004d01.tar.gz gcc-04802ed3b94bdc3083547ac08bca71764a004d01.tar.bz2 |
d: Merge upstream dmd, druntime 643b1261bb, phobos 1c98326e7
D front-end changes:
- Suggested preview switches now give gdc flags (PR109681).
- `new S[10]' is now lowered to `_d_newarrayT!S(10)'.
D runtime changes:
- Runtime compiler library functions `_d_newarrayU', `_d_newarrayT',
`_d_newarrayiT' have been converted to templates.
Phobos changes:
- Add new `std.traits.Unshared' template.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 643b1261bb.
* d-attribs.cc (build_attributes): Update for new front-end interface.
* d-lang.cc (d_post_options): Likewise.
* decl.cc (layout_class_initializer): Likewise.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 643b1261bb.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES_FREEBSD): Add
core/sys/freebsd/ifaddrs.d, core/sys/freebsd/net/if_dl.d,
core/sys/freebsd/sys/socket.d, core/sys/freebsd/sys/types.d.
(DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/linux/if_arp.d,
core/sys/linux/linux/if_packet.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 1c98326e7.
Diffstat (limited to 'libphobos')
-rw-r--r-- | libphobos/libdruntime/MERGE | 2 | ||||
-rw-r--r-- | libphobos/libdruntime/Makefile.am | 7 | ||||
-rw-r--r-- | libphobos/libdruntime/Makefile.in | 34 | ||||
-rw-r--r-- | libphobos/libdruntime/core/sys/linux/linux/if_arp.d | 136 | ||||
-rw-r--r-- | libphobos/libdruntime/core/sys/linux/linux/if_packet.d | 315 | ||||
-rw-r--r-- | libphobos/src/MERGE | 2 | ||||
-rw-r--r-- | libphobos/src/std/parallelism.d | 4 | ||||
-rw-r--r-- | libphobos/src/std/range/primitives.d | 17 | ||||
-rw-r--r-- | libphobos/src/std/traits.d | 41 |
9 files changed, 542 insertions, 16 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 2a0baf0..235db4b 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -e48bc0987dfec35bc76a3015ee3e85906ce86dfd +643b1261bba0757d97efa3ff1f63e461271eb000 The first line of this file holds the git revision number of the last merge done from the dlang/dmd repository. diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am index f57c640..23205fd 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -261,7 +261,8 @@ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ - core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ + core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \ + core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \ core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ @@ -269,7 +270,8 @@ DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ - core/sys/freebsd/sys/sysctl.d core/sys/freebsd/time.d \ + core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \ + core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \ core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ @@ -278,6 +280,7 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/fcntl.d core/sys/linux/fs.d core/sys/linux/ifaddrs.d \ core/sys/linux/input.d core/sys/linux/input_event_codes.d \ core/sys/linux/io_uring.d core/sys/linux/link.d \ + core/sys/linux/linux/if_arp.d core/sys/linux/linux/if_packet.d \ core/sys/linux/netinet/in_.d core/sys/linux/netinet/tcp.d \ core/sys/linux/perf_event.d core/sys/linux/sched.d \ core/sys/linux/stdio.d core/sys/linux/string.d \ diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index 363a4a0..410245d 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -327,6 +327,7 @@ am__objects_11 = core/sys/bionic/err.lo core/sys/bionic/fcntl.lo \ @DRUNTIME_OS_ANDROID_TRUE@am__objects_12 = $(am__objects_11) am__objects_13 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \ core/sys/freebsd/err.lo core/sys/freebsd/execinfo.lo \ + core/sys/freebsd/ifaddrs.lo core/sys/freebsd/net/if_dl.lo \ core/sys/freebsd/netinet/in_.lo core/sys/freebsd/pthread_np.lo \ core/sys/freebsd/stdlib.lo core/sys/freebsd/string.lo \ core/sys/freebsd/sys/_bitset.lo \ @@ -336,7 +337,8 @@ am__objects_13 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \ core/sys/freebsd/sys/elf_common.lo \ core/sys/freebsd/sys/event.lo core/sys/freebsd/sys/link_elf.lo \ core/sys/freebsd/sys/mman.lo core/sys/freebsd/sys/mount.lo \ - core/sys/freebsd/sys/sysctl.lo core/sys/freebsd/time.lo \ + core/sys/freebsd/sys/socket.lo core/sys/freebsd/sys/sysctl.lo \ + core/sys/freebsd/sys/types.lo core/sys/freebsd/time.lo \ core/sys/freebsd/unistd.lo @DRUNTIME_OS_FREEBSD_TRUE@am__objects_14 = $(am__objects_13) am__objects_15 = core/sys/netbsd/dlfcn.lo core/sys/netbsd/err.lo \ @@ -366,6 +368,8 @@ am__objects_19 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \ core/sys/linux/fs.lo core/sys/linux/ifaddrs.lo \ core/sys/linux/input.lo core/sys/linux/input_event_codes.lo \ core/sys/linux/io_uring.lo core/sys/linux/link.lo \ + core/sys/linux/linux/if_arp.lo \ + core/sys/linux/linux/if_packet.lo \ core/sys/linux/netinet/in_.lo core/sys/linux/netinet/tcp.lo \ core/sys/linux/perf_event.lo core/sys/linux/sched.lo \ core/sys/linux/stdio.lo core/sys/linux/string.lo \ @@ -931,7 +935,8 @@ DRUNTIME_DSOURCES_DRAGONFLYBSD = core/sys/dragonflybsd/dlfcn.d \ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ - core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \ + core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \ + core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \ core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ @@ -939,7 +944,8 @@ DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ - core/sys/freebsd/sys/sysctl.d core/sys/freebsd/time.d \ + core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \ + core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \ core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ @@ -948,6 +954,7 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/fcntl.d core/sys/linux/fs.d core/sys/linux/ifaddrs.d \ core/sys/linux/input.d core/sys/linux/input_event_codes.d \ core/sys/linux/io_uring.d core/sys/linux/link.d \ + core/sys/linux/linux/if_arp.d core/sys/linux/linux/if_packet.d \ core/sys/linux/netinet/in_.d core/sys/linux/netinet/tcp.d \ core/sys/linux/perf_event.d core/sys/linux/sched.d \ core/sys/linux/stdio.d core/sys/linux/string.d \ @@ -1593,6 +1600,11 @@ core/sys/freebsd/config.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/dlfcn.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/err.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/execinfo.lo: core/sys/freebsd/$(am__dirstamp) +core/sys/freebsd/ifaddrs.lo: core/sys/freebsd/$(am__dirstamp) +core/sys/freebsd/net/$(am__dirstamp): + @$(MKDIR_P) core/sys/freebsd/net + @: > core/sys/freebsd/net/$(am__dirstamp) +core/sys/freebsd/net/if_dl.lo: core/sys/freebsd/net/$(am__dirstamp) core/sys/freebsd/netinet/$(am__dirstamp): @$(MKDIR_P) core/sys/freebsd/netinet @: > core/sys/freebsd/netinet/$(am__dirstamp) @@ -1617,7 +1629,9 @@ core/sys/freebsd/sys/link_elf.lo: \ core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/sys/mman.lo: core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/sys/mount.lo: core/sys/freebsd/sys/$(am__dirstamp) +core/sys/freebsd/sys/socket.lo: core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/sys/sysctl.lo: core/sys/freebsd/sys/$(am__dirstamp) +core/sys/freebsd/sys/types.lo: core/sys/freebsd/sys/$(am__dirstamp) core/sys/freebsd/time.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/unistd.lo: core/sys/freebsd/$(am__dirstamp) core/sys/netbsd/$(am__dirstamp): @@ -1685,6 +1699,12 @@ core/sys/linux/input.lo: core/sys/linux/$(am__dirstamp) core/sys/linux/input_event_codes.lo: core/sys/linux/$(am__dirstamp) core/sys/linux/io_uring.lo: core/sys/linux/$(am__dirstamp) core/sys/linux/link.lo: core/sys/linux/$(am__dirstamp) +core/sys/linux/linux/$(am__dirstamp): + @$(MKDIR_P) core/sys/linux/linux + @: > core/sys/linux/linux/$(am__dirstamp) +core/sys/linux/linux/if_arp.lo: core/sys/linux/linux/$(am__dirstamp) +core/sys/linux/linux/if_packet.lo: \ + core/sys/linux/linux/$(am__dirstamp) core/sys/linux/netinet/$(am__dirstamp): @$(MKDIR_P) core/sys/linux/netinet @: > core/sys/linux/netinet/$(am__dirstamp) @@ -2055,12 +2075,16 @@ mostlyclean-compile: -rm -f core/sys/elf/*.lo -rm -f core/sys/freebsd/*.$(OBJEXT) -rm -f core/sys/freebsd/*.lo + -rm -f core/sys/freebsd/net/*.$(OBJEXT) + -rm -f core/sys/freebsd/net/*.lo -rm -f core/sys/freebsd/netinet/*.$(OBJEXT) -rm -f core/sys/freebsd/netinet/*.lo -rm -f core/sys/freebsd/sys/*.$(OBJEXT) -rm -f core/sys/freebsd/sys/*.lo -rm -f core/sys/linux/*.$(OBJEXT) -rm -f core/sys/linux/*.lo + -rm -f core/sys/linux/linux/*.$(OBJEXT) + -rm -f core/sys/linux/linux/*.lo -rm -f core/sys/linux/netinet/*.$(OBJEXT) -rm -f core/sys/linux/netinet/*.lo -rm -f core/sys/linux/sys/*.$(OBJEXT) @@ -2231,9 +2255,11 @@ clean-libtool: -rm -rf core/sys/dragonflybsd/sys/.libs core/sys/dragonflybsd/sys/_libs -rm -rf core/sys/elf/.libs core/sys/elf/_libs -rm -rf core/sys/freebsd/.libs core/sys/freebsd/_libs + -rm -rf core/sys/freebsd/net/.libs core/sys/freebsd/net/_libs -rm -rf core/sys/freebsd/netinet/.libs core/sys/freebsd/netinet/_libs -rm -rf core/sys/freebsd/sys/.libs core/sys/freebsd/sys/_libs -rm -rf core/sys/linux/.libs core/sys/linux/_libs + -rm -rf core/sys/linux/linux/.libs core/sys/linux/linux/_libs -rm -rf core/sys/linux/netinet/.libs core/sys/linux/netinet/_libs -rm -rf core/sys/linux/sys/.libs core/sys/linux/sys/_libs -rm -rf core/sys/netbsd/.libs core/sys/netbsd/_libs @@ -2394,9 +2420,11 @@ distclean-generic: -rm -f core/sys/dragonflybsd/sys/$(am__dirstamp) -rm -f core/sys/elf/$(am__dirstamp) -rm -f core/sys/freebsd/$(am__dirstamp) + -rm -f core/sys/freebsd/net/$(am__dirstamp) -rm -f core/sys/freebsd/netinet/$(am__dirstamp) -rm -f core/sys/freebsd/sys/$(am__dirstamp) -rm -f core/sys/linux/$(am__dirstamp) + -rm -f core/sys/linux/linux/$(am__dirstamp) -rm -f core/sys/linux/netinet/$(am__dirstamp) -rm -f core/sys/linux/sys/$(am__dirstamp) -rm -f core/sys/netbsd/$(am__dirstamp) diff --git a/libphobos/libdruntime/core/sys/linux/linux/if_arp.d b/libphobos/libdruntime/core/sys/linux/linux/if_arp.d new file mode 100644 index 0000000..dea0ab5 --- /dev/null +++ b/libphobos/libdruntime/core/sys/linux/linux/if_arp.d @@ -0,0 +1,136 @@ +//Written in the D programming language + +/++ + D header file for Linux's linux/if_arp.h. + + Copyright: Copyright 2023 + License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + Authors: $(HTTP jmdavisprog.com, Jonathan M Davis) + +/ +module core.sys.linux.linux.if_arp; + +version (linux): +extern(C): +@nogc: +nothrow: + +import core.sys.posix.net.if_ : IF_NAMESIZE; +import core.sys.posix.sys.socket : sockaddr; + +enum : ushort +{ + ARPHRD_NETROM = 0, + ARPHRD_ETHER = 1, + ARPHRD_EETHER = 2, + ARPHRD_AX25 = 3, + ARPHRD_PRONET = 4, + ARPHRD_CHAOS = 5, + ARPHRD_IEEE802 = 6, + ARPHRD_ARCNET = 7, + ARPHRD_APPLETLK = 8, + ARPHRD_DLCI =15, + ARPHRD_ATM =19, + ARPHRD_METRICOM = 23, + ARPHRD_IEEE1394 = 24, + ARPHRD_EUI64 = 27, + ARPHRD_INFINIBAND = 32, + + ARPHRD_SLIP = 256, + ARPHRD_CSLIP = 257, + ARPHRD_SLIP6 = 258, + ARPHRD_CSLIP6 = 259, + ARPHRD_RSRVD = 260, + ARPHRD_ADAPT = 264, + ARPHRD_ROSE = 270, + ARPHRD_X25 = 271, + ARPHRD_HWX25 = 272, + ARPHRD_CAN = 280, + ARPHRD_MCTP = 290, + ARPHRD_PPP = 512, + ARPHRD_CISCO = 513, + ARPHRD_HDLC = ARPHRD_CISCO, + ARPHRD_LAPB = 516, + ARPHRD_DDCMP = 517, + ARPHRD_RAWHDLC = 518, + ARPHRD_RAWIP = 519, + + ARPHRD_TUNNEL = 768, + ARPHRD_TUNNEL6 = 769, + ARPHRD_FRAD = 770, + ARPHRD_SKIP = 771, + ARPHRD_LOOPBACK = 772, + ARPHRD_LOCALTLK = 773, + ARPHRD_FDDI = 774, + ARPHRD_BIF = 775, + ARPHRD_SIT = 776, + ARPHRD_IPDDP = 777, + ARPHRD_IPGRE = 778, + ARPHRD_PIMREG = 779, + ARPHRD_HIPPI = 780, + ARPHRD_ASH = 781, + ARPHRD_ECONET = 782, + ARPHRD_IRDA = 783, + + ARPHRD_FCPP = 784, + ARPHRD_FCAL = 785, + ARPHRD_FCPL = 786, + ARPHRD_FCFABRIC = 787, + + ARPHRD_IEEE802_TR = 800, + ARPHRD_IEEE80211 = 801, + ARPHRD_IEEE80211_PRISM = 802, + ARPHRD_IEEE80211_RADIOTAP = 803, + ARPHRD_IEEE802154 = 804, + ARPHRD_IEEE802154_MONITOR = 805, + + ARPHRD_PHONET = 820, + ARPHRD_PHONET_PIPE = 821, + ARPHRD_CAIF = 822, + ARPHRD_IP6GRE = 823, + ARPHRD_NETLINK = 824, + ARPHRD_6LOWPAN = 825, + ARPHRD_VSOCKMON = 826, + + ARPHRD_VOID = 0xFFFF, + ARPHRD_NONE = 0xFFFE, +} + +enum : ushort +{ + ARPOP_REQUEST = 1, + ARPOP_REPLY = 2, + ARPOP_RREQUEST = 3, + ARPOP_RREPLY = 4, + ARPOP_InREQUEST = 8, + ARPOP_InREPLY = 9, + ARPOP_NAK = 10, +} + +struct arpreq +{ + sockaddr arp_pa; + sockaddr arp_ha; + int arp_flags; + sockaddr arp_netmask; + char[IF_NAMESIZE] arp_dev; +} + +enum +{ + ATF_COM = 0x02, + ATF_PERM = 0x04, + ATF_PUBL = 0x08, + ATF_USETRAILERS = 0x10, + ATF_NETMASK = 0x20, + + ATF_DONTPUB = 0x40, +} + +struct arphdr +{ + ushort ar_hrd; + ushort ar_pro; + ubyte ar_hln; + ubyte ar_pln; + ushort ar_op; +} diff --git a/libphobos/libdruntime/core/sys/linux/linux/if_packet.d b/libphobos/libdruntime/core/sys/linux/linux/if_packet.d new file mode 100644 index 0000000..b50b6a3 --- /dev/null +++ b/libphobos/libdruntime/core/sys/linux/linux/if_packet.d @@ -0,0 +1,315 @@ +//Written in the D programming language + +/++ + D header file for Linux's linux/if_packet.h. + + Copyright: Copyright 2023 + License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + Authors: $(HTTP jmdavisprog.com, Jonathan M Davis) + +/ +module core.sys.linux.linux.if_packet; + +version (linux): +extern(C): +@nogc: +nothrow: + +import core.stdc.config : c_ulong; +import core.sys.posix.sys.socket : sa_family_t; + +struct sockaddr_pkt +{ + sa_family_t spkt_family; + ubyte[14] spkt_device; + ushort spkt_protocol; +} + +struct sockaddr_ll +{ + sa_family_t sll_family; + ushort sll_protocol; + int sll_ifindex; + ushort sll_hatype; + ubyte sll_pkttype; + ubyte sll_halen; + ubyte[8] sll_addr; +} + +enum : ubyte +{ + PACKET_HOST = 0, + PACKET_BROADCAST = 1, + PACKET_MULTICAST = 2, + PACKET_OTHERHOST = 3, + PACKET_OUTGOING = 4, + PACKET_LOOPBACK = 5, + PACKET_USER = 6, + PACKET_KERNEL = 7, +} + +enum +{ + PACKET_ADD_MEMBERSHIP = 1, + PACKET_DROP_MEMBERSHIP = 2, + PACKET_RECV_OUTPUT = 3, + + PACKET_RX_RING = 5, + PACKET_STATISTICS = 6, + PACKET_COPY_THRESH = 7, + PACKET_AUXDATA = 8, + PACKET_ORIGDEV = 9, + PACKET_VERSION = 10, + PACKET_HDRLEN = 11, + PACKET_RESERVE = 12, + PACKET_TX_RING = 13, + PACKET_LOSS = 14, + PACKET_VNET_HDR = 15, + PACKET_TX_TIMESTAMP = 16, + PACKET_TIMESTAMP = 17, + PACKET_FANOUT = 18, + PACKET_TX_HAS_OFF = 19, + PACKET_QDISC_BYPASS = 20, + PACKET_ROLLOVER_STATS = 21, + PACKET_FANOUT_DATA = 22, + PACKET_IGNORE_OUTGOING = 23, + PACKET_VNET_HDR_SZ = 24, + + PACKET_FANOUT_HASH = 0, + PACKET_FANOUT_LB = 1, + PACKET_FANOUT_CPU = 2, + PACKET_FANOUT_ROLLOVER = 3, + PACKET_FANOUT_RND = 4, + PACKET_FANOUT_QM = 5, + PACKET_FANOUT_CBPF = 6, + PACKET_FANOUT_EBPF = 7, + + PACKET_FANOUT_FLAG_ROLLOVER = 0x1000, + PACKET_FANOUT_FLAG_UNIQUEID = 0x2000, + PACKET_FANOUT_FLAG_IGNORE_OUTGOING = 0x4000, + PACKET_FANOUT_FLAG_DEFRAG = 0x8000, +} + +struct tpacket_stats +{ + uint tp_packets; + uint tp_drops; +} + +struct tpacket_stats_v3 +{ + uint tp_packets; + uint tp_drops; + uint tp_freeze_q_cnt; +} + +struct tpacket_rollover_stats +{ + align(8): + ulong tp_all; + ulong tp_huge; + ulong tp_failed; +} + +union tpacket_stats_u +{ + tpacket_stats stats1; + tpacket_stats_v3 stats3; +} + +struct tpacket_auxdata +{ + uint tp_status; + uint tp_len; + uint tp_snaplen; + ushort tp_mac; + ushort tp_net; + ushort tp_vlan_tci; + ushort tp_vlan_tpid; +} + +enum : uint +{ + TP_STATUS_KERNEL = 0, + TP_STATUS_USER = 1 << 0, + TP_STATUS_COPY = 1 << 1, + TP_STATUS_LOSING = 1 << 2, + TP_STATUS_CSUMNOTREADY = 1 << 3, + TP_STATUS_VLAN_VALID = 1 << 4, + TP_STATUS_BLK_TMO = 1 << 5, + TP_STATUS_VLAN_TPID_VALID = 1 << 6, + TP_STATUS_CSUM_VALID = 1 << 7, + TP_STATUS_GSO_TCP = 1 << 8, +} + +enum : uint +{ + TP_STATUS_AVAILABLE = 0, + TP_STATUS_SEND_REQUEST = 1 << 0, + TP_STATUS_SENDING = 1 << 1, + TP_STATUS_WRONG_FORMAT = 1 << 2, +} + +enum : uint +{ + TP_STATUS_TS_SOFTWARE = 1 << 29, + TP_STATUS_TS_RAW_HARDWARE = 1U << 31, +} + +enum uint TP_FT_REQ_FILL_RXHASH = 0x1; + +struct tpacket_hdr +{ + c_ulong tp_status; + uint tp_len; + uint tp_snaplen; + ushort tp_mac; + ushort tp_net; + uint tp_sec; + uint tp_usec; +} + +enum TPACKET_ALIGNMENT = 16; +size_t TPACKET_ALIGN(size_t x) { return (x + TPACKET_ALIGNMENT - 1) &~ (TPACKET_ALIGNMENT - 1); } +enum TPACKET_HDRLEN = TPACKET_ALIGN(tpacket_hdr.sizeof) + sockaddr_ll.sizeof; + +struct tpacket2_hdr +{ + uint tp_status; + uint tp_len; + uint tp_snaplen; + ushort tp_mac; + ushort tp_net; + uint tp_sec; + uint tp_nsec; + ushort tp_vlan_tci; + ushort tp_vlan_tpid; + ubyte[4] tp_padding; +} + +struct tpacket_hdr_variant1 +{ + uint tp_rxhash; + uint tp_vlan_tci; + ushort tp_vlan_tpid; + ushort tp_padding; +} + +struct tpacket3_hdr +{ + uint tp_next_offset; + uint tp_sec; + uint tp_nsec; + uint tp_snaplen; + uint tp_len; + uint tp_status; + ushort tp_mac; + ushort tp_net; + + union + { + tpacket_hdr_variant1 hv1; + } + + ubyte[8] tp_padding; +} + +struct tpacket_bd_ts +{ + uint ts_sec; + + union + { + uint ts_usec; + uint ts_nsec; + } +} + +struct tpacket_hdr_v1 +{ + uint block_status; + uint num_pkts; + uint offset_to_first_pkt; + uint blk_len; + align(8) ulong seq_num; + tpacket_bd_ts ts_first_pkt; + tpacket_bd_ts ts_last_pkt; +} + +union tpacket_bd_header_u +{ + tpacket_hdr_v1 bh1; +} + +struct tpacket_block_desc +{ + uint version_; + uint offset_to_priv; + tpacket_bd_header_u hdr; +} + +enum TPACKET2_HDRLEN = TPACKET_ALIGN(tpacket2_hdr.sizeof) + sockaddr_ll.sizeof; +enum TPACKET3_HDRLEN = TPACKET_ALIGN(tpacket3_hdr.sizeof) + sockaddr_ll.sizeof; + +enum tpacket_versions +{ + TPACKET_V1, + TPACKET_V2, + TPACKET_V3 +} + +struct tpacket_req +{ + uint tp_block_size; + uint tp_block_nr; + uint tp_frame_size; + uint tp_frame_nr; +} + +struct tpacket_req3 +{ + uint tp_block_size; + uint tp_block_nr; + uint tp_frame_size; + uint tp_frame_nr; + uint tp_retire_blk_tov; + uint tp_sizeof_priv; + uint tp_feature_req_word; +} + +union tpacket_req_u +{ + tpacket_req req; + tpacket_req3 req3; +} + +struct packet_mreq +{ + int mr_ifindex; + ushort mr_type; + ushort mr_alen; + ubyte[8] mr_address; +} + +struct fanout_args +{ + version(LittleEndian) + { + ushort id; + ushort type_flags; + } + else + { + ushort type_flags; + ushort id; + } + + uint max_num_members; +} + +enum +{ + PACKET_MR_MULTICAST = 0, + PACKET_MR_PROMISC = 1, + PACKET_MR_ALLMULTI = 2, + PACKET_MR_UNICAST = 3, +} diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index a7bf856..8c536ce 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -2458e8f82e3004197d8a66239a6b72e17264bb26 +1c98326e787e504d9045004e593273ec99b13121 The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/parallelism.d b/libphobos/src/std/parallelism.d index 3fe8cd6..fadb4c1 100644 --- a/libphobos/src/std/parallelism.d +++ b/libphobos/src/std/parallelism.d @@ -418,8 +418,8 @@ Bugs: Changes to `ref` and `out` arguments are not propagated to the */ struct Task(alias fun, Args...) { - AbstractTask base = {runTask : &impl}; - alias base this; + private AbstractTask base = {runTask : &impl}; + private alias base this; private @property AbstractTask* basePtr() { diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d index 1a3fb06..89cfa07 100644 --- a/libphobos/src/std/range/primitives.d +++ b/libphobos/src/std/range/primitives.d @@ -165,21 +165,24 @@ See_Also: Params: R = type to be tested - E = the type of the elements of the range if not `void` + E = if present, the elements of the range must be + $(DDSUBLINK spec/const3, implicit_qualifier_conversions, qualifier-convertible) + to this type Returns: `true` if R is an input range (possibly with element type `E`), `false` if not */ -enum bool isInputRange(R, E = void) = +enum bool isInputRange(R) = is(typeof(R.init) == R) && is(typeof((R r) { return r.empty; } (R.init)) == bool) && (is(typeof((return ref R r) => r.front)) || is(typeof(ref (return ref R r) => r.front))) && !is(typeof((R r) { return r.front; } (R.init)) == void) - && is(typeof((R r) => r.popFront)) - && (is(E == void) || - is(ElementType!R == E) || - is(const(ElementType!R) == E) || - (is(const(ElementType!R) == immutable E) && is(const(E) == E))); + && is(typeof((R r) => r.popFront)); + +/// ditto +enum bool isInputRange(R, E) = + .isInputRange!R && isQualifierConvertible!(ElementType!R, E); + /// @safe unittest { diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d index aa69aac..2e7a4f6 100644 --- a/libphobos/src/std/traits.d +++ b/libphobos/src/std/traits.d @@ -132,6 +132,7 @@ * $(LREF PointerTarget) * $(LREF Signed) * $(LREF Unconst) + * $(LREF Unshared) * $(LREF Unqual) * $(LREF Unsigned) * $(LREF ValueType) @@ -7848,6 +7849,46 @@ else static assert(is(Unconst!ImmIntArr == immutable(int)[])); } +/++ + Removes `shared` qualifier, if any, from type `T`. + + Note that while `immutable` is implicitly `shared`, it is unaffected by + Unshared. Only explict `shared` is removed. + +/ +template Unshared(T) +{ + static if (is(T == shared U, U)) + alias Unshared = U; + else + alias Unshared = T; +} + +/// +@safe unittest +{ + static assert(is(Unshared!int == int)); + static assert(is(Unshared!(const int) == const int)); + static assert(is(Unshared!(immutable int) == immutable int)); + + static assert(is(Unshared!(shared int) == int)); + static assert(is(Unshared!(shared(const int)) == const int)); + + static assert(is(Unshared!(shared(int[])) == shared(int)[])); +} + +@safe unittest +{ + static assert(is(Unshared!( int) == int)); + static assert(is(Unshared!( const int) == const int)); + static assert(is(Unshared!( inout int) == inout int)); + static assert(is(Unshared!( inout const int) == inout const int)); + static assert(is(Unshared!(shared int) == int)); + static assert(is(Unshared!(shared const int) == const int)); + static assert(is(Unshared!(shared inout int) == inout int)); + static assert(is(Unshared!(shared inout const int) == inout const int)); + static assert(is(Unshared!( immutable int) == immutable int)); +} + version (StdDdoc) { /** |