[Global]: loading init
This commit is contained in:
commit
f6f27d419a
12
.github/dependabot.yml
vendored
Normal file
12
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# To get started with Dependabot version updates, you'll need to specify which
|
||||||
|
# package ecosystems to update and where the package manifests are located.
|
||||||
|
# Please see the documentation for all configuration options:
|
||||||
|
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
||||||
|
|
||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: gitsubmodule
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: daily
|
||||||
|
open-pull-requests-limit: 10
|
47
.github/workflows/build.yml
vendored
Normal file
47
.github/workflows/build.yml
vendored
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
name: Build
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
name: Build binary
|
||||||
|
runs-on: windows-2022
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
configuration:
|
||||||
|
- Debug
|
||||||
|
- Release
|
||||||
|
steps:
|
||||||
|
- name: Check out files
|
||||||
|
uses: actions/checkout@v3.5.2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
fetch-depth: 0
|
||||||
|
lfs: false
|
||||||
|
|
||||||
|
- name: Add msbuild to PATH
|
||||||
|
uses: microsoft/setup-msbuild@v1.3.1
|
||||||
|
|
||||||
|
- name: Generate project files
|
||||||
|
run: tools/premake5 vs2022
|
||||||
|
|
||||||
|
- name: Set up problem matching
|
||||||
|
uses: ammaraskar/msvc-problem-matcher@master
|
||||||
|
|
||||||
|
- name: Build ${{matrix.configuration}} binaries
|
||||||
|
run: msbuild /m /v:minimal /p:Configuration=${{matrix.configuration}} /p:Platform=Win32 build/iw3sp_dev.sln
|
||||||
|
|
||||||
|
- name: Upload ${{matrix.configuration}} binaries
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: ${{matrix.configuration}} binaries
|
||||||
|
path: |
|
||||||
|
build/bin/${{matrix.configuration}}/game.dll
|
||||||
|
build/bin/${{matrix.configuration}}/game.pdb
|
85
.gitignore
vendored
Normal file
85
.gitignore
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
# Windows image file caches
|
||||||
|
Thumbs.db
|
||||||
|
ehthumbs.db
|
||||||
|
|
||||||
|
# Folder config file
|
||||||
|
Desktop.ini
|
||||||
|
|
||||||
|
# Recycle Bin used on file shares
|
||||||
|
$RECYCLE.BIN/
|
||||||
|
|
||||||
|
# Windows Installer files
|
||||||
|
*.cab
|
||||||
|
*.msi
|
||||||
|
*.msm
|
||||||
|
*.msp
|
||||||
|
|
||||||
|
# =========================
|
||||||
|
# Operating System Files
|
||||||
|
# =========================
|
||||||
|
# Windows
|
||||||
|
*.lnk
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
# =========================
|
||||||
|
|
||||||
|
.DS_Store
|
||||||
|
.AppleDouble
|
||||||
|
.LSOverride
|
||||||
|
|
||||||
|
# Icon must end with two \r
|
||||||
|
Icon
|
||||||
|
|
||||||
|
|
||||||
|
# Thumbnails
|
||||||
|
._*
|
||||||
|
|
||||||
|
# Files that might appear on external disk
|
||||||
|
.Spotlight-V100
|
||||||
|
.Trashes
|
||||||
|
|
||||||
|
# Directories potentially created on remote AFP share
|
||||||
|
.AppleDB
|
||||||
|
.AppleDesktop
|
||||||
|
Network Trash Folder
|
||||||
|
Temporary Items
|
||||||
|
.apdisk
|
||||||
|
|
||||||
|
*.obj
|
||||||
|
*.tlog
|
||||||
|
*.log
|
||||||
|
*.lastbuildstate
|
||||||
|
*.idb
|
||||||
|
*.exp
|
||||||
|
*.ilk
|
||||||
|
*.unsuccessfulbuild
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.pdb
|
||||||
|
*.suo
|
||||||
|
|
||||||
|
# Additional stuff
|
||||||
|
build
|
||||||
|
PETool.exe
|
||||||
|
verpatch.exe
|
||||||
|
user*.bat
|
||||||
|
*.zip
|
||||||
|
submodules.txt
|
||||||
|
Resource.aps
|
||||||
|
|
||||||
|
# IDA
|
||||||
|
# =========================
|
||||||
|
*.id0
|
||||||
|
*.id1
|
||||||
|
*.id2
|
||||||
|
*.nam
|
||||||
|
*.til
|
||||||
|
|
||||||
|
# VS
|
||||||
|
# =========================
|
||||||
|
*.vs
|
||||||
|
Debug
|
||||||
|
src/Debug
|
||||||
|
|
||||||
|
assets/discord_rich/
|
||||||
|
assets/github/.old/
|
30
.gitmodules
vendored
Normal file
30
.gitmodules
vendored
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
[submodule "deps/dxsdk"]
|
||||||
|
path = deps/dxsdk
|
||||||
|
url = https://github.com/devKlausS/dxsdk.git
|
||||||
|
[submodule "deps/discord-rpc"]
|
||||||
|
path = deps/discord-rpc
|
||||||
|
url = https://github.com/Zet0x0/discord-rpc.git
|
||||||
|
[submodule "deps/rapidjson"]
|
||||||
|
path = deps/rapidjson
|
||||||
|
url = https://github.com/Tencent/rapidjson.git
|
||||||
|
[submodule "deps/json"]
|
||||||
|
path = deps/json
|
||||||
|
url = https://github.com/nlohmann/json.git
|
||||||
|
[submodule "deps/curl"]
|
||||||
|
path = deps/curl
|
||||||
|
url = https://github.com/curl/curl.git
|
||||||
|
[submodule "deps/libtommath"]
|
||||||
|
path = deps/libtommath
|
||||||
|
url = https://github.com/libtom/libtommath.git
|
||||||
|
[submodule "deps/libtomcrypt"]
|
||||||
|
path = deps/libtomcrypt
|
||||||
|
url = https://github.com/libtom/libtomcrypt.git
|
||||||
|
[submodule "deps/GSL"]
|
||||||
|
path = deps/GSL
|
||||||
|
url = https://github.com/microsoft/GSL.git
|
||||||
|
[submodule "deps/imgui"]
|
||||||
|
path = deps/imgui
|
||||||
|
url = https://github.com/ocornut/imgui.git
|
||||||
|
[submodule "deps/imgui_markdown"]
|
||||||
|
path = deps/imgui_markdown
|
||||||
|
url = https://github.com/juliettef/imgui_markdown.git
|
674
LICENSE
Normal file
674
LICENSE
Normal file
@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<https://www.gnu.org/licenses/why-not-lgpl.html>.
|
67
README.md
Normal file
67
README.md
Normal file
@ -0,0 +1,67 @@
|
|||||||
|

|
||||||
|
[](https://github.com/JerryALT/iw3sp_mod/actions)
|
||||||
|
[](https://discord.gg/YzNZSEMAnf)
|
||||||
|
|
||||||
|
# IW3SP-MOD - Modification for Call of Duty 4: Modern Warfare
|
||||||
|
|
||||||
|
Singleplayer client modification for Call of Duty 4: Modern Warfare (IW3). This client based on the [IW4x Client](https://github.com/iw4x/iw4x-client).
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="assets/github/banner.png?raw=true"/>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
___
|
||||||
|
|
||||||
|
# Credits
|
||||||
|
- [Bogdan Konstantinou](https://www.youtube.com/@BogdanKonstantinou)
|
||||||
|
- [xoxor4d - IW3xo](https://github.com/xoxor4d/iw3xo-dev)
|
||||||
|
- [X Labs Team](https://github.com/XLabsProject)
|
||||||
|
- [AlterWare](https://github.com/alterware)
|
||||||
|
- [fed - h2-mod](https://github.com/fedddddd/h2-mod)
|
||||||
|
- [Nukem9 - LinkerMod](https://github.com/Nukem9/LinkerMod)
|
||||||
|
- [CoD4X Server/Client](https://github.com/callofduty4x)
|
||||||
|
- [Vlad Loktionov](https://www.youtube.com/@ruvlad)
|
||||||
|
|
||||||
|
## [Dependencies]
|
||||||
|
- [ocornut - Dear ImGui](https://github.com/ocornut/imgui)
|
||||||
|
- [curl](https://github.com/curl/curl)
|
||||||
|
- [juliettef - imgui_markdown](https://github.com/juliettef/imgui_markdown)
|
||||||
|
- [discord-rpc](https://github.com/discord/discord-rpc)
|
||||||
|
- [nlohmann - json](https://github.com/nlohmann/json)
|
||||||
|
- [DirectX SDK](https://github.com/devKlausS/dxsdk)
|
||||||
|
- [LibTomCrypt](https://github.com/libtom/libtomcrypt)
|
||||||
|
- [LibTomMath](https://github.com/libtom/libtommath)
|
||||||
|
|
||||||
|
# Disclaimer
|
||||||
|
This software has been created purely for the purposes of academic research. Project maintainers are not responsible or liable for misuse of the software. Use responsibly.
|
||||||
|
|
||||||
|
# Features
|
||||||
|
[Mod compatibility list](https://github.com/JerryALT/iw3sp_mod/wiki/Mod-compatibility-list)
|
||||||
|
|
||||||
|
- Increased asset limits for IW3
|
||||||
|
- FX: 1200
|
||||||
|
- Image: 7168
|
||||||
|
- Loaded Sound: 2700
|
||||||
|
- Streamed Sound: 24000
|
||||||
|
- Material: 8192
|
||||||
|
- Weapon: 2400
|
||||||
|
- Xmodel: 5125
|
||||||
|
- Added the game achievements;
|
||||||
|
- Added the [gamepad](https://github.com/JerryALT/iw3sp_mod/wiki/All-about-gamepad) support with aim assist;
|
||||||
|
- Added the [custom methods and functions](https://github.com/JerryALT/iw3sp_mod/wiki/GSC-Functions) for GSC;
|
||||||
|
- Added loading the additional .ff files `[level name]_patch.ff`;
|
||||||
|
- Added FOV logic from multiplayer to singleplayer;
|
||||||
|
- Added [map entities editing](https://github.com/JerryALT/iw3sp_mod/wiki/Changing-the-map-entities) for the stock maps and more...
|
||||||
|
|
||||||
|
# How to install modification? (For regular users)
|
||||||
|
**NOTE**: You must legally own [Steam version](https://store.steampowered.com/app/7940/Call_of_Duty_4_Modern_Warfare_2007/) of Call of Duty® 4: Modern Warfare® (2007) to run this mod. Cracked/Pirated/CDs versions of the game are **NOT** supported.
|
||||||
|
1. Download the latest [release](https://github.com/JerryALT/iw3sp_mod/releases/latest)
|
||||||
|
2. Place the .zip contents into your cod4 root folder
|
||||||
|
3. Start the **iw3sp_mod.exe**
|
||||||
|
|
||||||
|
# How to compile from source? (For advanced users)
|
||||||
|
1. Clone the this repository. I recommend use the [git-scm](https://git-scm.com/downloads).
|
||||||
|
</br>P.S: (**Downloading the zip does not include deps!**)</br>
|
||||||
|
2. Find any directory which you want the placed the content of repository, then open context menu and find "Git Bash Here" and write next line in the cmd: `git clone https://github.com/JerryALT/iw3sp_mod.git`
|
||||||
|
3. After cloning click the generate.bat and wait when all files will be ready.
|
||||||
|
4. Open build folder and find the iw3sp_dev.sln file and compile.
|
BIN
assets/github/banner.png
Normal file
BIN
assets/github/banner.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 804 KiB |
34
deps/GSL/.clang-format
vendored
Normal file
34
deps/GSL/.clang-format
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
ColumnLimit: 100
|
||||||
|
|
||||||
|
UseTab: Never
|
||||||
|
IndentWidth: 4
|
||||||
|
AccessModifierOffset: -4
|
||||||
|
NamespaceIndentation: Inner
|
||||||
|
|
||||||
|
BreakBeforeBraces: Custom
|
||||||
|
BraceWrapping:
|
||||||
|
AfterNamespace: true
|
||||||
|
AfterEnum: true
|
||||||
|
AfterStruct: true
|
||||||
|
AfterClass: true
|
||||||
|
SplitEmptyFunction: false
|
||||||
|
AfterControlStatement: true
|
||||||
|
AfterFunction: true
|
||||||
|
AfterUnion: true
|
||||||
|
BeforeElse: true
|
||||||
|
|
||||||
|
|
||||||
|
AlwaysBreakTemplateDeclarations: true
|
||||||
|
BreakConstructorInitializersBeforeComma: true
|
||||||
|
ConstructorInitializerAllOnOneLineOrOnePerLine: true
|
||||||
|
AllowShortBlocksOnASingleLine: true
|
||||||
|
AllowShortFunctionsOnASingleLine: All
|
||||||
|
AllowShortIfStatementsOnASingleLine: true
|
||||||
|
AllowShortLoopsOnASingleLine: true
|
||||||
|
|
||||||
|
PointerAlignment: Left
|
||||||
|
AlignConsecutiveAssignments: false
|
||||||
|
AlignTrailingComments: true
|
||||||
|
|
||||||
|
SpaceAfterCStyleCast: true
|
||||||
|
CommentPragmas: '^ NO-FORMAT:'
|
1
deps/GSL/.gitattributes
vendored
Normal file
1
deps/GSL/.gitattributes
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
include/gsl/* linguist-language=C++
|
50
deps/GSL/.github/workflows/android.yml
vendored
Normal file
50
deps/GSL/.github/workflows/android.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
name: CI_Android
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Android:
|
||||||
|
runs-on: macos-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Create build directory
|
||||||
|
run: mkdir -p build
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
|
- name: Start emulator
|
||||||
|
run: |
|
||||||
|
echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-24;default;x86_64'
|
||||||
|
echo "no" | $ANDROID_HOME/tools/bin/avdmanager create avd -n xamarin_android_emulator -k 'system-images;android-24;default;x86_64' --force
|
||||||
|
$ANDROID_HOME/emulator/emulator -list-avds
|
||||||
|
echo "Starting emulator"
|
||||||
|
# Start emulator in background
|
||||||
|
nohup $ANDROID_HOME/emulator/emulator -avd xamarin_android_emulator -no-snapshot > /dev/null 2>&1 &
|
||||||
|
echo "Emulator starting"
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: cmake -Werror=dev -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK_LATEST_HOME/build/cmake/android.toolchain.cmake -DANDROID_PLATFORM=16 -DANDROID_ABI=x86_64 -DCMAKE_BUILD_TYPE=Debug ..
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build . --parallel
|
||||||
|
|
||||||
|
- name: Wait for emulator ready
|
||||||
|
run: |
|
||||||
|
$ANDROID_HOME/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed | tr -d '\r') ]]; do sleep 10; done; input keyevent 82'
|
||||||
|
$ANDROID_HOME/platform-tools/adb devices
|
||||||
|
$ANDROID_HOME/platform-tools/adb shell getprop ro.product.cpu.abi
|
||||||
|
echo "Emulator started"
|
||||||
|
|
||||||
|
- name: Deploy tests
|
||||||
|
run: |
|
||||||
|
adb push tests /data/local/tmp
|
||||||
|
adb shell find /data/local/tmp/tests -maxdepth 1 -exec chmod +x {} \\\;
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: adb shell find /data/local/tmp/tests -name "*_tests" -maxdepth 1 -exec {} \\\;
|
25
deps/GSL/.github/workflows/cmake_find_package.yml
vendored
Normal file
25
deps/GSL/.github/workflows/cmake_find_package.yml
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
name: cmake_find_package
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cmake-find-package:
|
||||||
|
name: Build ${{ matrix.os }}
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
os: [ ubuntu-latest, macos-latest ]
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: lukka/get-cmake@latest
|
||||||
|
with:
|
||||||
|
cmakeVersion: 3.14.0
|
||||||
|
- name: Configure GSL
|
||||||
|
run: cmake -S . -B build -G "Ninja" -D GSL_TEST=OFF -D CMAKE_INSTALL_PREFIX=${GITHUB_WORKSPACE}/build/install
|
||||||
|
- name: Install GSL
|
||||||
|
run: cmake --build build --target install
|
||||||
|
- name: Test GSL find_package support
|
||||||
|
run: cmake -S tests/ -B build/tests_find_package -G "Ninja" -D CMAKE_PREFIX_PATH=${GITHUB_WORKSPACE}/build/install -D CMAKE_BUILD_TYPE=Release
|
52
deps/GSL/.github/workflows/ios.yml
vendored
Normal file
52
deps/GSL/.github/workflows/ios.yml
vendored
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
name: CI_iOS
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ main ]
|
||||||
|
pull_request:
|
||||||
|
branches: [ main ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
iOS:
|
||||||
|
runs-on: macos-latest
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
working-directory: build
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Create build directory
|
||||||
|
run: mkdir -p build
|
||||||
|
working-directory: .
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cmake \
|
||||||
|
-Werror=dev \
|
||||||
|
-GXcode \
|
||||||
|
-DCMAKE_SYSTEM_NAME=iOS \
|
||||||
|
"-DCMAKE_OSX_ARCHITECTURES=arm64;x86_64" \
|
||||||
|
-DCMAKE_OSX_DEPLOYMENT_TARGET=9 \
|
||||||
|
-DCMAKE_TRY_COMPILE_TARGET_TYPE=STATIC_LIBRARY \
|
||||||
|
"-DMACOSX_BUNDLE_GUI_IDENTIFIER=GSL.\$(EXECUTABLE_NAME)" \
|
||||||
|
-DMACOSX_BUNDLE_BUNDLE_VERSION=3.1.0 \
|
||||||
|
-DMACOSX_BUNDLE_SHORT_VERSION_STRING=3.1.0 \
|
||||||
|
..
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: cmake --build . --parallel `sysctl -n hw.ncpu` --config Release -- -sdk iphonesimulator
|
||||||
|
|
||||||
|
- name: Start simulator
|
||||||
|
run: |
|
||||||
|
RUNTIME=`xcrun simctl list runtimes iOS -j|jq '.runtimes|last.identifier'`
|
||||||
|
UDID=`xcrun simctl list devices iPhone available -j|jq -r ".devices[$RUNTIME]|last.udid"`
|
||||||
|
xcrun simctl bootstatus $UDID -b
|
||||||
|
|
||||||
|
- name: Test
|
||||||
|
run: |
|
||||||
|
for TEST in `find tests/Release-iphonesimulator -depth 1 -name "*.app"`
|
||||||
|
do
|
||||||
|
xcrun simctl install booted $TEST
|
||||||
|
TEST_ID=`plutil -convert json -o - $TEST/Info.plist|jq -r ".CFBundleIdentifier"`
|
||||||
|
xcrun simctl launch --console booted $TEST_ID
|
||||||
|
xcrun simctl uninstall booted $TEST_ID
|
||||||
|
done
|
16
deps/GSL/.gitignore
vendored
Normal file
16
deps/GSL/.gitignore
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
CMakeFiles
|
||||||
|
build
|
||||||
|
tests/CMakeFiles
|
||||||
|
tests/Debug
|
||||||
|
*.opensdf
|
||||||
|
*.sdf
|
||||||
|
tests/*tests.dir
|
||||||
|
*.vcxproj
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.sln
|
||||||
|
*.tlog
|
||||||
|
Testing/Temporary/*.*
|
||||||
|
CMakeCache.txt
|
||||||
|
*.suo
|
||||||
|
.vs/
|
||||||
|
.vscode/
|
48
deps/GSL/CMakeLists.txt
vendored
Normal file
48
deps/GSL/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14...3.16)
|
||||||
|
|
||||||
|
project(GSL VERSION 4.0.0 LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_library(GSL INTERFACE)
|
||||||
|
add_library(Microsoft.GSL::GSL ALIAS GSL)
|
||||||
|
|
||||||
|
# https://cmake.org/cmake/help/latest/variable/PROJECT_IS_TOP_LEVEL.html
|
||||||
|
string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} PROJECT_IS_TOP_LEVEL)
|
||||||
|
|
||||||
|
option(GSL_INSTALL "Generate and install GSL target" ${PROJECT_IS_TOP_LEVEL})
|
||||||
|
option(GSL_TEST "Build and perform GSL tests" ${PROJECT_IS_TOP_LEVEL})
|
||||||
|
|
||||||
|
# The implementation generally assumes a platform that implements C++14 support
|
||||||
|
target_compile_features(GSL INTERFACE "cxx_std_14")
|
||||||
|
|
||||||
|
# Setup include directory
|
||||||
|
add_subdirectory(include)
|
||||||
|
|
||||||
|
target_sources(GSL INTERFACE $<BUILD_INTERFACE:${GSL_SOURCE_DIR}/GSL.natvis>)
|
||||||
|
|
||||||
|
if (GSL_TEST)
|
||||||
|
enable_testing()
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (GSL_INSTALL)
|
||||||
|
include(GNUInstallDirs)
|
||||||
|
include(CMakePackageConfigHelpers)
|
||||||
|
|
||||||
|
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/gsl" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
set(export_name "Microsoft.GSLConfig")
|
||||||
|
set(namespace "Microsoft.GSL::")
|
||||||
|
set(cmake_files_install_dir ${CMAKE_INSTALL_DATADIR}/cmake/Microsoft.GSL)
|
||||||
|
|
||||||
|
install(TARGETS GSL EXPORT ${export_name} INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
install(EXPORT ${export_name} NAMESPACE ${namespace} DESTINATION ${cmake_files_install_dir})
|
||||||
|
export(TARGETS GSL NAMESPACE ${namespace} FILE ${export_name}.cmake)
|
||||||
|
|
||||||
|
set(gls_config_version "${CMAKE_CURRENT_BINARY_DIR}/Microsoft.GSLConfigVersion.cmake")
|
||||||
|
|
||||||
|
write_basic_package_version_file(${gls_config_version} COMPATIBILITY SameMajorVersion ARCH_INDEPENDENT)
|
||||||
|
|
||||||
|
install(FILES ${gls_config_version} DESTINATION ${cmake_files_install_dir})
|
||||||
|
|
||||||
|
install(FILES GSL.natvis DESTINATION ${cmake_files_install_dir})
|
||||||
|
endif()
|
18
deps/GSL/CMakeSettings.json
vendored
Normal file
18
deps/GSL/CMakeSettings.json
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "x64-Debug",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"configurationType": "Debug",
|
||||||
|
"inheritEnvironments": [
|
||||||
|
"msvc_x64_x64"
|
||||||
|
],
|
||||||
|
"buildRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\build\\${name}",
|
||||||
|
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
|
||||||
|
"cmakeCommandArgs": "-DGSL_CXX_STANDARD=17",
|
||||||
|
"buildCommandArgs": "-v",
|
||||||
|
"ctestCommandArgs": "",
|
||||||
|
"codeAnalysisRuleset": "CppCoreCheckRules.ruleset"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
29
deps/GSL/CONTRIBUTING.md
vendored
Normal file
29
deps/GSL/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
## Contributing to the Guidelines Support Library
|
||||||
|
|
||||||
|
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
|
||||||
|
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines). GSL design changes are made only as a result of modifications to the Guidelines.
|
||||||
|
|
||||||
|
GSL is accepting contributions that improve or refine any of the types in this library as well as ports to other platforms. Changes should have an issue
|
||||||
|
tracking the suggestion that has been approved by the maintainers. Your pull request should include a link to the bug that you are fixing. If you've submitted
|
||||||
|
a PR, please post a comment in the associated issue to avoid duplication of effort.
|
||||||
|
|
||||||
|
## Legal
|
||||||
|
You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us and the community permission to
|
||||||
|
use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright.
|
||||||
|
|
||||||
|
Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally.
|
||||||
|
|
||||||
|
## Housekeeping
|
||||||
|
Your pull request should:
|
||||||
|
|
||||||
|
* Include a description of what your change intends to do
|
||||||
|
* Be a child commit of a reasonably recent commit in the **main** branch
|
||||||
|
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
|
||||||
|
* It is desirable, but not necessary, for the tests to pass at each commit. Please see [README.md](./README.md) for instructions to build the test suite.
|
||||||
|
* Have clear commit messages
|
||||||
|
* e.g. "Fix issue", "Add tests for type", etc.
|
||||||
|
* Include appropriate tests
|
||||||
|
* Tests should include reasonable permutations of the target fix/change
|
||||||
|
* Include baseline changes with your change
|
||||||
|
* All changed code must have 100% code coverage
|
||||||
|
* To avoid line ending issues, set `autocrlf = input` and `whitespace = cr-at-eol` in your git configuration
|
32
deps/GSL/GSL.natvis
vendored
Normal file
32
deps/GSL/GSL.natvis
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This will make GitHub and some editors recognize this code as XML:
|
||||||
|
vim: syntax=xml
|
||||||
|
-->
|
||||||
|
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
||||||
|
<!-- These types are from the util header. -->
|
||||||
|
<Type Name="gsl::final_action<*>">
|
||||||
|
<DisplayString>{{ invoke = {invoke_}, action = {f_} }}</DisplayString>
|
||||||
|
<Expand>
|
||||||
|
<Item Name="[invoke]">invoke_</Item>
|
||||||
|
<Item Name="[callback]">f_</Item>
|
||||||
|
</Expand>
|
||||||
|
</Type>
|
||||||
|
|
||||||
|
<!-- These types are from the span header. -->
|
||||||
|
<Type Name="gsl::span<*, *>">
|
||||||
|
<DisplayString>{{ extent = {storage_.size_} }}</DisplayString>
|
||||||
|
<Expand>
|
||||||
|
<ArrayItems>
|
||||||
|
<Size>storage_.size_</Size>
|
||||||
|
<ValuePointer>storage_.data_</ValuePointer>
|
||||||
|
</ArrayItems>
|
||||||
|
</Expand>
|
||||||
|
</Type>
|
||||||
|
|
||||||
|
<!-- These types are from the pointers header. -->
|
||||||
|
<Type Name="gsl::not_null<*>">
|
||||||
|
<!-- We can always dereference this since it's an invariant. -->
|
||||||
|
<DisplayString>value = {*ptr_}</DisplayString>
|
||||||
|
</Type>
|
||||||
|
</AutoVisualizer>
|
21
deps/GSL/LICENSE
vendored
Normal file
21
deps/GSL/LICENSE
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
|
||||||
|
This code is licensed under the MIT License (MIT).
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||||
|
of the Software, and to permit persons to whom the Software is furnished to do
|
||||||
|
so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
218
deps/GSL/README.md
vendored
Normal file
218
deps/GSL/README.md
vendored
Normal file
@ -0,0 +1,218 @@
|
|||||||
|
# GSL: Guidelines Support Library
|
||||||
|
[](https://dev.azure.com/cppstat/GSL/_build/latest?definitionId=1&branchName=main)
|
||||||
|
|
||||||
|
The Guidelines Support Library (GSL) contains functions and types that are suggested for use by the
|
||||||
|
[C++ Core Guidelines](https://github.com/isocpp/CppCoreGuidelines) maintained by the [Standard C++ Foundation](https://isocpp.org).
|
||||||
|
This repo contains Microsoft's implementation of GSL.
|
||||||
|
|
||||||
|
The entire implementation is provided inline in the headers under the [gsl](./include/gsl) directory. The implementation generally assumes a platform that implements C++14 support.
|
||||||
|
|
||||||
|
While some types have been broken out into their own headers (e.g. [gsl/span](./include/gsl/span)),
|
||||||
|
it is simplest to just include [gsl/gsl](./include/gsl/gsl) and gain access to the entire library.
|
||||||
|
|
||||||
|
> NOTE: We encourage contributions that improve or refine any of the types in this library as well as ports to
|
||||||
|
other platforms. Please see [CONTRIBUTING.md](./CONTRIBUTING.md) for more information about contributing.
|
||||||
|
|
||||||
|
# Project Code of Conduct
|
||||||
|
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
||||||
|
|
||||||
|
# Usage of Third Party Libraries
|
||||||
|
This project makes use of the [Google Test](https://github.com/google/googletest) testing library. Please see the [ThirdPartyNotices.txt](./ThirdPartyNotices.txt) file for details regarding the licensing of Google Test.
|
||||||
|
|
||||||
|
# Supported features
|
||||||
|
## Microsoft GSL implements the following from the C++ Core Guidelines:
|
||||||
|
|
||||||
|
Feature | Supported? | Description
|
||||||
|
-------------------------------------------------------------------------|:----------:|-------------
|
||||||
|
[**1. Views**][cg-views] | |
|
||||||
|
[owner](docs/headers.md#user-content-H-pointers-owner) | ☑ | An alias for a raw pointer
|
||||||
|
[not_null](docs/headers.md#user-content-H-pointers-not_null) | ☑ | Restricts a pointer/smart pointer to hold non-null values
|
||||||
|
[span](docs/headers.md#user-content-H-span-span) | ☑ | A view over a contiguous sequence of memory. Based on the standardized version of `std::span`, however `gsl::span` enforces bounds checking.
|
||||||
|
span_p | ☐ | Spans a range starting from a pointer to the first place for which the predicate is true
|
||||||
|
[basic_zstring](docs/headers.md#user-content-H-zstring) | ☑ | A pointer to a C-string (zero-terminated array) with a templated char type
|
||||||
|
[zstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `char`
|
||||||
|
[czstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `const char`
|
||||||
|
[wzstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `wchar_t`
|
||||||
|
[cwzstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `const wchar_t`
|
||||||
|
[u16zstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `char16_t`
|
||||||
|
[cu16zstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `const char16_t`
|
||||||
|
[u32zstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `char32_t`
|
||||||
|
[cu32zstring](docs/headers.md#user-content-H-zstring) | ☑ | An alias to `basic_zstring` with dynamic extent and a char type of `const char32_t`
|
||||||
|
[**2. Owners**][cg-owners] | |
|
||||||
|
[unique_ptr](docs/headers.md#user-content-H-pointers-unique_ptr) | ☑ | An alias to `std::unique_ptr`
|
||||||
|
[shared_ptr](docs/headers.md#user-content-H-pointers-shared_ptr) | ☑ | An alias to `std::shared_ptr`
|
||||||
|
stack_array | ☐ | A stack-allocated array
|
||||||
|
dyn_array | ☐ | A heap-allocated array
|
||||||
|
[**3. Assertions**][cg-assertions] | |
|
||||||
|
[Expects](docs/headers.md#user-content-H-assert-expects) | ☑ | A precondition assertion; on failure it terminates
|
||||||
|
[Ensures](docs/headers.md#user-content-H-assert-ensures) | ☑ | A postcondition assertion; on failure it terminates
|
||||||
|
[**4. Utilities**][cg-utilities] | |
|
||||||
|
move_owner | ☐ | A helper function that moves one `owner` to the other
|
||||||
|
[byte](docs/headers.md#user-content-H-byte-byte) | ☑ | Either an alias to `std::byte` or a byte type
|
||||||
|
[final_action](docs/headers.md#user-content-H-util-final_action) | ☑ | A RAII style class that invokes a functor on its destruction
|
||||||
|
[finally](docs/headers.md#user-content-H-util-finally) | ☑ | A helper function instantiating [final_action](docs/headers.md#user-content-H-util-final_action)
|
||||||
|
[GSL_SUPPRESS](docs/headers.md#user-content-H-assert-gsl_suppress) | ☑ | A macro that takes an argument and turns it into `[[gsl::suppress(x)]]` or `[[gsl::suppress("x")]]`
|
||||||
|
[[implicit]] | ☐ | A "marker" to put on single-argument constructors to explicitly make them non-explicit
|
||||||
|
[index](docs/headers.md#user-content-H-util-index) | ☑ | A type to use for all container and array indexing (currently an alias for `std::ptrdiff_t`)
|
||||||
|
joining_thread | ☐ | A RAII style version of `std::thread` that joins
|
||||||
|
[narrow](docs/headers.md#user-content-H-narrow-narrow) | ☑ | A checked version of `narrow_cast`; it can throw [narrowing_error](docs/headers.md#user-content-H-narrow-narrowing_error)
|
||||||
|
[narrow_cast](docs/headers.md#user-content-H-util-narrow_cast) | ☑ | A narrowing cast for values and a synonym for `static_cast`
|
||||||
|
[narrowing_error](docs/headers.md#user-content-H-narrow-narrowing_error) | ☑ | A custom exception type thrown by [narrow](docs/headers.md#user-content-H-narrow-narrow)
|
||||||
|
[**5. Concepts**][cg-concepts] | ☐ |
|
||||||
|
|
||||||
|
## The following features do not exist in or have been removed from the C++ Core Guidelines:
|
||||||
|
Feature | Supported? | Description
|
||||||
|
-----------------------------------|:----------:|-------------
|
||||||
|
[strict_not_null](docs/headers.md#user-content-H-pointers-strict_not_null) | ☑ | A stricter version of [not_null](docs/headers.md#user-content-H-pointers-not_null) with explicit constructors
|
||||||
|
multi_span | ☐ | Deprecated. Multi-dimensional span.
|
||||||
|
strided_span | ☐ | Deprecated. Support for this type has been discontinued.
|
||||||
|
basic_string_span | ☐ | Deprecated. Like `span` but for strings with a templated char type
|
||||||
|
string_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `char`
|
||||||
|
cstring_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `const char`
|
||||||
|
wstring_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `wchar_t`
|
||||||
|
cwstring_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `const wchar_t`
|
||||||
|
u16string_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `char16_t`
|
||||||
|
cu16string_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `const char16_t`
|
||||||
|
u32string_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `char32_t`
|
||||||
|
cu32string_span | ☐ | Deprecated. An alias to `basic_string_span` with a char type of `const char32_t`
|
||||||
|
|
||||||
|
This is based on [CppCoreGuidelines semi-specification](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gsl-guidelines-support-library).
|
||||||
|
|
||||||
|
[cg-views]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslview-views
|
||||||
|
[cg-owners]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslowner-ownership-pointers
|
||||||
|
[cg-assertions]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslassert-assertions
|
||||||
|
[cg-utilities]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslutil-utilities
|
||||||
|
[cg-concepts]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#gslconcept-concepts
|
||||||
|
|
||||||
|
# Quick Start
|
||||||
|
## Supported Compilers / Toolsets
|
||||||
|
The GSL officially supports the latest and previous major versions of VS with MSVC & LLVM, GCC, Clang, and XCode with Apple-Clang.
|
||||||
|
Within these two major versions, we try to target the latest minor updates / revisions (although this may be affected by
|
||||||
|
delays between a toolchain's release and when it becomes widely available for use).
|
||||||
|
Below is a table showing the versions currently being tested.
|
||||||
|
|
||||||
|
Compiler |Toolset Versions Currently Tested
|
||||||
|
:------- |--:
|
||||||
|
XCode | 13.2.1 & 12.5.1
|
||||||
|
GCC | 11[^1] & 10[^2]
|
||||||
|
Clang | 12[^2] & 11[^2]
|
||||||
|
Visual Studio with MSVC | VS2022[^3] & VS2019[^4]
|
||||||
|
Visual Studio with LLVM | VS2022[^3] & VS2019[^4]
|
||||||
|
|
||||||
|
|
||||||
|
[^1]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26).
|
||||||
|
[^2]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime).
|
||||||
|
[^3]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2022-Readme.md#visual-studio-enterprise-2022).
|
||||||
|
[^4]: Precise version may be found in the [latest CI results](https://dev.azure.com/cppstat/GSL/_build?definitionId=1&branchFilter=26). Should be the version specified [here](https://github.com/actions/virtual-environments/blob/main/images/win/Windows2019-Readme.md#visual-studio-enterprise-2019).
|
||||||
|
|
||||||
|
---
|
||||||
|
If you successfully port GSL to another platform, we would love to hear from you!
|
||||||
|
- Submit an issue specifying the platform and target.
|
||||||
|
- Consider contributing your changes by filing a pull request with any necessary changes.
|
||||||
|
- If at all possible, add a CI/CD step and add the button to the table below!
|
||||||
|
|
||||||
|
Target | CI/CD Status
|
||||||
|
:------- | -----------:
|
||||||
|
iOS | 
|
||||||
|
Android | 
|
||||||
|
|
||||||
|
Note: These CI/CD steps are run with each pull request, however failures in them are non-blocking.
|
||||||
|
|
||||||
|
## Building the tests
|
||||||
|
To build the tests, you will require the following:
|
||||||
|
|
||||||
|
* [CMake](http://cmake.org), version 3.14 or later to be installed and in your PATH.
|
||||||
|
|
||||||
|
These steps assume the source code of this repository has been cloned into a directory named `c:\GSL`.
|
||||||
|
|
||||||
|
1. Create a directory to contain the build outputs for a particular architecture (we name it `c:\GSL\build-x86` in this example).
|
||||||
|
|
||||||
|
cd GSL
|
||||||
|
md build-x86
|
||||||
|
cd build-x86
|
||||||
|
|
||||||
|
2. Configure CMake to use the compiler of your choice (you can see a list by running `cmake --help`).
|
||||||
|
|
||||||
|
cmake -G "Visual Studio 15 2017" c:\GSL
|
||||||
|
|
||||||
|
3. Build the test suite (in this case, in the Debug configuration, Release is another good choice).
|
||||||
|
|
||||||
|
cmake --build . --config Debug
|
||||||
|
|
||||||
|
4. Run the test suite.
|
||||||
|
|
||||||
|
ctest -C Debug
|
||||||
|
|
||||||
|
All tests should pass - indicating your platform is fully supported and you are ready to use the GSL types!
|
||||||
|
|
||||||
|
## Building GSL - Using vcpkg
|
||||||
|
|
||||||
|
You can download and install GSL using the [vcpkg](https://github.com/Microsoft/vcpkg) dependency manager:
|
||||||
|
|
||||||
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
|
cd vcpkg
|
||||||
|
./bootstrap-vcpkg.sh
|
||||||
|
./vcpkg integrate install
|
||||||
|
vcpkg install ms-gsl
|
||||||
|
|
||||||
|
The GSL port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
|
||||||
|
|
||||||
|
## Using the libraries
|
||||||
|
As the types are entirely implemented inline in headers, there are no linking requirements.
|
||||||
|
|
||||||
|
You can copy the [gsl](./include/gsl) directory into your source tree so it is available
|
||||||
|
to your compiler, then include the appropriate headers in your program.
|
||||||
|
|
||||||
|
Alternatively set your compiler's *include path* flag to point to the GSL development folder (`c:\GSL\include` in the example above) or installation folder (after running the install). Eg.
|
||||||
|
|
||||||
|
MSVC++
|
||||||
|
|
||||||
|
/I c:\GSL\include
|
||||||
|
|
||||||
|
GCC/clang
|
||||||
|
|
||||||
|
-I$HOME/dev/GSL/include
|
||||||
|
|
||||||
|
Include the library using:
|
||||||
|
|
||||||
|
#include <gsl/gsl>
|
||||||
|
|
||||||
|
## Usage in CMake
|
||||||
|
|
||||||
|
The library provides a Config file for CMake, once installed it can be found via `find_package`.
|
||||||
|
|
||||||
|
Which, when successful, will add library target called `Microsoft.GSL::GSL` which you can use via the usual
|
||||||
|
`target_link_libraries` mechanism.
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
find_package(Microsoft.GSL CONFIG REQUIRED)
|
||||||
|
|
||||||
|
target_link_libraries(foobar PRIVATE Microsoft.GSL::GSL)
|
||||||
|
```
|
||||||
|
|
||||||
|
### FetchContent
|
||||||
|
|
||||||
|
If you are using CMake version 3.11+ you can use the official [FetchContent module](https://cmake.org/cmake/help/latest/module/FetchContent.html).
|
||||||
|
This allows you to easily incorporate GSL into your project.
|
||||||
|
|
||||||
|
```cmake
|
||||||
|
# NOTE: This example uses CMake version 3.14 (FetchContent_MakeAvailable).
|
||||||
|
# Since it streamlines the FetchContent process
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
|
||||||
|
include(FetchContent)
|
||||||
|
|
||||||
|
FetchContent_Declare(GSL
|
||||||
|
GIT_REPOSITORY "https://github.com/microsoft/GSL"
|
||||||
|
GIT_TAG "v4.0.0"
|
||||||
|
GIT_SHALLOW ON
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(GSL)
|
||||||
|
|
||||||
|
target_link_libraries(foobar PRIVATE Microsoft.GSL::GSL)
|
||||||
|
```
|
||||||
|
|
||||||
|
## Debugging visualization support
|
||||||
|
|
||||||
|
For Visual Studio users, the file [GSL.natvis](./GSL.natvis) in the root directory of the repository can be added to your project if you would like more helpful visualization of GSL types in the Visual Studio debugger than would be offered by default.
|
41
deps/GSL/SECURITY.md
vendored
Normal file
41
deps/GSL/SECURITY.md
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
<!-- BEGIN MICROSOFT SECURITY.MD V0.0.7 BLOCK -->
|
||||||
|
|
||||||
|
## Security
|
||||||
|
|
||||||
|
Microsoft takes the security of our software products and services seriously, which includes all source code repositories managed through our GitHub organizations, which include [Microsoft](https://github.com/Microsoft), [Azure](https://github.com/Azure), [DotNet](https://github.com/dotnet), [AspNet](https://github.com/aspnet), [Xamarin](https://github.com/xamarin), and [our GitHub organizations](https://opensource.microsoft.com/).
|
||||||
|
|
||||||
|
If you believe you have found a security vulnerability in any Microsoft-owned repository that meets [Microsoft's definition of a security vulnerability](https://aka.ms/opensource/security/definition), please report it to us as described below.
|
||||||
|
|
||||||
|
## Reporting Security Issues
|
||||||
|
|
||||||
|
**Please do not report security vulnerabilities through public GitHub issues.**
|
||||||
|
|
||||||
|
Instead, please report them to the Microsoft Security Response Center (MSRC) at [https://msrc.microsoft.com/create-report](https://aka.ms/opensource/security/create-report).
|
||||||
|
|
||||||
|
If you prefer to submit without logging in, send email to [secure@microsoft.com](mailto:secure@microsoft.com). If possible, encrypt your message with our PGP key; please download it from the [Microsoft Security Response Center PGP Key page](https://aka.ms/opensource/security/pgpkey).
|
||||||
|
|
||||||
|
You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Additional information can be found at [microsoft.com/msrc](https://aka.ms/opensource/security/msrc).
|
||||||
|
|
||||||
|
Please include the requested information listed below (as much as you can provide) to help us better understand the nature and scope of the possible issue:
|
||||||
|
|
||||||
|
* Type of issue (e.g. buffer overflow, SQL injection, cross-site scripting, etc.)
|
||||||
|
* Full paths of source file(s) related to the manifestation of the issue
|
||||||
|
* The location of the affected source code (tag/branch/commit or direct URL)
|
||||||
|
* Any special configuration required to reproduce the issue
|
||||||
|
* Step-by-step instructions to reproduce the issue
|
||||||
|
* Proof-of-concept or exploit code (if possible)
|
||||||
|
* Impact of the issue, including how an attacker might exploit the issue
|
||||||
|
|
||||||
|
This information will help us triage your report more quickly.
|
||||||
|
|
||||||
|
If you are reporting for a bug bounty, more complete reports can contribute to a higher bounty award. Please visit our [Microsoft Bug Bounty Program](https://aka.ms/opensource/security/bounty) page for more details about our active programs.
|
||||||
|
|
||||||
|
## Preferred Languages
|
||||||
|
|
||||||
|
We prefer all communications to be in English.
|
||||||
|
|
||||||
|
## Policy
|
||||||
|
|
||||||
|
Microsoft follows the principle of [Coordinated Vulnerability Disclosure](https://aka.ms/opensource/security/cvd).
|
||||||
|
|
||||||
|
<!-- END MICROSOFT SECURITY.MD BLOCK -->
|
41
deps/GSL/ThirdPartyNotices.txt
vendored
Normal file
41
deps/GSL/ThirdPartyNotices.txt
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
|
||||||
|
THIRD-PARTY SOFTWARE NOTICES AND INFORMATION
|
||||||
|
Do Not Translate or Localize
|
||||||
|
|
||||||
|
GSL: Guidelines Support Library incorporates third party material from the projects listed below.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
Software: Google Test
|
||||||
|
Owner: Google Inc.
|
||||||
|
Source URL: github.com/google/googletest
|
||||||
|
License: BSD 3 - Clause
|
||||||
|
Text:
|
||||||
|
Copyright 2008, Google Inc.
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are
|
||||||
|
met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above
|
||||||
|
copyright notice, this list of conditions and the following disclaimer
|
||||||
|
in the documentation and/or other materials provided with the
|
||||||
|
distribution.
|
||||||
|
* Neither the name of Google Inc. nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived from
|
||||||
|
this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||||
|
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||||
|
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||||
|
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||||
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||||
|
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||||
|
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||||
|
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||||
|
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
-------------------------------------------------------------------------------
|
66
deps/GSL/azure-pipelines.yml
vendored
Normal file
66
deps/GSL/azure-pipelines.yml
vendored
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
trigger:
|
||||||
|
- main
|
||||||
|
|
||||||
|
pr:
|
||||||
|
autoCancel: true
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- stage: GCC
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: gcc
|
||||||
|
image: ubuntu-20.04
|
||||||
|
compilerVersions: [ 11, 10 ]
|
||||||
|
setupfile: 'setup_gcc.yml'
|
||||||
|
|
||||||
|
- stage: Clang
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: clang
|
||||||
|
image: ubuntu-20.04
|
||||||
|
compilerVersions: [ 12, 11 ]
|
||||||
|
setupfile: 'setup_clang.yml'
|
||||||
|
|
||||||
|
- stage: Xcode
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'Xcode'
|
||||||
|
image: macOS-11
|
||||||
|
compilerVersions: [ '12.5.1', '13.2.1' ]
|
||||||
|
setupfile: 'setup_apple.yml'
|
||||||
|
|
||||||
|
- stage: VS_MSVC
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2019 (MSVC)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2019
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2022 (MSVC)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2022
|
||||||
|
|
||||||
|
- stage: VS_LLVM
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2019 (LLVM)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2019
|
||||||
|
extraCmakeArgs: '-T ClangCL'
|
||||||
|
- template: ./pipelines/jobs.yml
|
||||||
|
parameters:
|
||||||
|
compiler: 'VS2022 (LLVM)'
|
||||||
|
compilerVersions: [ 'default' ]
|
||||||
|
image: windows-2022
|
||||||
|
extraCmakeArgs: '-T ClangCL'
|
853
deps/GSL/docs/headers.md
vendored
Normal file
853
deps/GSL/docs/headers.md
vendored
Normal file
@ -0,0 +1,853 @@
|
|||||||
|
The Guidelines Support Library (GSL) interface is very lightweight and exposed via a header-only library. This document attempts to document all of the headers and their exposed classes and functions.
|
||||||
|
|
||||||
|
Types and functions are exported in the namespace `gsl`.
|
||||||
|
|
||||||
|
See [GSL: Guidelines support library](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-gsl)
|
||||||
|
|
||||||
|
# <a name="H" />Headers
|
||||||
|
|
||||||
|
- [`<algorithms>`](#user-content-H-algorithms)
|
||||||
|
- [`<assert>`](#user-content-H-assert)
|
||||||
|
- [`<byte>`](#user-content-H-byte)
|
||||||
|
- [`<gsl>`](#user-content-H-gsl)
|
||||||
|
- [`<narrow>`](#user-content-H-narrow)
|
||||||
|
- [`<pointers>`](#user-content-H-pointers)
|
||||||
|
- [`<span>`](#user-content-H-span)
|
||||||
|
- [`<span_ext>`](#user-content-H-span_ext)
|
||||||
|
- [`<zstring>`](#user-content-H-zstring)
|
||||||
|
- [`<util>`](#user-content-H-util)
|
||||||
|
|
||||||
|
## <a name="H-algorithms" />`<algorithms>`
|
||||||
|
|
||||||
|
This header contains some common algorithms that have been wrapped in GSL safety features.
|
||||||
|
|
||||||
|
- [`gsl::copy`](#user-content-H-algorithms-copy)
|
||||||
|
|
||||||
|
### <a name="H-algorithms-copy" />`gsl::copy`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class SrcElementType, std::size_t SrcExtent, class DestElementType,
|
||||||
|
std::size_t DestExtent>
|
||||||
|
void copy(span<SrcElementType, SrcExtent> src, span<DestElementType, DestExtent> dest);
|
||||||
|
```
|
||||||
|
|
||||||
|
This function copies the content from the `src` [`span`](#user-content-H-span-span) to the `dest` [`span`](#user-content-H-span-span). It [`Expects`](#user-content-H-assert-expects)
|
||||||
|
that the destination `span` is at least as large as the source `span`.
|
||||||
|
|
||||||
|
## <a name="H-assert" />`<assert>`
|
||||||
|
|
||||||
|
This header contains some macros used for contract checking and suppressing code analysis warnings.
|
||||||
|
|
||||||
|
See [GSL.assert: Assertions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-assertions)
|
||||||
|
|
||||||
|
- [`GSL_SUPPRESS`](#user-content-H-assert-gsl_suppress)
|
||||||
|
- [`Expects`](#user-content-H-assert-expects)
|
||||||
|
- [`Ensures`](#user-content-H-assert-ensures)
|
||||||
|
|
||||||
|
### <a name="H-assert-gsl_suppress" />`GSL_SUPPRESS`
|
||||||
|
|
||||||
|
This macro can be used to suppress a code analysis warning.
|
||||||
|
|
||||||
|
The core guidelines request tools that check for the rules to respect suppressing a rule by writing
|
||||||
|
`[[gsl::suppress(tag)]]` or `[[gsl::suppress(tag, justification: "message")]]`.
|
||||||
|
|
||||||
|
Clang does not use exactly that syntax, but requires `tag` to be put in double quotes `[[gsl::suppress("tag")]]`.
|
||||||
|
|
||||||
|
For portable code you can use `GSL_SUPPRESS(tag)`.
|
||||||
|
|
||||||
|
See [In.force: Enforcement](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#inforce-enforcement).
|
||||||
|
|
||||||
|
### <a name="H-assert-expects" />`Expects`
|
||||||
|
|
||||||
|
This macro can be used for expressing a precondition. If the precondition is not held, then `std::terminate` will be called.
|
||||||
|
|
||||||
|
See [I.6: Prefer `Expects()` for expressing preconditions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#i6-prefer-expects-for-expressing-preconditions)
|
||||||
|
|
||||||
|
### <a name="H-assert-ensures" />`Ensures`
|
||||||
|
|
||||||
|
This macro can be used for expressing a postcondition. If the postcondition is not held, then `std::terminate` will be called.
|
||||||
|
|
||||||
|
See [I.8: Prefer `Ensures()` for expressing postconditions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#i8-prefer-ensures-for-expressing-postconditions)
|
||||||
|
|
||||||
|
## <a name="H-byte" />`<byte>`
|
||||||
|
|
||||||
|
This header contains the definition of a byte type, implementing `std::byte` before it was standardized into C++17.
|
||||||
|
|
||||||
|
- [`gsl::byte`](#user-content-H-byte-byte)
|
||||||
|
|
||||||
|
### <a name="H-byte-byte" />`gsl::byte`
|
||||||
|
|
||||||
|
If `GSL_USE_STD_BYTE` is defined to be `1`, then `gsl::byte` will be an alias to `std::byte`.
|
||||||
|
If `GSL_USE_STD_BYTE` is defined to be `0`, then `gsl::byte` will be a distinct type that implements the concept of byte.
|
||||||
|
If `GSL_USE_STD_BYTE` is not defined, then the header file will check if `std::byte` is available (C\+\+17 or higher). If yes,
|
||||||
|
`gsl::byte` will be an alias to `std::byte`, otherwise `gsl::byte` will be a distinct type that implements the concept of byte.
|
||||||
|
|
||||||
|
⚠ Take care when linking projects that were compiled with different language standards (before C\+\+17 and C\+\+17 or higher).
|
||||||
|
If you do so, you might want to `#define GSL_USE_STD_BYTE 0` to a fixed value to be sure that both projects use exactly
|
||||||
|
the same type. Otherwise you might get linker errors.
|
||||||
|
|
||||||
|
See [SL.str.5: Use `std::byte` to refer to byte values that do not necessarily represent characters](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rstr-byte)
|
||||||
|
|
||||||
|
### Non-member functions
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept;
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte operator<<(byte b, IntegerType shift) noexcept;
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept;
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte operator>>(byte b, IntegerType shift) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Left or right shift a `byte` by a given number of bits.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr byte& operator|=(byte& l, byte r) noexcept;
|
||||||
|
constexpr byte operator|(byte l, byte r) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Bitwise "or" of two `byte`s.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr byte& operator&=(byte& l, byte r) noexcept;
|
||||||
|
constexpr byte operator&(byte l, byte r) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Bitwise "and" of two `byte`s.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr byte& operator^=(byte& l, byte r) noexcept;
|
||||||
|
constexpr byte operator^(byte l, byte r) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Bitwise xor of two `byte`s.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr byte operator~(byte b) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Bitwise negation of a `byte`. Flips all bits. Zeroes become ones, ones become zeroes.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <typename T>
|
||||||
|
constexpr byte to_byte(T t) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Convert the given value to a `byte`. The template requires `T` to be an `unsigned char` so that no data loss can occur.
|
||||||
|
If you want to convert an integer constant to a `byte` you probably want to call `to_byte<integer constant>()`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <int I>
|
||||||
|
constexpr byte to_byte() noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Convert the given value `I` to a `byte`. The template requires `I` to be in the valid range 0..255 for a `gsl::byte`.
|
||||||
|
|
||||||
|
## <a name="H-gsl" />`<gsl>`
|
||||||
|
|
||||||
|
This header is a convenience header that includes all other [GSL headers](#user-content-H).
|
||||||
|
Since `<narrow>` requires exceptions, it will only be included if exceptions are enabled.
|
||||||
|
|
||||||
|
## <a name="H-narrow" />`<narrow>`
|
||||||
|
|
||||||
|
This header contains utility functions and classes, for narrowing casts, which require exceptions. The narrowing-related utilities that don't require exceptions are found inside [util](#user-content-H-util).
|
||||||
|
|
||||||
|
See [GSL.util: Utilities](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-utilities)
|
||||||
|
|
||||||
|
- [`gsl::narrowing_error`](#user-content-H-narrow-narrowing_error)
|
||||||
|
- [`gsl::narrow`](#user-content-H-narrow-narrow)
|
||||||
|
|
||||||
|
### <a name="H-narrow-narrowing_error" />`gsl::narrowing_error`
|
||||||
|
|
||||||
|
`gsl::narrowing_error` is the exception thrown by [`gsl::narrow`](#user-content-H-narrow-narrow) when a narrowing conversion fails. It is derived from `std::exception`.
|
||||||
|
|
||||||
|
### <a name="H-narrow-narrow" />`gsl::narrow`
|
||||||
|
|
||||||
|
`gsl::narrow<T>(x)` is a named cast that does a `static_cast<T>(x)` for narrowing conversions with no signedness promotions.
|
||||||
|
If the argument `x` cannot be represented in the target type `T`, then the function throws a [`gsl::narrowing_error`](#user-content-H-narrow-narrowing_error) (e.g., `narrow<unsigned>(-42)` and `narrow<char>(300)` throw).
|
||||||
|
|
||||||
|
Note: compare [`gsl::narrow_cast`](#user-content-H-util-narrow_cast) in header [util](#user-content-H-util).
|
||||||
|
|
||||||
|
See [ES.46: Avoid lossy (narrowing, truncating) arithmetic conversions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-narrowing) and [ES.49: If you must use a cast, use a named cast](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts-named)
|
||||||
|
|
||||||
|
## <a name="H-pointers" />`<pointers>`
|
||||||
|
|
||||||
|
This header contains some pointer types.
|
||||||
|
|
||||||
|
See [GSL.view](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-views)
|
||||||
|
|
||||||
|
- [`gsl::unique_ptr`](#user-content-H-pointers-unique_ptr)
|
||||||
|
- [`gsl::shared_ptr`](#user-content-H-pointers-shared_ptr)
|
||||||
|
- [`gsl::owner`](#user-content-H-pointers-owner)
|
||||||
|
- [`gsl::not_null`](#user-content-H-pointers-not_null)
|
||||||
|
- [`gsl::strict_not_null`](#user-content-H-pointers-strict_not_null)
|
||||||
|
|
||||||
|
### <a name="H-pointers-unique_ptr" />`gsl::unique_ptr`
|
||||||
|
|
||||||
|
`gsl::unique_ptr` is an alias to `std::unique_ptr`.
|
||||||
|
|
||||||
|
See [GSL.owner: Ownership pointers](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-ownership)
|
||||||
|
|
||||||
|
### <a name="H-pointers-shared_ptr" />`gsl::shared_ptr`
|
||||||
|
|
||||||
|
`gsl::shared_ptr` is an alias to `std::shared_ptr`.
|
||||||
|
|
||||||
|
See [GSL.owner: Ownership pointers](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-ownership)
|
||||||
|
|
||||||
|
### <a name="H-pointers-owner" />`gsl::owner`
|
||||||
|
|
||||||
|
`gsl::owner<T>` is designed as a safety mechanism for code that must deal directly with raw pointers that own memory. Ideally such code should be restricted to the implementation of low-level abstractions. `gsl::owner` can also be used as a stepping point in converting legacy code to use more modern RAII constructs such as smart pointers.
|
||||||
|
`T` must be a pointer type (`std::is_pointer<T>`).
|
||||||
|
|
||||||
|
A `gsl::owner<T>` is a typedef to `T`. It adds no runtime overhead whatsoever, as it is purely syntactic and does not add any runtime checks. Instead, it serves as an annotation for static analysis tools which check for memory safety, and as a code comprehension guide for human readers.
|
||||||
|
|
||||||
|
See Enforcement section of [C.31: All resources acquired by a class must be released by the class’s destructor](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rc-dtor-release).
|
||||||
|
|
||||||
|
### <a name="H-pointers-not_null" />`gsl::not_null`
|
||||||
|
|
||||||
|
`gsl::not_null<T>` restricts a pointer or smart pointer to only hold non-null values. It has no size overhead over `T`.
|
||||||
|
|
||||||
|
The checks for ensuring that the pointer is not null are done in the constructor. There is no overhead when retrieving or dereferencing the checked pointer.
|
||||||
|
When a nullptr check fails, `std::terminate` is called.
|
||||||
|
|
||||||
|
See [F.23: Use a `not_null<T>` to indicate that “null” is not a valid value](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-nullptr)
|
||||||
|
|
||||||
|
#### Member functions
|
||||||
|
|
||||||
|
##### Construct/Copy
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr not_null(U&& u);
|
||||||
|
|
||||||
|
template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>>
|
||||||
|
constexpr not_null(T u);
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `gsl_owner<T>` from a pointer that is convertible to `T` or that is a `T`. It [`Expects`](#user-content-H-assert-expects) that the provided pointer is not `== nullptr`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr not_null(const not_null<U>& other);
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `gsl_owner<T>` from another `gsl_owner` where the other pointer is convertible to `T`. It [`Expects`](#user-content-H-assert-expects) that the provided pointer is not `== nullptr`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
not_null(const not_null& other) = default;
|
||||||
|
not_null& operator=(const not_null& other) = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy construction and assignment.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
not_null(std::nullptr_t) = delete;
|
||||||
|
not_null& operator=(std::nullptr_t) = delete;
|
||||||
|
```
|
||||||
|
|
||||||
|
Construction from `std::nullptr_t` and assignment of `std::nullptr_t` are explicitly deleted.
|
||||||
|
|
||||||
|
##### Modifiers
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
not_null& operator++() = delete;
|
||||||
|
not_null& operator--() = delete;
|
||||||
|
not_null operator++(int) = delete;
|
||||||
|
not_null operator--(int) = delete;
|
||||||
|
not_null& operator+=(std::ptrdiff_t) = delete;
|
||||||
|
not_null& operator-=(std::ptrdiff_t) = delete;
|
||||||
|
```
|
||||||
|
|
||||||
|
Explicitly deleted operators. Pointers point to single objects ([I.13: Do not pass an array as a single pointer](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ri-array)), so don't allow these operators.
|
||||||
|
|
||||||
|
##### Observers
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr details::value_or_reference_return_t<T> get() const;
|
||||||
|
constexpr operator T() const { return get(); }
|
||||||
|
```
|
||||||
|
|
||||||
|
Get the underlying pointer.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr decltype(auto) operator->() const { return get(); }
|
||||||
|
constexpr decltype(auto) operator*() const { return *get(); }
|
||||||
|
```
|
||||||
|
|
||||||
|
Dereference the underlying pointer.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
void operator[](std::ptrdiff_t) const = delete;
|
||||||
|
```
|
||||||
|
|
||||||
|
Array index operator is explicitly deleted. Pointers point to single objects ([I.13: Do not pass an array as a single pointer](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ri-array)), so don't allow treating them as an array.
|
||||||
|
|
||||||
|
#### Non-member functions
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T>
|
||||||
|
auto make_not_null(T&& t) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates a `gsl::not_null` object, deducing the target type from the type of the argument.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator==(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() == rhs.get()))
|
||||||
|
-> decltype(lhs.get() == rhs.get());
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator!=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() != rhs.get()))
|
||||||
|
-> decltype(lhs.get() != rhs.get());
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator<(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() < rhs.get()))
|
||||||
|
-> decltype(lhs.get() < rhs.get());
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator<=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() <= rhs.get()))
|
||||||
|
-> decltype(lhs.get() <= rhs.get());
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator>(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() > rhs.get()))
|
||||||
|
-> decltype(lhs.get() > rhs.get());
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator>=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() >= rhs.get()))
|
||||||
|
-> decltype(lhs.get() >= rhs.get());
|
||||||
|
```
|
||||||
|
|
||||||
|
Comparison of pointers that are convertible to each other.
|
||||||
|
|
||||||
|
##### Input/Output
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T>
|
||||||
|
std::ostream& operator<<(std::ostream& os, const not_null<T>& val);
|
||||||
|
```
|
||||||
|
|
||||||
|
Performs stream output on a `not_null` pointer, invoking `os << val.get()`. This function is only available when `GSL_NO_IOSTREAMS` is not defined.
|
||||||
|
|
||||||
|
##### Modifiers
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T, class U>
|
||||||
|
std::ptrdiff_t operator-(const not_null<T>&, const not_null<U>&) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator-(const not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator+(const not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator+(std::ptrdiff_t, const not_null<T>&) = delete;
|
||||||
|
```
|
||||||
|
|
||||||
|
Addition and subtraction are explicitly deleted. Pointers point to single objects ([I.13: Do not pass an array as a single pointer](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Ri-array)), so don't allow these operators.
|
||||||
|
|
||||||
|
##### STL integration
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T>
|
||||||
|
struct std::hash<gsl::not_null<T>> { ... };
|
||||||
|
```
|
||||||
|
|
||||||
|
Specialization of `std::hash` for `gsl::not_null`.
|
||||||
|
|
||||||
|
### <a name="H-pointers-strict_not_null" />`gsl::strict_not_null`
|
||||||
|
|
||||||
|
`strict_not_null` is the same as [`not_null`](#user-content-H-pointers-not_null) except that the constructors are `explicit`.
|
||||||
|
|
||||||
|
The free function that deduces the target type from the type of the argument and creates a `gsl::strict_not_null` object is `gsl::make_strict_not_null`.
|
||||||
|
|
||||||
|
## <a name="H-span" />`<span>`
|
||||||
|
|
||||||
|
This header file exports the class `gsl::span`, a bounds-checked implementation of `std::span`.
|
||||||
|
|
||||||
|
- [`gsl::span`](#user-content-H-span-span)
|
||||||
|
|
||||||
|
### <a name="H-span-span" />`gsl::span`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
class span;
|
||||||
|
```
|
||||||
|
|
||||||
|
`gsl::span` is a view over memory. It does not own the memory and is only a way to access contiguous sequences of objects.
|
||||||
|
The extent can be either a fixed size or [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent).
|
||||||
|
|
||||||
|
The `gsl::span` is based on the standardized version of `std::span` which was added to C++20. Originally, the plan was to
|
||||||
|
deprecate `gsl::span` when `std::span` finished standardization, however that plan changed when the runtime bounds checking
|
||||||
|
was removed from `std::span`'s design.
|
||||||
|
|
||||||
|
The only difference between `gsl::span` and `std::span` is that `gsl::span` strictly enforces runtime bounds checking.
|
||||||
|
Any violations of the bounds check results in termination of the program.
|
||||||
|
Like `gsl::span`, `gsl::span`'s iterators also differ from `std::span`'s iterator in that all access operations are bounds checked.
|
||||||
|
|
||||||
|
#### Which version of span should I use?
|
||||||
|
|
||||||
|
##### Use `gsl::span` if
|
||||||
|
|
||||||
|
- you want to guarantee bounds safety in your project.
|
||||||
|
- All data accessing operations use bounds checking to ensure you are only accessing valid memory.
|
||||||
|
- your project uses C++14 or C++17.
|
||||||
|
- `std::span` is not available as it was not introduced into the STL until C++20.
|
||||||
|
|
||||||
|
##### Use `std::span` if
|
||||||
|
|
||||||
|
- your project is C++20 and you need the performance offered by `std::span`.
|
||||||
|
|
||||||
|
#### Types
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
using element_type = ElementType;
|
||||||
|
using value_type = std::remove_cv_t<ElementType>;
|
||||||
|
using size_type = std::size_t;
|
||||||
|
using pointer = element_type*;
|
||||||
|
using const_pointer = const element_type*;
|
||||||
|
using reference = element_type&;
|
||||||
|
using const_reference = const element_type&;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
|
||||||
|
using iterator = details::span_iterator<ElementType>;
|
||||||
|
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Member functions
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr span() noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs an empty `span`. This constructor is only available if `Extent` is 0 or [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent).
|
||||||
|
`span::data()` will return `nullptr`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr explicit(Extent != gsl::dynamic_extent) span(pointer ptr, size_type count) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from a pointer and a size. If `Extent` is not [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent),
|
||||||
|
then the constructor [`Expects`](#user-content-H-assert-expects) that `count == Extent`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr explicit(Extent != gsl::dynamic_extent) span(pointer firstElem, pointer lastElem) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from a pointer to the begin and the end of the data. If `Extent` is not [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent),
|
||||||
|
then the constructor [`Expects`](#user-content-H-assert-expects) that `lastElem - firstElem == Extent`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <std::size_t N>
|
||||||
|
constexpr span(element_type (&arr)[N]) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from a C style array. This overload is available if `Extent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)
|
||||||
|
or `N == Extent`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T, std::size_t N>
|
||||||
|
constexpr span(std::array<T, N>& arr) noexcept;
|
||||||
|
|
||||||
|
template <class T, std::size_t N>
|
||||||
|
constexpr span(const std::array<T, N>& arr) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from a `std::array`. These overloads are available if `Extent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)
|
||||||
|
or `N == Extent`, and if the array can be interpreted as a `ElementType` array.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class Container>
|
||||||
|
constexpr explicit(Extent != gsl::dynamic_extent) span(Container& cont) noexcept;
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
constexpr explicit(Extent != gsl::dynamic_extent) span(const Container& cont) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from a container. These overloads are available if `Extent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)
|
||||||
|
or `N == Extent`, and if the container can be interpreted as a contiguous `ElementType` array.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr span(const span& other) noexcept = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy constructor.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class OtherElementType, std::size_t OtherExtent>
|
||||||
|
explicit(Extent != gsl::dynamic_extent && OtherExtent == dynamic_extent)
|
||||||
|
constexpr span(const span<OtherElementType, OtherExtent>& other) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Constructs a `span` from another `span`. This constructor is available if `OtherExtent == Extent || Extent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)` || OtherExtent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)
|
||||||
|
and if `ElementType` and `OtherElementType` are compatible.
|
||||||
|
|
||||||
|
If `Extent !=`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) and `OtherExtent ==`[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent),
|
||||||
|
then the constructor [`Expects`](#user-content-H-assert-expects) that `other.size() == Extent`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr span& operator=(const span& other) noexcept = default;
|
||||||
|
```
|
||||||
|
|
||||||
|
Copy assignment
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <std::size_t Count>
|
||||||
|
constexpr span<element_type, Count> first() const noexcept;
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent> first(size_type count) const noexcept;
|
||||||
|
|
||||||
|
template <std::size_t Count>
|
||||||
|
constexpr span<element_type, Count> last() const noexcept;
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent> last(size_type count) const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Return a subspan of the first/last `Count` elements. [`Expects`](#user-content-H-assert-expects) that `Count` does not exceed the `span`'s size.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <std::size_t offset, std::size_t count = dynamic_extent>
|
||||||
|
constexpr auto subspan() const noexcept;
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent>
|
||||||
|
subspan(size_type offset, size_type count = dynamic_extent) const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Return a subspan starting at `offset` and having size `count`. [`Expects`](#user-content-H-assert-expects) that `offset` does not exceed the `span`'s size,
|
||||||
|
and that `offset == `[`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) or `offset + count` does not exceed the `span`'s size.
|
||||||
|
If `count` is `gsl::dynamic_extent`, the number of elements in the subspan is `size() - offset`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr size_type size() const noexcept;
|
||||||
|
|
||||||
|
constexpr size_type size_bytes() const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns the size respective the size in bytes of the `span`.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr bool empty() const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Is the `span` empty?
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr reference operator[](size_type idx) const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns a reference to the element at the given index. [`Expects`](#user-content-H-assert-expects) that `idx` is less than the `span`'s size.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr reference front() const noexcept;
|
||||||
|
constexpr reference back() const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns a reference to the first/last element in the `span`. [`Expects`](#user-content-H-assert-expects) that the `span` is not empty.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr pointer data() const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns a pointer to the beginning of the contained data.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
constexpr iterator begin() const noexcept;
|
||||||
|
constexpr iterator end() const noexcept;
|
||||||
|
constexpr reverse_iterator rbegin() const noexcept;
|
||||||
|
constexpr reverse_iterator rend() const noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Returns an iterator to the first/last normal/reverse iterator.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class Type, std::size_t Extent>
|
||||||
|
span(Type (&)[Extent]) -> span<Type, Extent>;
|
||||||
|
|
||||||
|
template <class Type, std::size_t Size>
|
||||||
|
span(std::array<Type, Size>&) -> span<Type, Size>;
|
||||||
|
|
||||||
|
template <class Type, std::size_t Size>
|
||||||
|
span(const std::array<Type, Size>&) -> span<const Type, Size>;
|
||||||
|
|
||||||
|
template <class Container,
|
||||||
|
class Element = std::remove_pointer_t<decltype(std::declval<Container&>().data())>>
|
||||||
|
span(Container&) -> span<Element>;
|
||||||
|
|
||||||
|
template <class Container,
|
||||||
|
class Element = std::remove_pointer_t<decltype(std::declval<const Container&>().data())>>
|
||||||
|
span(const Container&) -> span<Element>;
|
||||||
|
```
|
||||||
|
|
||||||
|
Deduction guides.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
span<const byte, details::calculate_byte_size<ElementType, Extent>::value>
|
||||||
|
as_bytes(span<ElementType, Extent> s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
span<byte, details::calculate_byte_size<ElementType, Extent>::value>
|
||||||
|
as_writable_bytes(span<ElementType, Extent> s) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Converts a `span` into a `span` of `byte`s.
|
||||||
|
|
||||||
|
`as_writable_bytes` will only be available for non-const `ElementType`s.
|
||||||
|
|
||||||
|
## <a name="H-span_ext" />`<span_ext>`
|
||||||
|
|
||||||
|
This file is a companion for and included by [`<gsl/span>`](#user-content-H-span), and should not be used on its own. It contains useful features that aren't part of the `std::span` API as found inside the STL `<span>` header (with the exception of [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent), which is included here due to implementation constraints).
|
||||||
|
|
||||||
|
- [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent)
|
||||||
|
- [`gsl::span`](#user-content-H-span_ext-span)
|
||||||
|
- [`gsl::span` comparison operators](#user-content-H-span_ext-span_comparison_operators)
|
||||||
|
- [`gsl::make_span`](#user-content-H-span_ext-make_span)
|
||||||
|
- [`gsl::at`](#user-content-H-span_ext-at)
|
||||||
|
- [`gsl::ssize`](#user-content-H-span_ext-ssize)
|
||||||
|
- [`gsl::span` iterator functions](#user-content-H-span_ext-span_iterator_functions)
|
||||||
|
|
||||||
|
### <a name="H-span_ext-dynamic_extent" />`gsl::dynamic_extent`
|
||||||
|
|
||||||
|
Defines the extent value to be used by all `gsl::span` with dynamic extent.
|
||||||
|
|
||||||
|
Note: `std::dynamic_extent` is exposed by the STL `<span>` header and so ideally `gsl::dynamic_extent` would be under [`<gsl/span>`](#user-content-H-span), but to avoid cyclic dependency issues it is under `<span_ext>` instead.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-span" />`gsl::span`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
class span;
|
||||||
|
```
|
||||||
|
|
||||||
|
Forward declaration of `gsl::span`.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-span_comparison_operators" />`gsl::span` comparison operators
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t FirstExtent, std::size_t SecondExtent>
|
||||||
|
constexpr bool operator==(span<ElementType, FirstExtent> l, span<ElementType, SecondExtent> r);
|
||||||
|
template <class ElementType, std::size_t FirstExtent, std::size_t SecondExtent>
|
||||||
|
constexpr bool operator!=(span<ElementType, FirstExtent> l, span<ElementType, SecondExtent> r);
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator<(span<ElementType, Extent> l, span<ElementType, Extent> r);
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator<=(span<ElementType, Extent> l, span<ElementType, Extent> r);
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator>(span<ElementType, Extent> l, span<ElementType, Extent> r);
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator>=(span<ElementType, Extent> l, span<ElementType, Extent> r);
|
||||||
|
```
|
||||||
|
|
||||||
|
The comparison operators for two `span`s lexicographically compare the elements in the `span`s.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-make_span" />`gsl::make_span`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType>
|
||||||
|
constexpr span<ElementType> make_span(ElementType* ptr, typename span<ElementType>::size_type count);
|
||||||
|
template <class ElementType>
|
||||||
|
constexpr span<ElementType> make_span(ElementType* firstElem, ElementType* lastElem);
|
||||||
|
template <class ElementType, std::size_t N>
|
||||||
|
constexpr span<ElementType, N> make_span(ElementType (&arr)[N]) noexcept;
|
||||||
|
template <class Container>
|
||||||
|
constexpr span<typename Container::value_type> make_span(Container& cont);
|
||||||
|
template <class Container>
|
||||||
|
constexpr span<const typename Container::value_type> make_span(const Container& cont);
|
||||||
|
template <class Ptr>
|
||||||
|
constexpr span<typename Ptr::element_type> make_span(Ptr& cont, std::size_t count);
|
||||||
|
template <class Ptr>
|
||||||
|
constexpr span<typename Ptr::element_type> make_span(Ptr& cont);
|
||||||
|
```
|
||||||
|
|
||||||
|
Utility function for creating a `span` with [`gsl::dynamic_extent`](#user-content-H-span_ext-dynamic_extent) from
|
||||||
|
- pointer and length,
|
||||||
|
- pointer to start and pointer to end,
|
||||||
|
- a C style array, or
|
||||||
|
- a container.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-at" />`gsl::at`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr ElementType& at(span<ElementType, Extent> s, index i);
|
||||||
|
```
|
||||||
|
|
||||||
|
The function `gsl::at` offers a safe way to access data with index bounds checking.
|
||||||
|
|
||||||
|
This is the specialization of [`gsl::at`](#user-content-H-util-at) for [`span`](#user-content-H-span-span). It returns a reference to the `i`th element and
|
||||||
|
[`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the `span`.
|
||||||
|
|
||||||
|
Note: `gsl::at` supports indexes up to `PTRDIFF_MAX`.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-ssize" />`gsl::ssize`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr std::ptrdiff_t ssize(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Return the size of a [`span`](#user-content-H-span-span) as a `ptrdiff_t`.
|
||||||
|
|
||||||
|
### <a name="H-span_ext-span_iterator_functions" />`gsl::span` iterator functions
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
begin(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
end(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
rbegin(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
rend(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
cbegin(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
cend(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
crbegin(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
crend(const span<ElementType, Extent>& s) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Free functions for getting a non-const/const begin/end normal/reverse iterator for a [`span`](#user-content-H-span-span).
|
||||||
|
|
||||||
|
## <a name="H-zstring" />`<zstring>`
|
||||||
|
|
||||||
|
This header exports a family of `*zstring` types.
|
||||||
|
|
||||||
|
A `gsl::XXzstring<T>` is a typedef to `T`. It adds no checks whatsoever, it is just for having a syntax to describe
|
||||||
|
that a pointer points to a zero terminated C style string. This helps static code analysis, and it helps human readers.
|
||||||
|
|
||||||
|
`basic_zstring` is a pointer to a C-string (zero-terminated array) with a templated char type. Used to implement the rest of the `*zstring` family.
|
||||||
|
`zstring` is a zero terminated `char` string.
|
||||||
|
`czstring` is a const zero terminated `char` string.
|
||||||
|
`wzstring` is a zero terminated `wchar_t` string.
|
||||||
|
`cwzstring` is a const zero terminated `wchar_t` string.
|
||||||
|
`u16zstring` is a zero terminated `char16_t` string.
|
||||||
|
`cu16zstring` is a const zero terminated `char16_t` string.
|
||||||
|
`u32zstring` is a zero terminated `char32_t` string.
|
||||||
|
`cu32zstring` is a const zero terminated `char32_t` string.
|
||||||
|
|
||||||
|
See [GSL.view](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-views) and [SL.str.3: Use zstring or czstring to refer to a C-style, zero-terminated, sequence of characters](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rstr-zstring).
|
||||||
|
|
||||||
|
## <a name="H-util" />`<util>`
|
||||||
|
|
||||||
|
This header contains utility functions and classes. This header works without exceptions being available. The parts that require
|
||||||
|
exceptions being available are in their own header file [narrow](#user-content-H-narrow).
|
||||||
|
|
||||||
|
See [GSL.util: Utilities](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#SS-utilities)
|
||||||
|
|
||||||
|
- [`gsl::narrow_cast`](#user-content-H-util-narrow_cast)
|
||||||
|
- [`gsl::final_action`](#user-content-H-util-final_action)
|
||||||
|
- [`gsl::at`](#user-content-H-util-at)
|
||||||
|
|
||||||
|
### <a name="H-util-index" />`gsl::index`
|
||||||
|
|
||||||
|
An alias to `std::ptrdiff_t`. It serves as the index type for all container indexes/subscripts/sizes.
|
||||||
|
|
||||||
|
### <a name="H-util-narrow_cast" />`gsl::narrow_cast`
|
||||||
|
|
||||||
|
`gsl::narrow_cast<T>(x)` is a named cast that is identical to a `static_cast<T>(x)`. It exists to make clear to static code analysis tools and to human readers that a lossy conversion is acceptable.
|
||||||
|
|
||||||
|
Note: compare the throwing version [`gsl::narrow`](#user-content-H-narrow-narrow) in header [narrow](#user-content-H-narrow).
|
||||||
|
|
||||||
|
See [ES.46: Avoid lossy (narrowing, truncating) arithmetic conversions](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-narrowing) and [ES.49: If you must use a cast, use a named cast](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-casts-named)
|
||||||
|
|
||||||
|
### <a name="H-util-final_action" />`gsl::final_action`
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class F>
|
||||||
|
class final_action { ... };
|
||||||
|
```
|
||||||
|
|
||||||
|
`final_action` allows you to ensure something gets run at the end of a scope.
|
||||||
|
|
||||||
|
See [E.19: Use a final_action object to express cleanup if no suitable resource handle is available](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Re-finally)
|
||||||
|
|
||||||
|
#### Member functions
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
explicit final_action(const F& ff) noexcept;
|
||||||
|
explicit final_action(F&& ff) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Construct an object with the action to invoke in the destructor.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
~final_action() noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
The destructor will call the action that was passed in the constructor.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
final_action(final_action&& other) noexcept;
|
||||||
|
final_action(const final_action&) = delete;
|
||||||
|
void operator=(const final_action&) = delete;
|
||||||
|
void operator=(final_action&&) = delete;
|
||||||
|
```
|
||||||
|
|
||||||
|
Move construction is allowed. Copy construction is deleted. Copy and move assignment are also explicitly deleted.
|
||||||
|
|
||||||
|
#### <a name="H-util-finally" />Non-member functions
|
||||||
|
```cpp
|
||||||
|
template <class F>
|
||||||
|
auto finally(F&& f) noexcept;
|
||||||
|
```
|
||||||
|
|
||||||
|
Creates a `gsl::final_action` object, deducing the template argument type from the type of the argument.
|
||||||
|
|
||||||
|
### <a name="H-util-at" />`gsl::at`
|
||||||
|
|
||||||
|
The function `gsl::at` offers a safe way to access data with index bounds checking.
|
||||||
|
|
||||||
|
Note: `gsl::at` supports indexes up to `PTRDIFF_MAX`.
|
||||||
|
|
||||||
|
See [ES.42: Keep use of pointers simple and straightforward](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Res-ptr)
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T, std::size_t N>
|
||||||
|
constexpr T& at(T (&arr)[N], const index i);
|
||||||
|
```
|
||||||
|
|
||||||
|
This overload returns a reference to the `i`s element of a C style array `arr`. It [`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the array.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class Cont>
|
||||||
|
constexpr auto at(Cont& cont, const index i) -> decltype(cont[cont.size()]);
|
||||||
|
```
|
||||||
|
|
||||||
|
This overload returns a reference to the `i`s element of the container `cont`. It [`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the array.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T>
|
||||||
|
constexpr T at(const std::initializer_list<T> cont, const index i);
|
||||||
|
```
|
||||||
|
|
||||||
|
This overload returns a reference to the `i`s element of the initializer list `cont`. It [`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the array.
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
template <class T, std::size_t extent = std::dynamic_extent>
|
||||||
|
constexpr auto at(std::span<T, extent> sp, const index i) -> decltype(sp[sp.size()]);
|
||||||
|
```
|
||||||
|
|
||||||
|
This overload returns a reference to the `i`s element of the `std::span` `sp`. It [`Expects`](#user-content-H-assert-expects) that the provided index is within the bounds of the array.
|
||||||
|
|
||||||
|
For [`gsl::at`](#user-content-H-span_ext-at) for [`gsl::span`](#user-content-H-span-span) see header [`span_ext`](#user-content-H-span_ext).
|
13
deps/GSL/include/CMakeLists.txt
vendored
Normal file
13
deps/GSL/include/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Add include folders to the library and targets that consume it
|
||||||
|
# the SYSTEM keyword suppresses warnings for users of the library
|
||||||
|
#
|
||||||
|
# By adding this directory as an include directory the user gets a
|
||||||
|
# namespace effect.
|
||||||
|
#
|
||||||
|
# IE:
|
||||||
|
# #include <gsl/gsl>
|
||||||
|
if(PROJECT_IS_TOP_LEVEL)
|
||||||
|
target_include_directories(GSL INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
else()
|
||||||
|
target_include_directories(GSL SYSTEM INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
|
||||||
|
endif()
|
63
deps/GSL/include/gsl/algorithm
vendored
Normal file
63
deps/GSL/include/gsl/algorithm
vendored
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_ALGORITHM_H
|
||||||
|
#define GSL_ALGORITHM_H
|
||||||
|
|
||||||
|
#include "assert" // for Expects
|
||||||
|
#include "span" // for dynamic_extent, span
|
||||||
|
|
||||||
|
#include <algorithm> // for copy_n
|
||||||
|
#include <cstddef> // for ptrdiff_t
|
||||||
|
#include <type_traits> // for is_assignable
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
|
||||||
|
// turn off some warnings that are noisy about our Expects statements
|
||||||
|
#pragma warning(disable : 4127) // conditional expression is constant
|
||||||
|
#pragma warning(disable : 4996) // unsafe use of std::copy_n
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
// Note: this will generate faster code than std::copy using span iterator in older msvc+stl
|
||||||
|
// not necessary for msvc since VS2017 15.8 (_MSC_VER >= 1915)
|
||||||
|
template <class SrcElementType, std::size_t SrcExtent, class DestElementType,
|
||||||
|
std::size_t DestExtent>
|
||||||
|
void copy(span<SrcElementType, SrcExtent> src, span<DestElementType, DestExtent> dest)
|
||||||
|
{
|
||||||
|
static_assert(std::is_assignable<decltype(*dest.data()), decltype(*src.data())>::value,
|
||||||
|
"Elements of source span can not be assigned to elements of destination span");
|
||||||
|
static_assert(SrcExtent == dynamic_extent || DestExtent == dynamic_extent ||
|
||||||
|
(SrcExtent <= DestExtent),
|
||||||
|
"Source range is longer than target range");
|
||||||
|
|
||||||
|
Expects(dest.size() >= src.size());
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(stl.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
std::copy_n(src.data(), src.size(), dest.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#endif // GSL_ALGORITHM_H
|
133
deps/GSL/include/gsl/assert
vendored
Normal file
133
deps/GSL/include/gsl/assert
vendored
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_ASSERT_H
|
||||||
|
#define GSL_ASSERT_H
|
||||||
|
|
||||||
|
//
|
||||||
|
// Temporary until MSVC STL supports no-exceptions mode.
|
||||||
|
// Currently terminate is a no-op in this mode, so we add termination behavior back
|
||||||
|
//
|
||||||
|
#if defined(_MSC_VER) && (defined(_KERNEL_MODE) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS))
|
||||||
|
#define GSL_KERNEL_MODE
|
||||||
|
|
||||||
|
#define GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND
|
||||||
|
#include <intrin.h>
|
||||||
|
#define RANGE_CHECKS_FAILURE 0
|
||||||
|
|
||||||
|
#if defined(__clang__)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Winvalid-noreturn"
|
||||||
|
#endif // defined(__clang__)
|
||||||
|
|
||||||
|
#else // defined(_MSC_VER) && (defined(_KERNEL_MODE) || (defined(_HAS_EXCEPTIONS) &&
|
||||||
|
// !_HAS_EXCEPTIONS))
|
||||||
|
|
||||||
|
#include <exception>
|
||||||
|
|
||||||
|
#endif // defined(_MSC_VER) && (defined(_KERNEL_MODE) || (defined(_HAS_EXCEPTIONS) &&
|
||||||
|
// !_HAS_EXCEPTIONS))
|
||||||
|
|
||||||
|
//
|
||||||
|
// make suppress attributes parse for some compilers
|
||||||
|
// Hopefully temporary until suppression standardization occurs
|
||||||
|
//
|
||||||
|
#if defined(__clang__)
|
||||||
|
#define GSL_SUPPRESS(x) [[gsl::suppress(#x)]]
|
||||||
|
#else
|
||||||
|
#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__NVCC__)
|
||||||
|
#define GSL_SUPPRESS(x) [[gsl::suppress(x)]]
|
||||||
|
#else
|
||||||
|
#define GSL_SUPPRESS(x)
|
||||||
|
#endif // _MSC_VER
|
||||||
|
#endif // __clang__
|
||||||
|
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#define GSL_LIKELY(x) __builtin_expect(!!(x), 1)
|
||||||
|
#define GSL_UNLIKELY(x) __builtin_expect(!!(x), 0)
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#define GSL_LIKELY(x) (!!(x))
|
||||||
|
#define GSL_UNLIKELY(x) (!!(x))
|
||||||
|
#endif // defined(__clang__) || defined(__GNUC__)
|
||||||
|
|
||||||
|
//
|
||||||
|
// GSL_ASSUME(cond)
|
||||||
|
//
|
||||||
|
// Tell the optimizer that the predicate cond must hold. It is unspecified
|
||||||
|
// whether or not cond is actually evaluated.
|
||||||
|
//
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#define GSL_ASSUME(cond) __assume(cond)
|
||||||
|
#elif defined(__GNUC__)
|
||||||
|
#define GSL_ASSUME(cond) ((cond) ? static_cast<void>(0) : __builtin_unreachable())
|
||||||
|
#else
|
||||||
|
#define GSL_ASSUME(cond) static_cast<void>((cond) ? 0 : 0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//
|
||||||
|
// GSL.assert: assertions
|
||||||
|
//
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace details
|
||||||
|
{
|
||||||
|
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||||
|
|
||||||
|
typedef void(__cdecl* terminate_handler)();
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
[[noreturn]] inline void __cdecl default_terminate_handler()
|
||||||
|
{
|
||||||
|
__fastfail(RANGE_CHECKS_FAILURE);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline gsl::details::terminate_handler& get_terminate_handler() noexcept
|
||||||
|
{
|
||||||
|
static terminate_handler handler = &default_terminate_handler;
|
||||||
|
return handler;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||||
|
|
||||||
|
[[noreturn]] inline void terminate() noexcept
|
||||||
|
{
|
||||||
|
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||||
|
(*gsl::details::get_terminate_handler())();
|
||||||
|
#else
|
||||||
|
std::terminate();
|
||||||
|
#endif // defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace details
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#define GSL_CONTRACT_CHECK(type, cond) \
|
||||||
|
(GSL_LIKELY(cond) ? static_cast<void>(0) : gsl::details::terminate())
|
||||||
|
|
||||||
|
#define Expects(cond) GSL_CONTRACT_CHECK("Precondition", cond)
|
||||||
|
#define Ensures(cond) GSL_CONTRACT_CHECK("Postcondition", cond)
|
||||||
|
|
||||||
|
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND) && defined(__clang__)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // GSL_ASSERT_H
|
188
deps/GSL/include/gsl/byte
vendored
Normal file
188
deps/GSL/include/gsl/byte
vendored
Normal file
@ -0,0 +1,188 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_BYTE_H
|
||||||
|
#define GSL_BYTE_H
|
||||||
|
|
||||||
|
#include <type_traits>
|
||||||
|
|
||||||
|
// VS2017 15.8 added support for the __cpp_lib_byte definition
|
||||||
|
// To do: drop _HAS_STD_BYTE when support for pre 15.8 expires
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
|
||||||
|
// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool.
|
||||||
|
#pragma warning(disable : 26493) // don't use c-style casts // TODO: MSVC suppression in templates
|
||||||
|
// does not always work
|
||||||
|
|
||||||
|
#ifndef GSL_USE_STD_BYTE
|
||||||
|
// this tests if we are under MSVC and the standard lib has std::byte and it is enabled
|
||||||
|
#if (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || \
|
||||||
|
(defined(__cpp_lib_byte) && __cpp_lib_byte >= 201603)
|
||||||
|
|
||||||
|
#define GSL_USE_STD_BYTE 1
|
||||||
|
|
||||||
|
#else // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >=
|
||||||
|
// 201603)
|
||||||
|
|
||||||
|
#define GSL_USE_STD_BYTE 0
|
||||||
|
|
||||||
|
#endif // (defined(_HAS_STD_BYTE) && _HAS_STD_BYTE) || (defined(__cpp_lib_byte) && __cpp_lib_byte >=
|
||||||
|
// 201603)
|
||||||
|
#endif // GSL_USE_STD_BYTE
|
||||||
|
|
||||||
|
#else // _MSC_VER
|
||||||
|
|
||||||
|
#ifndef GSL_USE_STD_BYTE
|
||||||
|
#include <cstddef> /* __cpp_lib_byte */
|
||||||
|
// this tests if we are under GCC or Clang with enough -std=c++1z power to get us std::byte
|
||||||
|
// also check if libc++ version is sufficient (> 5.0) or libstdc++ actually contains std::byte
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L) && \
|
||||||
|
(defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603) || \
|
||||||
|
defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 5000))
|
||||||
|
|
||||||
|
#define GSL_USE_STD_BYTE 1
|
||||||
|
|
||||||
|
#else // defined(__cplusplus) && (__cplusplus >= 201703L) &&
|
||||||
|
// (defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603) ||
|
||||||
|
// defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 5000))
|
||||||
|
|
||||||
|
#define GSL_USE_STD_BYTE 0
|
||||||
|
|
||||||
|
#endif // defined(__cplusplus) && (__cplusplus >= 201703L) &&
|
||||||
|
// (defined(__cpp_lib_byte) && (__cpp_lib_byte >= 201603) ||
|
||||||
|
// defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION >= 5000))
|
||||||
|
#endif // GSL_USE_STD_BYTE
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
// Use __may_alias__ attribute on gcc and clang
|
||||||
|
#if defined __clang__ || (defined(__GNUC__) && __GNUC__ > 5)
|
||||||
|
#define byte_may_alias __attribute__((__may_alias__))
|
||||||
|
#else // defined __clang__ || defined __GNUC__
|
||||||
|
#define byte_may_alias
|
||||||
|
#endif // defined __clang__ || defined __GNUC__
|
||||||
|
|
||||||
|
#if GSL_USE_STD_BYTE
|
||||||
|
#include <cstddef>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
#if GSL_USE_STD_BYTE
|
||||||
|
|
||||||
|
using std::byte;
|
||||||
|
using std::to_integer;
|
||||||
|
|
||||||
|
#else // GSL_USE_STD_BYTE
|
||||||
|
|
||||||
|
// This is a simple definition for now that allows
|
||||||
|
// use of byte within span<> to be standards-compliant
|
||||||
|
enum class byte_may_alias byte : unsigned char
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte& operator<<=(byte& b, IntegerType shift) noexcept
|
||||||
|
{
|
||||||
|
return b = byte(static_cast<unsigned char>(b) << shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte operator<<(byte b, IntegerType shift) noexcept
|
||||||
|
{
|
||||||
|
return byte(static_cast<unsigned char>(b) << shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte& operator>>=(byte& b, IntegerType shift) noexcept
|
||||||
|
{
|
||||||
|
return b = byte(static_cast<unsigned char>(b) >> shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr byte operator>>(byte b, IntegerType shift) noexcept
|
||||||
|
{
|
||||||
|
return byte(static_cast<unsigned char>(b) >> shift);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte& operator|=(byte& l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return l = byte(static_cast<unsigned char>(l) | static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte operator|(byte l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return byte(static_cast<unsigned char>(l) | static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte& operator&=(byte& l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return l = byte(static_cast<unsigned char>(l) & static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte operator&(byte l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return byte(static_cast<unsigned char>(l) & static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte& operator^=(byte& l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return l = byte(static_cast<unsigned char>(l) ^ static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte operator^(byte l, byte r) noexcept
|
||||||
|
{
|
||||||
|
return byte(static_cast<unsigned char>(l) ^ static_cast<unsigned char>(r));
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr byte operator~(byte b) noexcept { return byte(~static_cast<unsigned char>(b)); }
|
||||||
|
|
||||||
|
template <class IntegerType, class = std::enable_if_t<std::is_integral<IntegerType>::value>>
|
||||||
|
constexpr IntegerType to_integer(byte b) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<IntegerType>(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GSL_USE_STD_BYTE
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
// NOTE: need suppression since c++14 does not allow "return {t}"
|
||||||
|
// GSL_SUPPRESS(type.4) // NO-FORMAT: attribute // TODO: suppression does not work
|
||||||
|
constexpr byte to_byte(T t) noexcept
|
||||||
|
{
|
||||||
|
static_assert(std::is_same<T, unsigned char>::value,
|
||||||
|
"gsl::to_byte(t) must be provided an unsigned char, otherwise data loss may occur. "
|
||||||
|
"If you are calling to_byte with an integer constant use: gsl::to_byte<t>() version.");
|
||||||
|
return byte(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <int I>
|
||||||
|
constexpr byte to_byte() noexcept
|
||||||
|
{
|
||||||
|
static_assert(I >= 0 && I <= 255,
|
||||||
|
"gsl::byte only has 8 bits of storage, values must be in range 0-255");
|
||||||
|
return static_cast<byte>(I);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#endif // GSL_BYTE_H
|
32
deps/GSL/include/gsl/gsl
vendored
Normal file
32
deps/GSL/include/gsl/gsl
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_GSL_H
|
||||||
|
#define GSL_GSL_H
|
||||||
|
|
||||||
|
#include "algorithm" // copy
|
||||||
|
#include "assert" // Ensures/Expects
|
||||||
|
#include "byte" // byte
|
||||||
|
#include "pointers" // owner, not_null
|
||||||
|
#include "span" // span
|
||||||
|
#include "zstring" // zstring
|
||||||
|
#include "util" // finally()/narrow_cast()...
|
||||||
|
|
||||||
|
#ifdef __cpp_exceptions
|
||||||
|
#include "narrow" // narrow()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // GSL_GSL_H
|
84
deps/GSL/include/gsl/narrow
vendored
Normal file
84
deps/GSL/include/gsl/narrow
vendored
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_NARROW_H
|
||||||
|
#define GSL_NARROW_H
|
||||||
|
#include "assert" // for GSL_SUPPRESS
|
||||||
|
#include "util" // for narrow_cast
|
||||||
|
#include <exception> // for std::exception
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
struct narrowing_error : public std::exception
|
||||||
|
{
|
||||||
|
const char* what() const noexcept override { return "narrowing_error"; }
|
||||||
|
};
|
||||||
|
|
||||||
|
// narrow() : a checked version of narrow_cast() that throws if the cast changed the value
|
||||||
|
template <class T, class U, typename std::enable_if<std::is_arithmetic<T>::value>::type* = nullptr>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
|
||||||
|
GSL_SUPPRESS(es.46) // NO-FORMAT: attribute // The warning suggests that a floating->unsigned conversion can occur
|
||||||
|
// in the static_cast below, and that gsl::narrow should be used instead.
|
||||||
|
// Suppress this warning, since gsl::narrow is defined in terms of
|
||||||
|
// static_cast
|
||||||
|
// clang-format on
|
||||||
|
constexpr T narrow(U u) noexcept(false)
|
||||||
|
{
|
||||||
|
constexpr const bool is_different_signedness =
|
||||||
|
(std::is_signed<T>::value != std::is_signed<U>::value);
|
||||||
|
|
||||||
|
GSL_SUPPRESS(es.103) // NO-FORMAT: attribute // don't overflow
|
||||||
|
GSL_SUPPRESS(es.104) // NO-FORMAT: attribute // don't underflow
|
||||||
|
GSL_SUPPRESS(p.2) // NO-FORMAT: attribute // don't rely on undefined behavior
|
||||||
|
const T t = narrow_cast<T>(u); // While this is technically undefined behavior in some cases (i.e., if the source value is of floating-point type
|
||||||
|
// and cannot fit into the destination integral type), the resultant behavior is benign on the platforms
|
||||||
|
// that we target (i.e., no hardware trap representations are hit).
|
||||||
|
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||||
|
#endif
|
||||||
|
// Note: NaN will always throw, since NaN != NaN
|
||||||
|
if (static_cast<U>(t) != u || (is_different_signedness && ((t < T{}) != (u < U{}))))
|
||||||
|
{
|
||||||
|
throw narrowing_error{};
|
||||||
|
}
|
||||||
|
#if defined(__clang__) || defined(__GNUC__)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U, typename std::enable_if<!std::is_arithmetic<T>::value>::type* = nullptr>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
GSL_SUPPRESS(f.6) // NO-FORMAT: attribute // TODO: MSVC /analyze does not recognise noexcept(false)
|
||||||
|
// clang-format on
|
||||||
|
constexpr T narrow(U u) noexcept(false)
|
||||||
|
{
|
||||||
|
const T t = narrow_cast<T>(u);
|
||||||
|
|
||||||
|
if (static_cast<U>(t) != u)
|
||||||
|
{
|
||||||
|
throw narrowing_error{};
|
||||||
|
}
|
||||||
|
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
} // namespace gsl
|
||||||
|
#endif // GSL_NARROW_H
|
348
deps/GSL/include/gsl/pointers
vendored
Normal file
348
deps/GSL/include/gsl/pointers
vendored
Normal file
@ -0,0 +1,348 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_POINTERS_H
|
||||||
|
#define GSL_POINTERS_H
|
||||||
|
|
||||||
|
#include "assert" // for Ensures, Expects
|
||||||
|
|
||||||
|
#include <algorithm> // for forward
|
||||||
|
#include <cstddef> // for ptrdiff_t, nullptr_t, size_t
|
||||||
|
#include <memory> // for shared_ptr, unique_ptr
|
||||||
|
#include <system_error> // for hash
|
||||||
|
#include <type_traits> // for enable_if_t, is_convertible, is_assignable
|
||||||
|
#include <utility> // for declval
|
||||||
|
|
||||||
|
#if !defined(GSL_NO_IOSTREAMS)
|
||||||
|
#include <iosfwd> // for ostream
|
||||||
|
#endif // !defined(GSL_NO_IOSTREAMS)
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace details
|
||||||
|
{
|
||||||
|
template <typename T, typename = void>
|
||||||
|
struct is_comparable_to_nullptr : std::false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct is_comparable_to_nullptr<
|
||||||
|
T,
|
||||||
|
std::enable_if_t<std::is_convertible<decltype(std::declval<T>() != nullptr), bool>::value>>
|
||||||
|
: std::true_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// Resolves to the more efficient of `const T` or `const T&`, in the context of returning a const-qualified value
|
||||||
|
// of type T.
|
||||||
|
//
|
||||||
|
// Copied from cppfront's implementation of the CppCoreGuidelines F.16 (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-in)
|
||||||
|
template<typename T>
|
||||||
|
using value_or_reference_return_t = std::conditional_t<
|
||||||
|
sizeof(T) < 2*sizeof(void*) && std::is_trivially_copy_constructible<T>::value,
|
||||||
|
const T,
|
||||||
|
const T&>;
|
||||||
|
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
//
|
||||||
|
// GSL.owner: ownership pointers
|
||||||
|
//
|
||||||
|
using std::shared_ptr;
|
||||||
|
using std::unique_ptr;
|
||||||
|
|
||||||
|
//
|
||||||
|
// owner
|
||||||
|
//
|
||||||
|
// `gsl::owner<T>` is designed as a safety mechanism for code that must deal directly with raw pointers that own memory.
|
||||||
|
// Ideally such code should be restricted to the implementation of low-level abstractions. `gsl::owner` can also be used
|
||||||
|
// as a stepping point in converting legacy code to use more modern RAII constructs, such as smart pointers.
|
||||||
|
//
|
||||||
|
// T must be a pointer type
|
||||||
|
// - disallow construction from any type other than pointer type
|
||||||
|
//
|
||||||
|
template <class T, class = std::enable_if_t<std::is_pointer<T>::value>>
|
||||||
|
using owner = T;
|
||||||
|
|
||||||
|
//
|
||||||
|
// not_null
|
||||||
|
//
|
||||||
|
// Restricts a pointer or smart pointer to only hold non-null values.
|
||||||
|
//
|
||||||
|
// Has zero size overhead over T.
|
||||||
|
//
|
||||||
|
// If T is a pointer (i.e. T == U*) then
|
||||||
|
// - allow construction from U*
|
||||||
|
// - disallow construction from nullptr_t
|
||||||
|
// - disallow default construction
|
||||||
|
// - ensure construction from null U* fails
|
||||||
|
// - allow implicit conversion to U*
|
||||||
|
//
|
||||||
|
template <class T>
|
||||||
|
class not_null
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static_assert(details::is_comparable_to_nullptr<T>::value, "T cannot be compared to nullptr.");
|
||||||
|
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr not_null(U&& u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::forward<U>(u))
|
||||||
|
{
|
||||||
|
Expects(ptr_ != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>>
|
||||||
|
constexpr not_null(T u) noexcept(std::is_nothrow_move_constructible<T>::value) : ptr_(std::move(u))
|
||||||
|
{
|
||||||
|
Expects(ptr_ != nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr not_null(const not_null<U>& other) noexcept(std::is_nothrow_move_constructible<T>::value) : not_null(other.get())
|
||||||
|
{}
|
||||||
|
|
||||||
|
not_null(const not_null& other) = default;
|
||||||
|
not_null& operator=(const not_null& other) = default;
|
||||||
|
constexpr details::value_or_reference_return_t<T> get() const
|
||||||
|
noexcept(noexcept(details::value_or_reference_return_t<T>{std::declval<T&>()}))
|
||||||
|
{
|
||||||
|
return ptr_;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr operator T() const { return get(); }
|
||||||
|
constexpr decltype(auto) operator->() const { return get(); }
|
||||||
|
constexpr decltype(auto) operator*() const { return *get(); }
|
||||||
|
|
||||||
|
// prevents compilation when someone attempts to assign a null pointer constant
|
||||||
|
not_null(std::nullptr_t) = delete;
|
||||||
|
not_null& operator=(std::nullptr_t) = delete;
|
||||||
|
|
||||||
|
// unwanted operators...pointers only point to single objects!
|
||||||
|
not_null& operator++() = delete;
|
||||||
|
not_null& operator--() = delete;
|
||||||
|
not_null operator++(int) = delete;
|
||||||
|
not_null operator--(int) = delete;
|
||||||
|
not_null& operator+=(std::ptrdiff_t) = delete;
|
||||||
|
not_null& operator-=(std::ptrdiff_t) = delete;
|
||||||
|
void operator[](std::ptrdiff_t) const = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
T ptr_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
auto make_not_null(T&& t) noexcept
|
||||||
|
{
|
||||||
|
return not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(GSL_NO_IOSTREAMS)
|
||||||
|
template <class T>
|
||||||
|
std::ostream& operator<<(std::ostream& os, const not_null<T>& val)
|
||||||
|
{
|
||||||
|
os << val.get();
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
#endif // !defined(GSL_NO_IOSTREAMS)
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator==(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() == rhs.get()))
|
||||||
|
-> decltype(lhs.get() == rhs.get())
|
||||||
|
{
|
||||||
|
return lhs.get() == rhs.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator!=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(lhs.get() != rhs.get()))
|
||||||
|
-> decltype(lhs.get() != rhs.get())
|
||||||
|
{
|
||||||
|
return lhs.get() != rhs.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator<(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(std::less<>{}(lhs.get(), rhs.get())))
|
||||||
|
-> decltype(std::less<>{}(lhs.get(), rhs.get()))
|
||||||
|
{
|
||||||
|
return std::less<>{}(lhs.get(), rhs.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator<=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(std::less_equal<>{}(lhs.get(), rhs.get())))
|
||||||
|
-> decltype(std::less_equal<>{}(lhs.get(), rhs.get()))
|
||||||
|
{
|
||||||
|
return std::less_equal<>{}(lhs.get(), rhs.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator>(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(std::greater<>{}(lhs.get(), rhs.get())))
|
||||||
|
-> decltype(std::greater<>{}(lhs.get(), rhs.get()))
|
||||||
|
{
|
||||||
|
return std::greater<>{}(lhs.get(), rhs.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
auto operator>=(const not_null<T>& lhs,
|
||||||
|
const not_null<U>& rhs) noexcept(noexcept(std::greater_equal<>{}(lhs.get(), rhs.get())))
|
||||||
|
-> decltype(std::greater_equal<>{}(lhs.get(), rhs.get()))
|
||||||
|
{
|
||||||
|
return std::greater_equal<>{}(lhs.get(), rhs.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
// more unwanted operators
|
||||||
|
template <class T, class U>
|
||||||
|
std::ptrdiff_t operator-(const not_null<T>&, const not_null<U>&) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator-(const not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator+(const not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
not_null<T> operator+(std::ptrdiff_t, const not_null<T>&) = delete;
|
||||||
|
|
||||||
|
|
||||||
|
template <class T, class U = decltype(std::declval<const T&>().get()), bool = std::is_default_constructible<std::hash<U>>::value>
|
||||||
|
struct not_null_hash
|
||||||
|
{
|
||||||
|
std::size_t operator()(const T& value) const { return std::hash<U>{}(value.get()); }
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T, class U>
|
||||||
|
struct not_null_hash<T, U, false>
|
||||||
|
{
|
||||||
|
not_null_hash() = delete;
|
||||||
|
not_null_hash(const not_null_hash&) = delete;
|
||||||
|
not_null_hash& operator=(const not_null_hash&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
struct hash<gsl::not_null<T>> : gsl::not_null_hash<gsl::not_null<T>>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
|
||||||
|
//
|
||||||
|
// strict_not_null
|
||||||
|
//
|
||||||
|
// Restricts a pointer or smart pointer to only hold non-null values,
|
||||||
|
//
|
||||||
|
// - provides a strict (i.e. explicit constructor from T) wrapper of not_null
|
||||||
|
// - to be used for new code that wishes the design to be cleaner and make not_null
|
||||||
|
// checks intentional, or in old code that would like to make the transition.
|
||||||
|
//
|
||||||
|
// To make the transition from not_null, incrementally replace not_null
|
||||||
|
// by strict_not_null and fix compilation errors
|
||||||
|
//
|
||||||
|
// Expect to
|
||||||
|
// - remove all unneeded conversions from raw pointer to not_null and back
|
||||||
|
// - make API clear by specifying not_null in parameters where needed
|
||||||
|
// - remove unnecessary asserts
|
||||||
|
//
|
||||||
|
template <class T>
|
||||||
|
class strict_not_null : public not_null<T>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr explicit strict_not_null(U&& u) : not_null<T>(std::forward<U>(u))
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <typename = std::enable_if_t<!std::is_same<std::nullptr_t, T>::value>>
|
||||||
|
constexpr explicit strict_not_null(T u) : not_null<T>(u)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr strict_not_null(const not_null<U>& other) : not_null<T>(other)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <typename U, typename = std::enable_if_t<std::is_convertible<U, T>::value>>
|
||||||
|
constexpr strict_not_null(const strict_not_null<U>& other) : not_null<T>(other)
|
||||||
|
{}
|
||||||
|
|
||||||
|
// To avoid invalidating the "not null" invariant, the contained pointer is actually copied
|
||||||
|
// instead of moved. If it is a custom pointer, its constructor could in theory throw exceptions.
|
||||||
|
strict_not_null(strict_not_null&& other) noexcept(std::is_nothrow_copy_constructible<T>::value) = default;
|
||||||
|
strict_not_null(const strict_not_null& other) = default;
|
||||||
|
strict_not_null& operator=(const strict_not_null& other) = default;
|
||||||
|
strict_not_null& operator=(const not_null<T>& other)
|
||||||
|
{
|
||||||
|
not_null<T>::operator=(other);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prevents compilation when someone attempts to assign a null pointer constant
|
||||||
|
strict_not_null(std::nullptr_t) = delete;
|
||||||
|
strict_not_null& operator=(std::nullptr_t) = delete;
|
||||||
|
|
||||||
|
// unwanted operators...pointers only point to single objects!
|
||||||
|
strict_not_null& operator++() = delete;
|
||||||
|
strict_not_null& operator--() = delete;
|
||||||
|
strict_not_null operator++(int) = delete;
|
||||||
|
strict_not_null operator--(int) = delete;
|
||||||
|
strict_not_null& operator+=(std::ptrdiff_t) = delete;
|
||||||
|
strict_not_null& operator-=(std::ptrdiff_t) = delete;
|
||||||
|
void operator[](std::ptrdiff_t) const = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
// more unwanted operators
|
||||||
|
template <class T, class U>
|
||||||
|
std::ptrdiff_t operator-(const strict_not_null<T>&, const strict_not_null<U>&) = delete;
|
||||||
|
template <class T>
|
||||||
|
strict_not_null<T> operator-(const strict_not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
strict_not_null<T> operator+(const strict_not_null<T>&, std::ptrdiff_t) = delete;
|
||||||
|
template <class T>
|
||||||
|
strict_not_null<T> operator+(std::ptrdiff_t, const strict_not_null<T>&) = delete;
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
auto make_strict_not_null(T&& t) noexcept
|
||||||
|
{
|
||||||
|
return strict_not_null<std::remove_cv_t<std::remove_reference_t<T>>>{std::forward<T>(t)};
|
||||||
|
}
|
||||||
|
|
||||||
|
#if (defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L))
|
||||||
|
|
||||||
|
// deduction guides to prevent the ctad-maybe-unsupported warning
|
||||||
|
template <class T>
|
||||||
|
not_null(T) -> not_null<T>;
|
||||||
|
template <class T>
|
||||||
|
strict_not_null(T) -> strict_not_null<T>;
|
||||||
|
|
||||||
|
#endif // ( defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) )
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
struct hash<gsl::strict_not_null<T>> : gsl::not_null_hash<gsl::strict_not_null<T>>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
#endif // GSL_POINTERS_H
|
849
deps/GSL/include/gsl/span
vendored
Normal file
849
deps/GSL/include/gsl/span
vendored
Normal file
@ -0,0 +1,849 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_SPAN_H
|
||||||
|
#define GSL_SPAN_H
|
||||||
|
|
||||||
|
#include "assert" // for Expects
|
||||||
|
#include "byte" // for byte
|
||||||
|
#include "span_ext" // for span specialization of gsl::at and other span-related extensions
|
||||||
|
#include "util" // for narrow_cast
|
||||||
|
|
||||||
|
#include <array> // for array
|
||||||
|
#include <cstddef> // for ptrdiff_t, size_t, nullptr_t
|
||||||
|
#include <iterator> // for reverse_iterator, distance, random_access_...
|
||||||
|
#include <memory> // for pointer_traits
|
||||||
|
#include <type_traits> // for enable_if_t, declval, is_convertible, inte...
|
||||||
|
|
||||||
|
#if defined(__has_include) && __has_include(<version>)
|
||||||
|
#include <version>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
#pragma warning(push)
|
||||||
|
|
||||||
|
// turn off some warnings that are noisy about our Expects statements
|
||||||
|
#pragma warning(disable : 4127) // conditional expression is constant
|
||||||
|
#pragma warning( \
|
||||||
|
disable : 4146) // unary minus operator applied to unsigned type, result still unsigned
|
||||||
|
#pragma warning(disable : 4702) // unreachable code
|
||||||
|
|
||||||
|
// Turn MSVC /analyze rules that generate too much noise. TODO: fix in the tool.
|
||||||
|
#pragma warning(disable : 26495) // uninitialized member when constructor calls constructor
|
||||||
|
#pragma warning(disable : 26446) // parser bug does not allow attributes on some templates
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
// See if we have enough C++17 power to use a static constexpr data member
|
||||||
|
// without needing an out-of-line definition
|
||||||
|
#if !(defined(__cplusplus) && (__cplusplus >= 201703L))
|
||||||
|
#define GSL_USE_STATIC_CONSTEXPR_WORKAROUND
|
||||||
|
#endif // !(defined(__cplusplus) && (__cplusplus >= 201703L))
|
||||||
|
|
||||||
|
// GCC 7 does not like the signed unsigned mismatch (size_t ptrdiff_t)
|
||||||
|
// While there is a conversion from signed to unsigned, it happens at
|
||||||
|
// compiletime, so the compiler wouldn't have to warn indiscriminately, but
|
||||||
|
// could check if the source value actually doesn't fit into the target type
|
||||||
|
// and only warn in those cases.
|
||||||
|
#if defined(__GNUC__) && __GNUC__ > 6
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
|
||||||
|
// implementation details
|
||||||
|
namespace details
|
||||||
|
{
|
||||||
|
template <class T>
|
||||||
|
struct is_span_oracle : std::false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
struct is_span_oracle<gsl::span<ElementType, Extent>> : std::true_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct is_span : public is_span_oracle<std::remove_cv_t<T>>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct is_std_array_oracle : std::false_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
struct is_std_array_oracle<std::array<ElementType, Extent>> : std::true_type
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
struct is_std_array : is_std_array_oracle<std::remove_cv_t<T>>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <std::size_t From, std::size_t To>
|
||||||
|
struct is_allowed_extent_conversion
|
||||||
|
: std::integral_constant<bool, From == To || To == dynamic_extent>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class From, class To>
|
||||||
|
struct is_allowed_element_type_conversion
|
||||||
|
: std::integral_constant<bool, std::is_convertible<From (*)[], To (*)[]>::value>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class Type>
|
||||||
|
class span_iterator
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
#if defined(__cpp_lib_ranges) || (defined(_MSVC_STL_VERSION) && defined(__cpp_lib_concepts))
|
||||||
|
using iterator_concept = std::contiguous_iterator_tag;
|
||||||
|
#endif // __cpp_lib_ranges
|
||||||
|
using iterator_category = std::random_access_iterator_tag;
|
||||||
|
using value_type = std::remove_cv_t<Type>;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
using pointer = Type*;
|
||||||
|
using reference = Type&;
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
using _Unchecked_type = pointer;
|
||||||
|
using _Prevent_inheriting_unwrap = span_iterator;
|
||||||
|
#endif // _MSC_VER
|
||||||
|
constexpr span_iterator() = default;
|
||||||
|
|
||||||
|
constexpr span_iterator(pointer begin, pointer end, pointer current)
|
||||||
|
: begin_(begin), end_(end), current_(current)
|
||||||
|
{}
|
||||||
|
|
||||||
|
constexpr operator span_iterator<const Type>() const noexcept
|
||||||
|
{
|
||||||
|
return {begin_, end_, current_};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr reference operator*() const noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ && end_);
|
||||||
|
Expects(begin_ <= current_ && current_ < end_);
|
||||||
|
return *current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr pointer operator->() const noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ && end_);
|
||||||
|
Expects(begin_ <= current_ && current_ < end_);
|
||||||
|
return current_;
|
||||||
|
}
|
||||||
|
constexpr span_iterator& operator++() noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ && current_ && end_);
|
||||||
|
Expects(current_ < end_);
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
++current_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator operator++(int) noexcept
|
||||||
|
{
|
||||||
|
span_iterator ret = *this;
|
||||||
|
++*this;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator& operator--() noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ && end_);
|
||||||
|
Expects(begin_ < current_);
|
||||||
|
--current_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator operator--(int) noexcept
|
||||||
|
{
|
||||||
|
span_iterator ret = *this;
|
||||||
|
--*this;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator& operator+=(const difference_type n) noexcept
|
||||||
|
{
|
||||||
|
if (n != 0) Expects(begin_ && current_ && end_);
|
||||||
|
if (n > 0) Expects(end_ - current_ >= n);
|
||||||
|
if (n < 0) Expects(current_ - begin_ >= -n);
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
current_ += n;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator operator+(const difference_type n) const noexcept
|
||||||
|
{
|
||||||
|
span_iterator ret = *this;
|
||||||
|
ret += n;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
friend constexpr span_iterator operator+(const difference_type n,
|
||||||
|
const span_iterator& rhs) noexcept
|
||||||
|
{
|
||||||
|
return rhs + n;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator& operator-=(const difference_type n) noexcept
|
||||||
|
{
|
||||||
|
if (n != 0) Expects(begin_ && current_ && end_);
|
||||||
|
if (n > 0) Expects(current_ - begin_ >= n);
|
||||||
|
if (n < 0) Expects(end_ - current_ >= -n);
|
||||||
|
GSL_SUPPRESS(bounds .1)
|
||||||
|
current_ -= n;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span_iterator operator-(const difference_type n) const noexcept
|
||||||
|
{
|
||||||
|
span_iterator ret = *this;
|
||||||
|
ret -= n;
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr difference_type operator-(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ == rhs.begin_ && end_ == rhs.end_);
|
||||||
|
return current_ - rhs.current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr reference operator[](const difference_type n) const noexcept
|
||||||
|
{
|
||||||
|
return *(*this + n);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator==(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ == rhs.begin_ && end_ == rhs.end_);
|
||||||
|
return current_ == rhs.current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator!=(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
return !(*this == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator<(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
Expects(begin_ == rhs.begin_ && end_ == rhs.end_);
|
||||||
|
return current_ < rhs.current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator>(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
return rhs < *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator<=(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
return !(rhs < *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class Type2,
|
||||||
|
std::enable_if_t<std::is_same<std::remove_cv_t<Type2>, value_type>::value, int> = 0>
|
||||||
|
constexpr bool operator>=(const span_iterator<Type2>& rhs) const noexcept
|
||||||
|
{
|
||||||
|
return !(*this < rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// MSVC++ iterator debugging support; allows STL algorithms in 15.8+
|
||||||
|
// to unwrap span_iterator to a pointer type after a range check in STL
|
||||||
|
// algorithm calls
|
||||||
|
friend constexpr void _Verify_range(span_iterator lhs, span_iterator rhs) noexcept
|
||||||
|
{ // test that [lhs, rhs) forms a valid range inside an STL algorithm
|
||||||
|
Expects(lhs.begin_ == rhs.begin_ // range spans have to match
|
||||||
|
&& lhs.end_ == rhs.end_ &&
|
||||||
|
lhs.current_ <= rhs.current_); // range must not be transposed
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr void _Verify_offset(const difference_type n) const noexcept
|
||||||
|
{ // test that *this + n is within the range of this call
|
||||||
|
if (n != 0) Expects(begin_ && current_ && end_);
|
||||||
|
if (n > 0) Expects(end_ - current_ >= n);
|
||||||
|
if (n < 0) Expects(current_ - begin_ >= -n);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr pointer _Unwrapped() const noexcept
|
||||||
|
{ // after seeking *this to a high water mark, or using one of the
|
||||||
|
// _Verify_xxx functions above, unwrap this span_iterator to a raw
|
||||||
|
// pointer
|
||||||
|
return current_;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tell the STL that span_iterator should not be unwrapped if it can't
|
||||||
|
// validate in advance, even in release / optimized builds:
|
||||||
|
#if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)
|
||||||
|
static constexpr const bool _Unwrap_when_unverified = false;
|
||||||
|
#else
|
||||||
|
static constexpr bool _Unwrap_when_unverified = false;
|
||||||
|
#endif
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(con.3) // NO-FORMAT: attribute // TODO: false positive
|
||||||
|
// clang-format on
|
||||||
|
constexpr void _Seek_to(const pointer p) noexcept
|
||||||
|
{ // adjust the position of *this to previously verified location p
|
||||||
|
// after _Unwrapped
|
||||||
|
current_ = p;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
pointer begin_ = nullptr;
|
||||||
|
pointer end_ = nullptr;
|
||||||
|
pointer current_ = nullptr;
|
||||||
|
|
||||||
|
template <typename Ptr>
|
||||||
|
friend struct std::pointer_traits;
|
||||||
|
};
|
||||||
|
}} // namespace gsl::details
|
||||||
|
|
||||||
|
namespace std
|
||||||
|
{
|
||||||
|
template <class Type>
|
||||||
|
struct pointer_traits<::gsl::details::span_iterator<Type>>
|
||||||
|
{
|
||||||
|
using pointer = ::gsl::details::span_iterator<Type>;
|
||||||
|
using element_type = Type;
|
||||||
|
using difference_type = ptrdiff_t;
|
||||||
|
|
||||||
|
static constexpr element_type* to_address(const pointer i) noexcept { return i.current_; }
|
||||||
|
};
|
||||||
|
} // namespace std
|
||||||
|
|
||||||
|
namespace gsl { namespace details {
|
||||||
|
template <std::size_t Ext>
|
||||||
|
class extent_type
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using size_type = std::size_t;
|
||||||
|
|
||||||
|
constexpr extent_type() noexcept = default;
|
||||||
|
|
||||||
|
constexpr explicit extent_type(extent_type<dynamic_extent>);
|
||||||
|
|
||||||
|
constexpr explicit extent_type(size_type size) { Expects(size == Ext); }
|
||||||
|
|
||||||
|
constexpr size_type size() const noexcept { return Ext; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
#if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)
|
||||||
|
static constexpr const size_type size_ = Ext; // static size equal to Ext
|
||||||
|
#else
|
||||||
|
static constexpr size_type size_ = Ext; // static size equal to Ext
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
class extent_type<dynamic_extent>
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using size_type = std::size_t;
|
||||||
|
|
||||||
|
template <size_type Other>
|
||||||
|
constexpr explicit extent_type(extent_type<Other> ext) : size_(ext.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
constexpr explicit extent_type(size_type size) : size_(size)
|
||||||
|
{
|
||||||
|
Expects(size != dynamic_extent);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr size_type size() const noexcept { return size_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
size_type size_;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <std::size_t Ext>
|
||||||
|
constexpr extent_type<Ext>::extent_type(extent_type<dynamic_extent> ext)
|
||||||
|
{
|
||||||
|
Expects(ext.size() == Ext);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent, std::size_t Offset, std::size_t Count>
|
||||||
|
struct calculate_subspan_type
|
||||||
|
{
|
||||||
|
using type = span<ElementType, Count != dynamic_extent
|
||||||
|
? Count
|
||||||
|
: (Extent != dynamic_extent ? Extent - Offset : Extent)>;
|
||||||
|
};
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
// [span], class template span
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
class span
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// constants and types
|
||||||
|
using element_type = ElementType;
|
||||||
|
using value_type = std::remove_cv_t<ElementType>;
|
||||||
|
using size_type = std::size_t;
|
||||||
|
using pointer = element_type*;
|
||||||
|
using const_pointer = const element_type*;
|
||||||
|
using reference = element_type&;
|
||||||
|
using const_reference = const element_type&;
|
||||||
|
using difference_type = std::ptrdiff_t;
|
||||||
|
|
||||||
|
using iterator = details::span_iterator<ElementType>;
|
||||||
|
using reverse_iterator = std::reverse_iterator<iterator>;
|
||||||
|
|
||||||
|
#if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)
|
||||||
|
static constexpr const size_type extent{Extent};
|
||||||
|
#else
|
||||||
|
static constexpr size_type extent{Extent};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// [span.cons], span constructors, copy, assignment, and destructor
|
||||||
|
template <bool Dependent = false,
|
||||||
|
// "Dependent" is needed to make "std::enable_if_t<Dependent || Extent == 0 || Extent
|
||||||
|
// == dynamic_extent>" SFINAE, since "std::enable_if_t<Extent == 0 || Extent ==
|
||||||
|
// dynamic_extent>" is ill-formed when Extent is greater than 0.
|
||||||
|
class = std::enable_if_t<(Dependent ||
|
||||||
|
details::is_allowed_extent_conversion<0, Extent>::value)>>
|
||||||
|
constexpr span() noexcept : storage_(nullptr, details::extent_type<0>())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <std::size_t MyExtent = Extent, std::enable_if_t<MyExtent != dynamic_extent, int> = 0>
|
||||||
|
constexpr explicit span(pointer ptr, size_type count) noexcept : storage_(ptr, count)
|
||||||
|
{
|
||||||
|
Expects(count == Extent);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t MyExtent = Extent, std::enable_if_t<MyExtent == dynamic_extent, int> = 0>
|
||||||
|
constexpr span(pointer ptr, size_type count) noexcept : storage_(ptr, count)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <std::size_t MyExtent = Extent, std::enable_if_t<MyExtent != dynamic_extent, int> = 0>
|
||||||
|
constexpr explicit span(pointer firstElem, pointer lastElem) noexcept
|
||||||
|
: storage_(firstElem, narrow_cast<std::size_t>(lastElem - firstElem))
|
||||||
|
{
|
||||||
|
Expects(lastElem - firstElem == static_cast<difference_type>(Extent));
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t MyExtent = Extent, std::enable_if_t<MyExtent == dynamic_extent, int> = 0>
|
||||||
|
constexpr span(pointer firstElem, pointer lastElem) noexcept
|
||||||
|
: storage_(firstElem, narrow_cast<std::size_t>(lastElem - firstElem))
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <std::size_t N,
|
||||||
|
std::enable_if_t<details::is_allowed_extent_conversion<N, Extent>::value, int> = 0>
|
||||||
|
constexpr span(element_type (&arr)[N]) noexcept
|
||||||
|
: storage_(KnownNotNull{arr}, details::extent_type<N>())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <
|
||||||
|
class T, std::size_t N,
|
||||||
|
std::enable_if_t<(details::is_allowed_extent_conversion<N, Extent>::value &&
|
||||||
|
details::is_allowed_element_type_conversion<T, element_type>::value),
|
||||||
|
int> = 0>
|
||||||
|
constexpr span(std::array<T, N>& arr) noexcept
|
||||||
|
: storage_(KnownNotNull{arr.data()}, details::extent_type<N>())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class T, std::size_t N,
|
||||||
|
std::enable_if_t<
|
||||||
|
(details::is_allowed_extent_conversion<N, Extent>::value &&
|
||||||
|
details::is_allowed_element_type_conversion<const T, element_type>::value),
|
||||||
|
int> = 0>
|
||||||
|
constexpr span(const std::array<T, N>& arr) noexcept
|
||||||
|
: storage_(KnownNotNull{arr.data()}, details::extent_type<N>())
|
||||||
|
{}
|
||||||
|
|
||||||
|
// NB: the SFINAE on these constructors uses .data() as an incomplete/imperfect proxy for the
|
||||||
|
// requirement on Container to be a contiguous sequence container.
|
||||||
|
template <std::size_t MyExtent = Extent, class Container,
|
||||||
|
std::enable_if_t<
|
||||||
|
MyExtent != dynamic_extent && !details::is_span<Container>::value &&
|
||||||
|
!details::is_std_array<Container>::value &&
|
||||||
|
std::is_pointer<decltype(std::declval<Container&>().data())>::value &&
|
||||||
|
std::is_convertible<
|
||||||
|
std::remove_pointer_t<decltype(std::declval<Container&>().data())> (*)[],
|
||||||
|
element_type (*)[]>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr explicit span(Container& cont) noexcept : span(cont.data(), cont.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <std::size_t MyExtent = Extent, class Container,
|
||||||
|
std::enable_if_t<
|
||||||
|
MyExtent == dynamic_extent && !details::is_span<Container>::value &&
|
||||||
|
!details::is_std_array<Container>::value &&
|
||||||
|
std::is_pointer<decltype(std::declval<Container&>().data())>::value &&
|
||||||
|
std::is_convertible<
|
||||||
|
std::remove_pointer_t<decltype(std::declval<Container&>().data())> (*)[],
|
||||||
|
element_type (*)[]>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr span(Container& cont) noexcept : span(cont.data(), cont.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <
|
||||||
|
std::size_t MyExtent = Extent, class Container,
|
||||||
|
std::enable_if_t<
|
||||||
|
MyExtent != dynamic_extent && std::is_const<element_type>::value &&
|
||||||
|
!details::is_span<Container>::value && !details::is_std_array<Container>::value &&
|
||||||
|
std::is_pointer<decltype(std::declval<const Container&>().data())>::value &&
|
||||||
|
std::is_convertible<
|
||||||
|
std::remove_pointer_t<decltype(std::declval<const Container&>().data())> (*)[],
|
||||||
|
element_type (*)[]>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr explicit span(const Container& cont) noexcept : span(cont.data(), cont.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <
|
||||||
|
std::size_t MyExtent = Extent, class Container,
|
||||||
|
std::enable_if_t<
|
||||||
|
MyExtent == dynamic_extent && std::is_const<element_type>::value &&
|
||||||
|
!details::is_span<Container>::value && !details::is_std_array<Container>::value &&
|
||||||
|
std::is_pointer<decltype(std::declval<const Container&>().data())>::value &&
|
||||||
|
std::is_convertible<
|
||||||
|
std::remove_pointer_t<decltype(std::declval<const Container&>().data())> (*)[],
|
||||||
|
element_type (*)[]>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr span(const Container& cont) noexcept : span(cont.data(), cont.size())
|
||||||
|
{}
|
||||||
|
|
||||||
|
constexpr span(const span& other) noexcept = default;
|
||||||
|
|
||||||
|
template <class OtherElementType, std::size_t OtherExtent, std::size_t MyExtent = Extent,
|
||||||
|
std::enable_if_t<(MyExtent == dynamic_extent || MyExtent == OtherExtent) &&
|
||||||
|
details::is_allowed_element_type_conversion<OtherElementType,
|
||||||
|
element_type>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr span(const span<OtherElementType, OtherExtent>& other) noexcept
|
||||||
|
: storage_(other.data(), details::extent_type<OtherExtent>(other.size()))
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class OtherElementType, std::size_t OtherExtent, std::size_t MyExtent = Extent,
|
||||||
|
std::enable_if_t<MyExtent != dynamic_extent && OtherExtent == dynamic_extent &&
|
||||||
|
details::is_allowed_element_type_conversion<OtherElementType,
|
||||||
|
element_type>::value,
|
||||||
|
int> = 0>
|
||||||
|
constexpr explicit span(const span<OtherElementType, OtherExtent>& other) noexcept
|
||||||
|
: storage_(other.data(), details::extent_type<OtherExtent>(other.size()))
|
||||||
|
{}
|
||||||
|
|
||||||
|
~span() noexcept = default;
|
||||||
|
constexpr span& operator=(const span& other) noexcept = default;
|
||||||
|
|
||||||
|
// [span.sub], span subviews
|
||||||
|
template <std::size_t Count>
|
||||||
|
constexpr span<element_type, Count> first() const noexcept
|
||||||
|
{
|
||||||
|
Expects(Count <= size());
|
||||||
|
return span<element_type, Count>{data(), Count};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t Count>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr span<element_type, Count> last() const noexcept
|
||||||
|
{
|
||||||
|
Expects(Count <= size());
|
||||||
|
return span<element_type, Count>{data() + (size() - Count), Count};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <std::size_t Offset, std::size_t Count = dynamic_extent>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr auto subspan() const noexcept ->
|
||||||
|
typename details::calculate_subspan_type<ElementType, Extent, Offset, Count>::type
|
||||||
|
{
|
||||||
|
Expects((size() >= Offset) && (Count == dynamic_extent || (Count <= size() - Offset)));
|
||||||
|
using type =
|
||||||
|
typename details::calculate_subspan_type<ElementType, Extent, Offset, Count>::type;
|
||||||
|
return type{data() + Offset, Count == dynamic_extent ? size() - Offset : Count};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent> first(size_type count) const noexcept
|
||||||
|
{
|
||||||
|
Expects(count <= size());
|
||||||
|
return {data(), count};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent> last(size_type count) const noexcept
|
||||||
|
{
|
||||||
|
Expects(count <= size());
|
||||||
|
return make_subspan(size() - count, dynamic_extent, subspan_selector<Extent>{});
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr span<element_type, dynamic_extent>
|
||||||
|
subspan(size_type offset, size_type count = dynamic_extent) const noexcept
|
||||||
|
{
|
||||||
|
return make_subspan(offset, count, subspan_selector<Extent>{});
|
||||||
|
}
|
||||||
|
|
||||||
|
// [span.obs], span observers
|
||||||
|
constexpr size_type size() const noexcept { return storage_.size(); }
|
||||||
|
|
||||||
|
constexpr size_type size_bytes() const noexcept { return size() * sizeof(element_type); }
|
||||||
|
|
||||||
|
constexpr bool empty() const noexcept { return size() == 0; }
|
||||||
|
|
||||||
|
// [span.elem], span element access
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr reference operator[](size_type idx) const noexcept
|
||||||
|
{
|
||||||
|
Expects(idx < size());
|
||||||
|
return data()[idx];
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr reference front() const noexcept
|
||||||
|
{
|
||||||
|
Expects(size() > 0);
|
||||||
|
return data()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr reference back() const noexcept
|
||||||
|
{
|
||||||
|
Expects(size() > 0);
|
||||||
|
return data()[size() - 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr pointer data() const noexcept { return storage_.data(); }
|
||||||
|
|
||||||
|
// [span.iter], span iterator support
|
||||||
|
constexpr iterator begin() const noexcept
|
||||||
|
{
|
||||||
|
const auto data = storage_.data();
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return {data, data + size(), data};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr iterator end() const noexcept
|
||||||
|
{
|
||||||
|
const auto data = storage_.data();
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
const auto endData = data + storage_.size();
|
||||||
|
return {data, endData, endData};
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr reverse_iterator rbegin() const noexcept { return reverse_iterator{end()}; }
|
||||||
|
constexpr reverse_iterator rend() const noexcept { return reverse_iterator{begin()}; }
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
// Tell MSVC how to unwrap spans in range-based-for
|
||||||
|
constexpr pointer _Unchecked_begin() const noexcept { return data(); }
|
||||||
|
constexpr pointer _Unchecked_end() const noexcept
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return data() + size();
|
||||||
|
}
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Needed to remove unnecessary null check in subspans
|
||||||
|
struct KnownNotNull
|
||||||
|
{
|
||||||
|
pointer p;
|
||||||
|
};
|
||||||
|
|
||||||
|
// this implementation detail class lets us take advantage of the
|
||||||
|
// empty base class optimization to pay for only storage of a single
|
||||||
|
// pointer in the case of fixed-size spans
|
||||||
|
template <class ExtentType>
|
||||||
|
class storage_type : public ExtentType
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// KnownNotNull parameter is needed to remove unnecessary null check
|
||||||
|
// in subspans and constructors from arrays
|
||||||
|
template <class OtherExtentType>
|
||||||
|
constexpr storage_type(KnownNotNull data, OtherExtentType ext)
|
||||||
|
: ExtentType(ext), data_(data.p)
|
||||||
|
{}
|
||||||
|
|
||||||
|
template <class OtherExtentType>
|
||||||
|
constexpr storage_type(pointer data, OtherExtentType ext) : ExtentType(ext), data_(data)
|
||||||
|
{
|
||||||
|
Expects(data || ExtentType::size() == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
constexpr pointer data() const noexcept { return data_; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
pointer data_;
|
||||||
|
};
|
||||||
|
|
||||||
|
storage_type<details::extent_type<Extent>> storage_;
|
||||||
|
|
||||||
|
// The rest is needed to remove unnecessary null check
|
||||||
|
// in subspans and constructors from arrays
|
||||||
|
constexpr span(KnownNotNull ptr, size_type count) noexcept : storage_(ptr, count) {}
|
||||||
|
|
||||||
|
template <std::size_t CallerExtent>
|
||||||
|
class subspan_selector
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
template <std::size_t CallerExtent>
|
||||||
|
constexpr span<element_type, dynamic_extent>
|
||||||
|
make_subspan(size_type offset, size_type count, subspan_selector<CallerExtent>) const noexcept
|
||||||
|
{
|
||||||
|
const span<element_type, dynamic_extent> tmp(*this);
|
||||||
|
return tmp.subspan(offset, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr span<element_type, dynamic_extent>
|
||||||
|
make_subspan(size_type offset, size_type count, subspan_selector<dynamic_extent>) const noexcept
|
||||||
|
{
|
||||||
|
Expects(size() >= offset);
|
||||||
|
|
||||||
|
if (count == dynamic_extent) { return {KnownNotNull{data() + offset}, size() - offset}; }
|
||||||
|
|
||||||
|
Expects(size() - offset >= count);
|
||||||
|
return {KnownNotNull{data() + offset}, count};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#if (defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L))
|
||||||
|
|
||||||
|
// Deduction Guides
|
||||||
|
template <class Type, std::size_t Extent>
|
||||||
|
span(Type (&)[Extent]) -> span<Type, Extent>;
|
||||||
|
|
||||||
|
template <class Type, std::size_t Size>
|
||||||
|
span(std::array<Type, Size>&) -> span<Type, Size>;
|
||||||
|
|
||||||
|
template <class Type, std::size_t Size>
|
||||||
|
span(const std::array<Type, Size>&) -> span<const Type, Size>;
|
||||||
|
|
||||||
|
template <class Container,
|
||||||
|
class Element = std::remove_pointer_t<decltype(std::declval<Container&>().data())>>
|
||||||
|
span(Container&) -> span<Element>;
|
||||||
|
|
||||||
|
template <class Container,
|
||||||
|
class Element = std::remove_pointer_t<decltype(std::declval<const Container&>().data())>>
|
||||||
|
span(const Container&) -> span<Element>;
|
||||||
|
|
||||||
|
#endif // ( defined(__cpp_deduction_guides) && (__cpp_deduction_guides >= 201611L) )
|
||||||
|
|
||||||
|
#if defined(GSL_USE_STATIC_CONSTEXPR_WORKAROUND)
|
||||||
|
#if defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L)
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdeprecated" // Bug in clang-cl.exe which raises a C++17 -Wdeprecated warning about this static constexpr workaround in C++14 mode.
|
||||||
|
#endif // defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L)
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr const typename span<ElementType, Extent>::size_type span<ElementType, Extent>::extent;
|
||||||
|
#if defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L)
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif // defined(__clang__) && defined(_MSC_VER) && defined(__cplusplus) && (__cplusplus < 201703L)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace details
|
||||||
|
{
|
||||||
|
// if we only supported compilers with good constexpr support then
|
||||||
|
// this pair of classes could collapse down to a constexpr function
|
||||||
|
|
||||||
|
// we should use a narrow_cast<> to go to std::size_t, but older compilers may not see it as
|
||||||
|
// constexpr
|
||||||
|
// and so will fail compilation of the template
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
struct calculate_byte_size : std::integral_constant<std::size_t, sizeof(ElementType) * Extent>
|
||||||
|
{
|
||||||
|
static_assert(Extent < dynamic_extent / sizeof(ElementType), "Size is too big.");
|
||||||
|
};
|
||||||
|
|
||||||
|
template <class ElementType>
|
||||||
|
struct calculate_byte_size<ElementType, dynamic_extent>
|
||||||
|
: std::integral_constant<std::size_t, dynamic_extent>
|
||||||
|
{
|
||||||
|
};
|
||||||
|
} // namespace details
|
||||||
|
|
||||||
|
// [span.objectrep], views of object representation
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
span<const byte, details::calculate_byte_size<ElementType, Extent>::value>
|
||||||
|
as_bytes(span<ElementType, Extent> s) noexcept
|
||||||
|
{
|
||||||
|
using type = span<const byte, details::calculate_byte_size<ElementType, Extent>::value>;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return type{reinterpret_cast<const byte*>(s.data()), s.size_bytes()};
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent,
|
||||||
|
std::enable_if_t<!std::is_const<ElementType>::value, int> = 0>
|
||||||
|
span<byte, details::calculate_byte_size<ElementType, Extent>::value>
|
||||||
|
as_writable_bytes(span<ElementType, Extent> s) noexcept
|
||||||
|
{
|
||||||
|
using type = span<byte, details::calculate_byte_size<ElementType, Extent>::value>;
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return type{reinterpret_cast<byte*>(s.data()), s.size_bytes()};
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
|
||||||
|
#pragma warning(pop)
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && __GNUC__ > 6
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif // __GNUC__ > 6
|
||||||
|
|
||||||
|
#endif // GSL_SPAN_H
|
214
deps/GSL/include/gsl/span_ext
vendored
Normal file
214
deps/GSL/include/gsl/span_ext
vendored
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_SPAN_EXT_H
|
||||||
|
#define GSL_SPAN_EXT_H
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// File: span_ext
|
||||||
|
// Purpose: continue offering features that have been cut from the official
|
||||||
|
// implementation of span.
|
||||||
|
// While modernizing gsl::span a number of features needed to be removed to
|
||||||
|
// be compliant with the design of std::span
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "assert" // GSL_KERNEL_MODE
|
||||||
|
#include "util" // for narrow_cast, narrow
|
||||||
|
|
||||||
|
#include <cstddef> // for ptrdiff_t, size_t
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
|
#ifndef GSL_KERNEL_MODE
|
||||||
|
#include <algorithm> // for lexicographical_compare
|
||||||
|
#endif // GSL_KERNEL_MODE
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
|
||||||
|
// [span.views.constants], constants
|
||||||
|
GSL_INLINE constexpr const std::size_t dynamic_extent = narrow_cast<std::size_t>(-1);
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
class span;
|
||||||
|
|
||||||
|
// std::equal and std::lexicographical_compare are not /kernel compatible
|
||||||
|
// so all comparison operators must be removed for kernel mode.
|
||||||
|
#ifndef GSL_KERNEL_MODE
|
||||||
|
|
||||||
|
// [span.comparison], span comparison operators
|
||||||
|
template <class ElementType, std::size_t FirstExtent, std::size_t SecondExtent>
|
||||||
|
constexpr bool operator==(span<ElementType, FirstExtent> l, span<ElementType, SecondExtent> r)
|
||||||
|
{
|
||||||
|
return std::equal(l.begin(), l.end(), r.begin(), r.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator!=(span<ElementType, Extent> l, span<ElementType, Extent> r)
|
||||||
|
{
|
||||||
|
return !(l == r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator<(span<ElementType, Extent> l, span<ElementType, Extent> r)
|
||||||
|
{
|
||||||
|
return std::lexicographical_compare(l.begin(), l.end(), r.begin(), r.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator<=(span<ElementType, Extent> l, span<ElementType, Extent> r)
|
||||||
|
{
|
||||||
|
return !(l > r);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator>(span<ElementType, Extent> l, span<ElementType, Extent> r)
|
||||||
|
{
|
||||||
|
return r < l;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr bool operator>=(span<ElementType, Extent> l, span<ElementType, Extent> r)
|
||||||
|
{
|
||||||
|
return !(l < r);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // GSL_KERNEL_MODE
|
||||||
|
|
||||||
|
//
|
||||||
|
// make_span() - Utility functions for creating spans
|
||||||
|
//
|
||||||
|
template <class ElementType>
|
||||||
|
constexpr span<ElementType> make_span(ElementType* ptr, typename span<ElementType>::size_type count)
|
||||||
|
{
|
||||||
|
return span<ElementType>(ptr, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType>
|
||||||
|
constexpr span<ElementType> make_span(ElementType* firstElem, ElementType* lastElem)
|
||||||
|
{
|
||||||
|
return span<ElementType>(firstElem, lastElem);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t N>
|
||||||
|
constexpr span<ElementType, N> make_span(ElementType (&arr)[N]) noexcept
|
||||||
|
{
|
||||||
|
return span<ElementType, N>(arr);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
constexpr span<typename Container::value_type> make_span(Container& cont)
|
||||||
|
{
|
||||||
|
return span<typename Container::value_type>(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Container>
|
||||||
|
constexpr span<const typename Container::value_type> make_span(const Container& cont)
|
||||||
|
{
|
||||||
|
return span<const typename Container::value_type>(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Ptr>
|
||||||
|
[[deprecated("This function is deprecated. See GSL issue #1092.")]]
|
||||||
|
constexpr span<typename Ptr::element_type> make_span(Ptr& cont, std::size_t count)
|
||||||
|
{
|
||||||
|
return span<typename Ptr::element_type>(cont, count);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Ptr>
|
||||||
|
[[deprecated("This function is deprecated. See GSL issue #1092.")]]
|
||||||
|
constexpr span<typename Ptr::element_type> make_span(Ptr& cont)
|
||||||
|
{
|
||||||
|
return span<typename Ptr::element_type>(cont);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Specialization of gsl::at for span
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr ElementType& at(span<ElementType, Extent> s, index i)
|
||||||
|
{
|
||||||
|
// No bounds checking here because it is done in span::operator[] called below
|
||||||
|
Ensures(i >= 0);
|
||||||
|
return s[narrow_cast<std::size_t>(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
// [span.obs] Free observer functions
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr std::ptrdiff_t ssize(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<std::ptrdiff_t>(s.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
// [span.iter] Free functions for begin/end functions
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
begin(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
end(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
rbegin(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.rbegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
rend(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.rend();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
cbegin(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent = dynamic_extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::iterator
|
||||||
|
cend(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.end();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
crbegin(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.rbegin();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class ElementType, std::size_t Extent>
|
||||||
|
constexpr typename span<ElementType, Extent>::reverse_iterator
|
||||||
|
crend(const span<ElementType, Extent>& s) noexcept
|
||||||
|
{
|
||||||
|
return s.rend();
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#endif // GSL_SPAN_EXT_H
|
4
deps/GSL/include/gsl/string_span
vendored
Normal file
4
deps/GSL/include/gsl/string_span
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
#pragma message( \
|
||||||
|
"This header will soon be removed. Use <gsl/zstring> instead of <gsl/string_span>")
|
||||||
|
#include "zstring"
|
157
deps/GSL/include/gsl/util
vendored
Normal file
157
deps/GSL/include/gsl/util
vendored
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_UTIL_H
|
||||||
|
#define GSL_UTIL_H
|
||||||
|
|
||||||
|
#include "assert" // for Expects
|
||||||
|
|
||||||
|
#include <array>
|
||||||
|
#include <cstddef> // for ptrdiff_t, size_t
|
||||||
|
#include <limits> // for numeric_limits
|
||||||
|
#include <initializer_list> // for initializer_list
|
||||||
|
#include <type_traits> // for is_signed, integral_constant
|
||||||
|
#include <utility> // for exchange, forward
|
||||||
|
|
||||||
|
#if defined(__has_include) && __has_include(<version>)
|
||||||
|
#include <version>
|
||||||
|
#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||||
|
#include <span>
|
||||||
|
#endif // __cpp_lib_span >= 202002L
|
||||||
|
#endif //__has_include(<version>)
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4127) // conditional expression is constant
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
#define GSL_NODISCARD [[nodiscard]]
|
||||||
|
#else
|
||||||
|
#define GSL_NODISCARD
|
||||||
|
#endif // defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
|
||||||
|
#if defined(__cpp_inline_variables)
|
||||||
|
#define GSL_INLINE inline
|
||||||
|
#else
|
||||||
|
#define GSL_INLINE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// GSL.util: utilities
|
||||||
|
//
|
||||||
|
|
||||||
|
// index type for all container indexes/subscripts/sizes
|
||||||
|
using index = std::ptrdiff_t;
|
||||||
|
|
||||||
|
// final_action allows you to ensure something gets run at the end of a scope
|
||||||
|
template <class F>
|
||||||
|
class final_action
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit final_action(const F& ff) noexcept : f{ff} { }
|
||||||
|
explicit final_action(F&& ff) noexcept : f{std::move(ff)} { }
|
||||||
|
|
||||||
|
~final_action() noexcept { if (invoke) f(); }
|
||||||
|
|
||||||
|
final_action(final_action&& other) noexcept
|
||||||
|
: f(std::move(other.f)), invoke(std::exchange(other.invoke, false))
|
||||||
|
{ }
|
||||||
|
|
||||||
|
final_action(const final_action&) = delete;
|
||||||
|
void operator=(const final_action&) = delete;
|
||||||
|
void operator=(final_action&&) = delete;
|
||||||
|
|
||||||
|
private:
|
||||||
|
F f;
|
||||||
|
bool invoke = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
// finally() - convenience function to generate a final_action
|
||||||
|
template <class F>
|
||||||
|
GSL_NODISCARD auto finally(F&& f) noexcept
|
||||||
|
{
|
||||||
|
return final_action<std::decay_t<F>>{std::forward<F>(f)};
|
||||||
|
}
|
||||||
|
|
||||||
|
// narrow_cast(): a searchable way to do narrowing casts of values
|
||||||
|
template <class T, class U>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr T narrow_cast(U&& u) noexcept
|
||||||
|
{
|
||||||
|
return static_cast<T>(std::forward<U>(u));
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// at() - Bounds-checked way of accessing builtin arrays, std::array, std::vector
|
||||||
|
//
|
||||||
|
template <class T, std::size_t N>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.4) // NO-FORMAT: attribute
|
||||||
|
GSL_SUPPRESS(bounds.2) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr T& at(T (&arr)[N], const index i)
|
||||||
|
{
|
||||||
|
static_assert(N <= static_cast<std::size_t>((std::numeric_limits<std::ptrdiff_t>::max)()), "We only support arrays up to PTRDIFF_MAX bytes.");
|
||||||
|
Expects(i >= 0 && i < narrow_cast<index>(N));
|
||||||
|
return arr[narrow_cast<std::size_t>(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class Cont>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.4) // NO-FORMAT: attribute
|
||||||
|
GSL_SUPPRESS(bounds.2) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr auto at(Cont& cont, const index i) -> decltype(cont[cont.size()])
|
||||||
|
{
|
||||||
|
Expects(i >= 0 && i < narrow_cast<index>(cont.size()));
|
||||||
|
using size_type = decltype(cont.size());
|
||||||
|
return cont[narrow_cast<size_type>(i)];
|
||||||
|
}
|
||||||
|
|
||||||
|
template <class T>
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(bounds.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
constexpr T at(const std::initializer_list<T> cont, const index i)
|
||||||
|
{
|
||||||
|
Expects(i >= 0 && i < narrow_cast<index>(cont.size()));
|
||||||
|
return *(cont.begin() + i);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||||
|
template <class T, std::size_t extent = std::dynamic_extent>
|
||||||
|
constexpr auto at(std::span<T, extent> sp, const index i) -> decltype(sp[sp.size()])
|
||||||
|
{
|
||||||
|
Expects(i >= 0 && i < narrow_cast<index>(sp.size()));
|
||||||
|
return sp[gsl::narrow_cast<std::size_t>(i)];
|
||||||
|
}
|
||||||
|
#endif // __cpp_lib_span >= 202002L
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#if defined(_MSC_VER) && !defined(__clang__)
|
||||||
|
|
||||||
|
#pragma warning(pop)
|
||||||
|
|
||||||
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
#endif // GSL_UTIL_H
|
58
deps/GSL/include/gsl/zstring
vendored
Normal file
58
deps/GSL/include/gsl/zstring
vendored
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GSL_ZSTRING_H
|
||||||
|
#define GSL_ZSTRING_H
|
||||||
|
|
||||||
|
#include "span_ext" // for dynamic_extent
|
||||||
|
|
||||||
|
#include <cstddef> // for size_t, nullptr_t
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// czstring and wzstring
|
||||||
|
//
|
||||||
|
// These are "tag" typedefs for C-style strings (i.e. null-terminated character arrays)
|
||||||
|
// that allow static analysis to help find bugs.
|
||||||
|
//
|
||||||
|
// There are no additional features/semantics that we can find a way to add inside the
|
||||||
|
// type system for these types that will not either incur significant runtime costs or
|
||||||
|
// (sometimes needlessly) break existing programs when introduced.
|
||||||
|
//
|
||||||
|
|
||||||
|
template <typename CharT, std::size_t Extent = dynamic_extent>
|
||||||
|
using basic_zstring = CharT*;
|
||||||
|
|
||||||
|
using czstring = basic_zstring<const char, dynamic_extent>;
|
||||||
|
|
||||||
|
using cwzstring = basic_zstring<const wchar_t, dynamic_extent>;
|
||||||
|
|
||||||
|
using cu16zstring = basic_zstring<const char16_t, dynamic_extent>;
|
||||||
|
|
||||||
|
using cu32zstring = basic_zstring<const char32_t, dynamic_extent>;
|
||||||
|
|
||||||
|
using zstring = basic_zstring<char, dynamic_extent>;
|
||||||
|
|
||||||
|
using wzstring = basic_zstring<wchar_t, dynamic_extent>;
|
||||||
|
|
||||||
|
using u16zstring = basic_zstring<char16_t, dynamic_extent>;
|
||||||
|
|
||||||
|
using u32zstring = basic_zstring<char32_t, dynamic_extent>;
|
||||||
|
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
#endif // GSL_ZSTRING_H
|
43
deps/GSL/pipelines/jobs.yml
vendored
Normal file
43
deps/GSL/pipelines/jobs.yml
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
parameters:
|
||||||
|
CXXVersions: [ 14, 17, 20 ]
|
||||||
|
buildTypes: [ 'Debug', 'Release' ]
|
||||||
|
image: ''
|
||||||
|
|
||||||
|
compiler: ''
|
||||||
|
compilerVersions: ["default"] # if default value, simply uses whatever version is on the machine.
|
||||||
|
# the text of this default value doesn't actually matter.
|
||||||
|
setupfile: ''
|
||||||
|
extraCmakeArgs: ''
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
- ${{ each compilerVersion in parameters.compilerVersions }}:
|
||||||
|
- ${{ each CXXVersion in parameters.CXXVersions }}:
|
||||||
|
- ${{ each buildType in parameters.buildTypes }}:
|
||||||
|
- job:
|
||||||
|
displayName: ${{ format('{0} {1} C++{2} {3}', parameters.compiler, compilerVersion, CXXVersion, buildType) }}
|
||||||
|
pool:
|
||||||
|
vmImage: ${{ parameters.image }}
|
||||||
|
continueOnError: false
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- ${{ if not(eq(parameters.setupfile, '')) }}:
|
||||||
|
- template: ${{ parameters.setupfile }}
|
||||||
|
parameters:
|
||||||
|
version: ${{ compilerVersion }}
|
||||||
|
|
||||||
|
- task: CMake@1
|
||||||
|
name: Configure
|
||||||
|
inputs:
|
||||||
|
workingDirectory: build
|
||||||
|
cmakeArgs: '-DGSL_CXX_STANDARD=${{ CXXVersion }} -DCMAKE_BUILD_TYPE=${{ buildType }} -DCI_TESTING:BOOL=ON -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -Werror=dev ${{ parameters.extraCmakeArgs }} .. '
|
||||||
|
|
||||||
|
- task: CMake@1
|
||||||
|
name: Build
|
||||||
|
inputs:
|
||||||
|
workingDirectory: build
|
||||||
|
cmakeArgs: '--build . '
|
||||||
|
|
||||||
|
- script: ctest . --output-on-failure --no-compress-output
|
||||||
|
name: CTest
|
||||||
|
workingDirectory: build
|
||||||
|
failOnStderr: true
|
9
deps/GSL/pipelines/setup_apple.yml
vendored
Normal file
9
deps/GSL/pipelines/setup_apple.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
parameters:
|
||||||
|
version: 0
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
if [ "${{ parameters.version }}" != "default" ]; then sudo xcode-select -switch /Applications/Xcode_${{ parameters.version }}.app; fi
|
||||||
|
|
||||||
|
displayName: "Setup Xcode Version"
|
||||||
|
failOnStderr: true
|
13
deps/GSL/pipelines/setup_clang.yml
vendored
Normal file
13
deps/GSL/pipelines/setup_clang.yml
vendored
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
parameters:
|
||||||
|
version: 0
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo "##vso[task.setvariable variable=CXX;]${CXX}"
|
||||||
|
echo "##vso[task.setvariable variable=CC;]${CC}"
|
||||||
|
|
||||||
|
displayName: "Setup Clang Version"
|
||||||
|
failOnStderr: true
|
||||||
|
env:
|
||||||
|
CC: clang-${{ parameters.version }}
|
||||||
|
CXX: clang++-${{ parameters.version }}
|
14
deps/GSL/pipelines/setup_gcc.yml
vendored
Normal file
14
deps/GSL/pipelines/setup_gcc.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
parameters:
|
||||||
|
version: 0
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- script: |
|
||||||
|
echo "##vso[task.setvariable variable=CXX;]${CXX}"
|
||||||
|
echo "##vso[task.setvariable variable=CC;]${CC}"
|
||||||
|
if [ "${{ parameters.version }}" = "11" ]; then sudo apt-get install $CXX; fi
|
||||||
|
|
||||||
|
displayName: "Setup GCC Version"
|
||||||
|
failOnStderr: true
|
||||||
|
env:
|
||||||
|
CC: gcc-${{ parameters.version }}
|
||||||
|
CXX: g++-${{ parameters.version }}
|
0
deps/GSL/pipelines/steps.yml
vendored
Normal file
0
deps/GSL/pipelines/steps.yml
vendored
Normal file
316
deps/GSL/tests/CMakeLists.txt
vendored
Normal file
316
deps/GSL/tests/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,316 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.14...3.16)
|
||||||
|
|
||||||
|
project(GSLTests LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(GSL_CXX_STANDARD "14" CACHE STRING "Use c++ standard")
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD ${GSL_CXX_STANDARD})
|
||||||
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
include(FindPkgConfig)
|
||||||
|
include(ExternalProject)
|
||||||
|
|
||||||
|
# will make visual studio generated project group files
|
||||||
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||||
|
|
||||||
|
if(CI_TESTING AND GSL_CXX_STANDARD EQUAL 20)
|
||||||
|
add_compile_definitions(FORCE_STD_SPAN_TESTS=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(IOS)
|
||||||
|
add_compile_definitions(GTEST_HAS_DEATH_TEST=1 IOS_PROCESS_DELAY_WORKAROUND=1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
pkg_search_module(GTestMain gtest_main)
|
||||||
|
if (NOT GTestMain_FOUND)
|
||||||
|
# No pre-installed GTest is available, try to download it using Git.
|
||||||
|
find_package(Git REQUIRED QUIET)
|
||||||
|
|
||||||
|
configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt)
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
|
||||||
|
)
|
||||||
|
if(result)
|
||||||
|
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
execute_process(
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build .
|
||||||
|
RESULT_VARIABLE result
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download
|
||||||
|
)
|
||||||
|
if(result)
|
||||||
|
message(FATAL_ERROR "CMake step for googletest failed: ${result}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||||
|
set(GTestMain_LIBRARIES gtest_main)
|
||||||
|
|
||||||
|
add_subdirectory(
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/googletest-src
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/googletest-build
|
||||||
|
EXCLUDE_FROM_ALL
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
||||||
|
find_package(Microsoft.GSL CONFIG REQUIRED)
|
||||||
|
enable_testing()
|
||||||
|
|
||||||
|
if (NOT DEFINED Microsoft.GSL_VERSION)
|
||||||
|
message(FATAL_ERROR "Microsoft.GSL_VERSION not defined!")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Microsoft.GSL_VERSION = ${Microsoft.GSL_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (MSVC AND (GSL_CXX_STANDARD GREATER_EQUAL 17))
|
||||||
|
set(GSL_CPLUSPLUS_OPT -Zc:__cplusplus -permissive-)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
|
# this interface adds compile options to how the tests are run
|
||||||
|
# please try to keep entries ordered =)
|
||||||
|
add_library(gsl_tests_config INTERFACE)
|
||||||
|
if(MSVC) # MSVC or simulating MSVC
|
||||||
|
target_compile_options(gsl_tests_config INTERFACE
|
||||||
|
${GSL_CPLUSPLUS_OPT}
|
||||||
|
/EHsc
|
||||||
|
/W4
|
||||||
|
/WX
|
||||||
|
$<$<CXX_COMPILER_ID:MSVC>:
|
||||||
|
/wd4996 # Use of function or classes marked [[deprecated]]
|
||||||
|
/wd26409 # CppCoreCheck - GTest
|
||||||
|
/wd26426 # CppCoreCheck - GTest
|
||||||
|
/wd26440 # CppCoreCheck - GTest
|
||||||
|
/wd26446 # CppCoreCheck - prefer gsl::at()
|
||||||
|
/wd26472 # CppCoreCheck - use gsl::narrow(_cast)
|
||||||
|
/wd26481 # CppCoreCheck - use span instead of pointer arithmetic
|
||||||
|
$<$<VERSION_LESS:$<CXX_COMPILER_VERSION>,1920>: # VS2015
|
||||||
|
/wd4189 # variable is initialized but not referenced
|
||||||
|
$<$<NOT:$<CONFIG:Debug>>: # Release, RelWithDebInfo
|
||||||
|
/wd4702 # Unreachable code
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:Clang>:
|
||||||
|
-Weverything
|
||||||
|
-Wfloat-equal
|
||||||
|
-Wno-c++98-compat
|
||||||
|
-Wno-c++98-compat-pedantic
|
||||||
|
-Wno-covered-switch-default # GTest
|
||||||
|
-Wno-deprecated-declarations # Allow tests for [[deprecated]] elements
|
||||||
|
-Wno-global-constructors # GTest
|
||||||
|
-Wno-language-extension-token # GTest gtest-port.h
|
||||||
|
-Wno-missing-braces
|
||||||
|
-Wno-missing-prototypes
|
||||||
|
-Wno-shift-sign-overflow # GTest gtest-port.h
|
||||||
|
-Wno-undef # GTest
|
||||||
|
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
||||||
|
-Wno-unused-member-function
|
||||||
|
-Wno-unused-variable
|
||||||
|
$<$<VERSION_EQUAL:$<CXX_COMPILER_VERSION>,15.0.1>:
|
||||||
|
-Wno-deprecated # False positive in MSVC Clang 15.0.1 raises a C++17 warning
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
)
|
||||||
|
check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID)
|
||||||
|
if (WARN_RESERVED_ID)
|
||||||
|
target_compile_options(gsl_tests_config INTERFACE "-Wno-reserved-identifier")
|
||||||
|
endif()
|
||||||
|
check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER)
|
||||||
|
if (WARN_UNSAFE_BUFFER)
|
||||||
|
# This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer"
|
||||||
|
target_compile_options(gsl_tests_config INTERFACE "-Wno-unsafe-buffer-usage")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_compile_options(gsl_tests_config INTERFACE
|
||||||
|
-fno-strict-aliasing
|
||||||
|
-Wall
|
||||||
|
-Wcast-align
|
||||||
|
-Wconversion
|
||||||
|
-Wctor-dtor-privacy
|
||||||
|
-Werror
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Wshadow
|
||||||
|
-Wsign-conversion
|
||||||
|
-Wfloat-equal
|
||||||
|
-Wno-deprecated-declarations # Allow tests for [[deprecated]] elements
|
||||||
|
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
|
||||||
|
-Weverything
|
||||||
|
-Wno-c++98-compat
|
||||||
|
-Wno-c++98-compat-pedantic
|
||||||
|
-Wno-missing-braces
|
||||||
|
-Wno-covered-switch-default # GTest
|
||||||
|
-Wno-global-constructors # GTest
|
||||||
|
-Wno-missing-prototypes
|
||||||
|
-Wno-padded
|
||||||
|
-Wno-unknown-attributes
|
||||||
|
-Wno-used-but-marked-unused # GTest EXPECT_DEATH
|
||||||
|
-Wno-weak-vtables
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
||||||
|
-Wno-unused-member-function
|
||||||
|
-Wno-unused-variable
|
||||||
|
>
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:Clang>:
|
||||||
|
$<$<AND:$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,4.99>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template>
|
||||||
|
>
|
||||||
|
$<$<AND:$<EQUAL:${GSL_CXX_STANDARD},20>,$<OR:$<CXX_COMPILER_VERSION:11.0.0>,$<CXX_COMPILER_VERSION:10.0.0>>>:
|
||||||
|
-Wno-zero-as-null-pointer-constant # failing Clang Ubuntu 20.04 tests, seems to be a bug with clang 10.0.0
|
||||||
|
# and clang 11.0.0. (operator< is being re-written by the compiler
|
||||||
|
# as operator<=> and raising the warning)
|
||||||
|
>
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:AppleClang>:
|
||||||
|
$<$<AND:$<VERSION_GREATER:$<CXX_COMPILER_VERSION>,9.1>,$<VERSION_LESS:$<CXX_COMPILER_VERSION>,10>>:
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},17>:-Wno-undefined-func-template>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:GNU>:
|
||||||
|
-Wdouble-promotion # float implicit to double
|
||||||
|
-Wlogical-op # suspicious uses of logical operators
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
|
||||||
|
-Wduplicated-cond # duplicated if-else conditions
|
||||||
|
-Wmisleading-indentation
|
||||||
|
-Wnull-dereference
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>: # no support for [[maybe_unused]]
|
||||||
|
-Wno-unused-variable
|
||||||
|
>
|
||||||
|
>
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,7>>:
|
||||||
|
-Wduplicated-branches # identical if-else branches
|
||||||
|
>
|
||||||
|
>
|
||||||
|
)
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
# for tests to find the gtest header
|
||||||
|
target_include_directories(gsl_tests_config SYSTEM INTERFACE
|
||||||
|
googletest/googletest/include
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(gsl_tests
|
||||||
|
algorithm_tests.cpp
|
||||||
|
assertion_tests.cpp
|
||||||
|
at_tests.cpp
|
||||||
|
byte_tests.cpp
|
||||||
|
notnull_tests.cpp
|
||||||
|
owner_tests.cpp
|
||||||
|
span_compatibility_tests.cpp
|
||||||
|
span_ext_tests.cpp
|
||||||
|
span_tests.cpp
|
||||||
|
strict_notnull_tests.cpp
|
||||||
|
|
||||||
|
utils_tests.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(gsl_tests
|
||||||
|
Microsoft.GSL::GSL
|
||||||
|
gsl_tests_config
|
||||||
|
${GTestMain_LIBRARIES}
|
||||||
|
)
|
||||||
|
add_test(gsl_tests gsl_tests)
|
||||||
|
|
||||||
|
# No exception tests
|
||||||
|
|
||||||
|
foreach(flag_var
|
||||||
|
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
|
||||||
|
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
|
||||||
|
STRING (REGEX REPLACE "/EHsc" "" ${flag_var} "${${flag_var}}")
|
||||||
|
endforeach(flag_var)
|
||||||
|
|
||||||
|
# this interface adds compile options to how the tests are run
|
||||||
|
# please try to keep entries ordered =)
|
||||||
|
add_library(gsl_tests_config_noexcept INTERFACE)
|
||||||
|
if(MSVC) # MSVC or simulating MSVC
|
||||||
|
target_compile_definitions(gsl_tests_config_noexcept INTERFACE
|
||||||
|
_HAS_EXCEPTIONS=0 # disable exceptions in the Microsoft STL
|
||||||
|
)
|
||||||
|
target_compile_options(gsl_tests_config_noexcept INTERFACE
|
||||||
|
${GSL_CPLUSPLUS_OPT}
|
||||||
|
/W4
|
||||||
|
/WX
|
||||||
|
$<$<CXX_COMPILER_ID:MSVC>:
|
||||||
|
/wd4577
|
||||||
|
/wd4702
|
||||||
|
/wd26440 # CppCoreCheck - GTest
|
||||||
|
/wd26446 # CppCoreCheck - prefer gsl::at()
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:Clang>:
|
||||||
|
-Weverything
|
||||||
|
-Wfloat-equal
|
||||||
|
-Wno-c++98-compat
|
||||||
|
-Wno-c++98-compat-pedantic
|
||||||
|
-Wno-missing-prototypes
|
||||||
|
-Wno-unknown-attributes
|
||||||
|
$<$<EQUAL:${GSL_CXX_STANDARD},14>:
|
||||||
|
$<$<VERSION_EQUAL:$<CXX_COMPILER_VERSION>,15.0.1>:
|
||||||
|
-Wno-deprecated # False positive in MSVC Clang 15.0.1 raises a C++17 warning
|
||||||
|
>
|
||||||
|
>
|
||||||
|
>
|
||||||
|
)
|
||||||
|
check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID)
|
||||||
|
if (WARN_RESERVED_ID)
|
||||||
|
target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-reserved-identifier")
|
||||||
|
endif()
|
||||||
|
check_cxx_compiler_flag("-Wno-unsafe-buffer-usage" WARN_UNSAFE_BUFFER)
|
||||||
|
if (WARN_UNSAFE_BUFFER)
|
||||||
|
# This test uses very greedy heuristics such as "no pointer arithmetic on raw buffer"
|
||||||
|
target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-unsafe-buffer-usage")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
target_compile_options(gsl_tests_config_noexcept INTERFACE
|
||||||
|
-fno-exceptions
|
||||||
|
-fno-strict-aliasing
|
||||||
|
-Wall
|
||||||
|
-Wcast-align
|
||||||
|
-Wconversion
|
||||||
|
-Wctor-dtor-privacy
|
||||||
|
-Werror
|
||||||
|
-Wextra
|
||||||
|
-Wpedantic
|
||||||
|
-Wshadow
|
||||||
|
-Wsign-conversion
|
||||||
|
-Wfloat-equal
|
||||||
|
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>>:
|
||||||
|
-Weverything
|
||||||
|
-Wno-c++98-compat
|
||||||
|
-Wno-c++98-compat-pedantic
|
||||||
|
-Wno-missing-prototypes
|
||||||
|
-Wno-unknown-attributes
|
||||||
|
-Wno-weak-vtables
|
||||||
|
>
|
||||||
|
$<$<CXX_COMPILER_ID:GNU>:
|
||||||
|
-Wdouble-promotion # float implicit to double
|
||||||
|
-Wlogical-op # suspicious uses of logical operators
|
||||||
|
-Wuseless-cast # casting to its own type
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,6>>:
|
||||||
|
-Wduplicated-cond # duplicated if-else conditions
|
||||||
|
-Wmisleading-indentation
|
||||||
|
-Wnull-dereference
|
||||||
|
>
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,7>>:
|
||||||
|
-Wduplicated-branches # identical if-else branches
|
||||||
|
>
|
||||||
|
$<$<NOT:$<VERSION_LESS:$<CXX_COMPILER_VERSION>,8>>:
|
||||||
|
-Wcast-align=strict # increase alignment (i.e. char* to int*)
|
||||||
|
>
|
||||||
|
>
|
||||||
|
)
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
add_executable(gsl_noexcept_tests no_exception_ensure_tests.cpp)
|
||||||
|
target_link_libraries(gsl_noexcept_tests
|
||||||
|
Microsoft.GSL::GSL
|
||||||
|
gsl_tests_config_noexcept
|
||||||
|
)
|
||||||
|
add_test(gsl_noexcept_tests gsl_noexcept_tests)
|
14
deps/GSL/tests/CMakeLists.txt.in
vendored
Normal file
14
deps/GSL/tests/CMakeLists.txt.in
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
project(googletest-download NONE)
|
||||||
|
|
||||||
|
include(ExternalProject)
|
||||||
|
ExternalProject_Add(googletest
|
||||||
|
GIT_REPOSITORY https://github.com/google/googletest.git
|
||||||
|
GIT_TAG 1b18723e874b256c1e39378c6774a90701d70f7a
|
||||||
|
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src"
|
||||||
|
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build"
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
|
TEST_COMMAND ""
|
||||||
|
)
|
224
deps/GSL/tests/algorithm_tests.cpp
vendored
Normal file
224
deps/GSL/tests/algorithm_tests.cpp
vendored
Normal file
@ -0,0 +1,224 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <array> // for array
|
||||||
|
#include <cstddef> // for size_t
|
||||||
|
#include <gsl/algorithm> // for copy
|
||||||
|
#include <gsl/span> // for span
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
|
||||||
|
namespace gsl
|
||||||
|
{
|
||||||
|
struct fail_fast;
|
||||||
|
} // namespace gsl
|
||||||
|
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
TEST(algorithm_tests, same_type)
|
||||||
|
{
|
||||||
|
// dynamic source and destination span
|
||||||
|
{
|
||||||
|
std::array<int, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<int> src_span(src);
|
||||||
|
const span<int> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static source and dynamic destination span
|
||||||
|
{
|
||||||
|
std::array<int, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<int, 5> src_span(src);
|
||||||
|
const span<int> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dynamic source and static destination span
|
||||||
|
{
|
||||||
|
std::array<int, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const gsl::span<int> src_span(src);
|
||||||
|
const gsl::span<int, 10> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static source and destination span
|
||||||
|
{
|
||||||
|
std::array<int, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<int, 5> src_span(src);
|
||||||
|
const span<int, 10> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(algorithm_tests, compatible_type)
|
||||||
|
{
|
||||||
|
// dynamic source and destination span
|
||||||
|
{
|
||||||
|
std::array<short, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<short> src_span(src);
|
||||||
|
const span<int> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static source and dynamic destination span
|
||||||
|
{
|
||||||
|
std::array<short, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<short, 5> src_span(src);
|
||||||
|
const span<int> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dynamic source and static destination span
|
||||||
|
{
|
||||||
|
std::array<short, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<short> src_span(src);
|
||||||
|
const span<int, 10> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// static source and destination span
|
||||||
|
{
|
||||||
|
std::array<short, 5> src{1, 2, 3, 4, 5};
|
||||||
|
std::array<int, 10> dst{};
|
||||||
|
|
||||||
|
const span<short, 5> src_span(src);
|
||||||
|
const span<int, 10> dst_span(dst);
|
||||||
|
|
||||||
|
copy(src_span, dst_span);
|
||||||
|
copy(src_span, dst_span.subspan(src_span.size()));
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < src.size(); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(dst[i] == src[i]);
|
||||||
|
EXPECT_TRUE(dst[i + src.size()] == src[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
TEST(algorithm_tests, incompatible_type)
|
||||||
|
{
|
||||||
|
std::array<int, 4> src{1, 2, 3, 4};
|
||||||
|
std::array<int*, 12> dst{};
|
||||||
|
|
||||||
|
span<int> src_span_dyn(src);
|
||||||
|
span<int, 4> src_span_static(src);
|
||||||
|
span<int*> dst_span_dyn(dst);
|
||||||
|
span<int*, 4> dst_span_static(dst);
|
||||||
|
|
||||||
|
// every line should produce a compilation error
|
||||||
|
copy(src_span_dyn, dst_span_dyn);
|
||||||
|
copy(src_span_dyn, dst_span_static);
|
||||||
|
copy(src_span_static, dst_span_dyn);
|
||||||
|
copy(src_span_static, dst_span_static);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
TEST(algorithm_tests, small_destination_span)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. small_destination_span";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
std::array<int, 12> src{1, 2, 3, 4};
|
||||||
|
std::array<int, 4> dst{};
|
||||||
|
|
||||||
|
const span<int> src_span_dyn(src);
|
||||||
|
const span<int, 12> src_span_static(src);
|
||||||
|
const span<int> dst_span_dyn(dst);
|
||||||
|
const span<int, 4> dst_span_static(dst);
|
||||||
|
|
||||||
|
EXPECT_DEATH(copy(src_span_dyn, dst_span_dyn), expected);
|
||||||
|
EXPECT_DEATH(copy(src_span_dyn, dst_span_static), expected);
|
||||||
|
EXPECT_DEATH(copy(src_span_static, dst_span_dyn), expected);
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
copy(src_span_static, dst_span_static);
|
||||||
|
#endif
|
||||||
|
}
|
60
deps/GSL/tests/assertion_tests.cpp
vendored
Normal file
60
deps/GSL/tests/assertion_tests.cpp
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
#include <gsl/assert> // for Ensures, Expects
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
|
int f(int i)
|
||||||
|
{
|
||||||
|
Expects(i > 0 && i < 10);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int g(int i)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
Ensures(i > 0 && i < 10);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST(assertion_tests, expects)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. expects";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
|
||||||
|
EXPECT_TRUE(f(2) == 2);
|
||||||
|
EXPECT_DEATH(f(10), GetExpectedDeathString(terminateHandler));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(assertion_tests, ensures)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. ensures";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
|
||||||
|
EXPECT_TRUE(g(2) == 3);
|
||||||
|
EXPECT_DEATH(g(9), GetExpectedDeathString(terminateHandler));
|
||||||
|
}
|
173
deps/GSL/tests/at_tests.cpp
vendored
Normal file
173
deps/GSL/tests/at_tests.cpp
vendored
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <gsl/util> // for at
|
||||||
|
|
||||||
|
#include <array> // for array
|
||||||
|
#include <cstddef> // for size_t
|
||||||
|
#include <exception> // for terminate
|
||||||
|
#include <initializer_list> // for initializer_list
|
||||||
|
#include <vector> // for vector
|
||||||
|
#if defined(__cplusplus) && __cplusplus >= 202002L
|
||||||
|
#include <span>
|
||||||
|
#endif // __cplusplus >= 202002L
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
|
||||||
|
TEST(at_tests, static_array)
|
||||||
|
{
|
||||||
|
int a[4] = {1, 2, 3, 4};
|
||||||
|
const int(&c_a)[4] = a;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(&gsl::at(a, i) == &a[i]);
|
||||||
|
EXPECT_TRUE(&gsl::at(c_a, i) == &a[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. static_array";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(a, 4), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, 4), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(at_tests, std_array)
|
||||||
|
{
|
||||||
|
std::array<int, 4> a = {1, 2, 3, 4};
|
||||||
|
const std::array<int, 4>& c_a = a;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(&gsl::at(a, i) == &a[static_cast<std::size_t>(i)]);
|
||||||
|
EXPECT_TRUE(&gsl::at(c_a, i) == &a[static_cast<std::size_t>(i)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. std_array";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(a, 4), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, 4), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(at_tests, std_vector)
|
||||||
|
{
|
||||||
|
std::vector<int> a = {1, 2, 3, 4};
|
||||||
|
const std::vector<int>& c_a = a;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(&gsl::at(a, i) == &a[static_cast<std::size_t>(i)]);
|
||||||
|
EXPECT_TRUE(&gsl::at(c_a, i) == &a[static_cast<std::size_t>(i)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. std_vector";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(a, 4), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(c_a, 4), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(at_tests, InitializerList)
|
||||||
|
{
|
||||||
|
const std::initializer_list<int> a = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(gsl::at(a, i) == i + 1);
|
||||||
|
EXPECT_TRUE(gsl::at({1, 2, 3, 4}, i) == i + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. InitializerList";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(a, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(a, 4), expected);
|
||||||
|
EXPECT_DEATH(gsl::at({1, 2, 3, 4}, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at({1, 2, 3, 4}, 4), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(FORCE_STD_SPAN_TESTS) || defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||||
|
TEST(at_tests, std_span)
|
||||||
|
{
|
||||||
|
std::vector<int> vec{1, 2, 3, 4, 5};
|
||||||
|
std::span sp{vec};
|
||||||
|
|
||||||
|
std::vector<int> cvec{1, 2, 3, 4, 5};
|
||||||
|
std::span csp{cvec};
|
||||||
|
|
||||||
|
for (gsl::index i = 0; i < gsl::narrow_cast<gsl::index>(vec.size()); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(&gsl::at(sp, i) == &vec[gsl::narrow_cast<size_t>(i)]);
|
||||||
|
EXPECT_TRUE(&gsl::at(csp, i) == &cvec[gsl::narrow_cast<size_t>(i)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. std_span";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(sp, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(sp, gsl::narrow_cast<gsl::index>(sp.size())), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(csp, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(csp, gsl::narrow_cast<gsl::index>(sp.size())), expected);
|
||||||
|
}
|
||||||
|
#endif // defined(FORCE_STD_SPAN_TESTS) || defined(__cpp_lib_span) && __cpp_lib_span >= 202002L
|
||||||
|
|
||||||
|
#if !defined(_MSC_VER) || defined(__clang__) || _MSC_VER >= 1910
|
||||||
|
static constexpr bool test_constexpr()
|
||||||
|
{
|
||||||
|
int a1[4] = {1, 2, 3, 4};
|
||||||
|
const int(&c_a1)[4] = a1;
|
||||||
|
std::array<int, 4> a2 = {1, 2, 3, 4};
|
||||||
|
const std::array<int, 4>& c_a2 = a2;
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i)
|
||||||
|
{
|
||||||
|
if (&gsl::at(a1, i) != &a1[i]) return false;
|
||||||
|
if (&gsl::at(c_a1, i) != &a1[i]) return false;
|
||||||
|
// requires C++17:
|
||||||
|
// if (&gsl::at(a2, i) != &a2[static_cast<std::size_t>(i)]) return false;
|
||||||
|
if (&gsl::at(c_a2, i) != &c_a2[static_cast<std::size_t>(i)]) return false;
|
||||||
|
if (gsl::at({1, 2, 3, 4}, i) != i + 1) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static_assert(test_constexpr(), "FAIL");
|
||||||
|
#endif
|
134
deps/GSL/tests/byte_tests.cpp
vendored
Normal file
134
deps/GSL/tests/byte_tests.cpp
vendored
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <gsl/byte> // for to_byte, to_integer, byte, operator&, ope...
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
int modify_both(gsl::byte& b, int& i)
|
||||||
|
{
|
||||||
|
i = 10;
|
||||||
|
b = to_byte<5>();
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(byte_tests, construction)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
const byte b = static_cast<byte>(4);
|
||||||
|
EXPECT_TRUE(static_cast<unsigned char>(b) == 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const byte b = byte(12);
|
||||||
|
EXPECT_TRUE(static_cast<unsigned char>(b) == 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const byte b = to_byte<12>();
|
||||||
|
EXPECT_TRUE(static_cast<unsigned char>(b) == 12);
|
||||||
|
}
|
||||||
|
{
|
||||||
|
const unsigned char uc = 12;
|
||||||
|
const byte b = to_byte(uc);
|
||||||
|
EXPECT_TRUE(static_cast<unsigned char>(b) == 12);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
{
|
||||||
|
const byte b{14};
|
||||||
|
EXPECT_TRUE(static_cast<unsigned char>(b) == 14);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
to_byte(char{});
|
||||||
|
to_byte(3);
|
||||||
|
to_byte(3u);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(byte_tests, bitwise_operations)
|
||||||
|
{
|
||||||
|
const byte b = to_byte<0xFF>();
|
||||||
|
|
||||||
|
byte a = to_byte<0x00>();
|
||||||
|
EXPECT_TRUE((b | a) == to_byte<0xFF>());
|
||||||
|
EXPECT_TRUE(a == to_byte<0x00>());
|
||||||
|
|
||||||
|
a |= b;
|
||||||
|
EXPECT_TRUE(a == to_byte<0xFF>());
|
||||||
|
|
||||||
|
a = to_byte<0x01>();
|
||||||
|
EXPECT_TRUE((b & a) == to_byte<0x01>());
|
||||||
|
|
||||||
|
a &= b;
|
||||||
|
EXPECT_TRUE(a == to_byte<0x01>());
|
||||||
|
|
||||||
|
EXPECT_TRUE((b ^ a) == to_byte<0xFE>());
|
||||||
|
|
||||||
|
EXPECT_TRUE(a == to_byte<0x01>());
|
||||||
|
a ^= b;
|
||||||
|
EXPECT_TRUE(a == to_byte<0xFE>());
|
||||||
|
|
||||||
|
a = to_byte<0x01>();
|
||||||
|
EXPECT_TRUE(~a == to_byte<0xFE>());
|
||||||
|
|
||||||
|
a = to_byte<0xFF>();
|
||||||
|
EXPECT_TRUE((a << 4) == to_byte<0xF0>());
|
||||||
|
EXPECT_TRUE((a >> 4) == to_byte<0x0F>());
|
||||||
|
|
||||||
|
a <<= 4;
|
||||||
|
EXPECT_TRUE(a == to_byte<0xF0>());
|
||||||
|
a >>= 4;
|
||||||
|
EXPECT_TRUE(a == to_byte<0x0F>());
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(byte_tests, to_integer)
|
||||||
|
{
|
||||||
|
const byte b = to_byte<0x12>();
|
||||||
|
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<char>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<short>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<long>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<long long>(b));
|
||||||
|
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<unsigned char>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<unsigned short>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<unsigned long>(b));
|
||||||
|
EXPECT_TRUE(0x12 == gsl::to_integer<unsigned long long>(b));
|
||||||
|
|
||||||
|
// EXPECT_TRUE(0x12 == gsl::to_integer<float>(b)); // expect compile-time error
|
||||||
|
// EXPECT_TRUE(0x12 == gsl::to_integer<double>(b)); // expect compile-time error
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(byte_tests, aliasing)
|
||||||
|
{
|
||||||
|
int i{0};
|
||||||
|
const int res = modify_both(reinterpret_cast<byte&>(i), i);
|
||||||
|
EXPECT_TRUE(res == i);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
copy(src_span_static, dst_span_static);
|
||||||
|
#endif
|
11
deps/GSL/tests/deathTestCommon.h
vendored
Normal file
11
deps/GSL/tests/deathTestCommon.h
vendored
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <gsl/assert>
|
||||||
|
|
||||||
|
constexpr char deathstring[] = "Expected Death";
|
||||||
|
constexpr char failed_set_terminate_deathstring[] = ".*";
|
||||||
|
|
||||||
|
// This prevents a failed call to set_terminate from failing the test suite.
|
||||||
|
constexpr const char* GetExpectedDeathString(std::terminate_handler handle)
|
||||||
|
{
|
||||||
|
return handle ? deathstring : failed_set_terminate_deathstring;
|
||||||
|
}
|
55
deps/GSL/tests/no_exception_ensure_tests.cpp
vendored
Normal file
55
deps/GSL/tests/no_exception_ensure_tests.cpp
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <cstdlib> // for std::exit
|
||||||
|
#include <gsl/span> // for span
|
||||||
|
#include <iostream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
int operator_subscript_no_throw() noexcept
|
||||||
|
{
|
||||||
|
int arr[10];
|
||||||
|
const gsl::span<int> sp{arr};
|
||||||
|
return sp[11];
|
||||||
|
}
|
||||||
|
|
||||||
|
[[noreturn]] void test_terminate() { std::exit(0); }
|
||||||
|
|
||||||
|
void setup_termination_handler() noexcept
|
||||||
|
{
|
||||||
|
#if defined(GSL_MSVC_USE_STL_NOEXCEPTION_WORKAROUND)
|
||||||
|
|
||||||
|
auto& handler = gsl::details::get_terminate_handler();
|
||||||
|
handler = &test_terminate;
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
std::set_terminate(test_terminate);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
int main() noexcept
|
||||||
|
{
|
||||||
|
std::cout << "Running main() from " __FILE__ "\n";
|
||||||
|
#if defined(IOS_PROCESS_DELAY_WORKAROUND)
|
||||||
|
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||||
|
#endif
|
||||||
|
setup_termination_handler();
|
||||||
|
operator_subscript_no_throw();
|
||||||
|
return -1;
|
||||||
|
}
|
648
deps/GSL/tests/notnull_tests.cpp
vendored
Normal file
648
deps/GSL/tests/notnull_tests.cpp
vendored
Normal file
@ -0,0 +1,648 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <gsl/pointers> // for not_null, operator<, operator<=, operator>
|
||||||
|
|
||||||
|
#include <algorithm> // for addressof
|
||||||
|
#include <cstdint> // for uint16_t
|
||||||
|
#include <memory> // for shared_ptr, make_shared, operator<, opera...
|
||||||
|
#include <sstream> // for operator<<, ostringstream, basic_ostream:...
|
||||||
|
#include <string> // for basic_string, operator==, string, operator<<
|
||||||
|
#include <typeinfo> // for type_info
|
||||||
|
#include <variant> // for variant, monostate, get
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
struct MyBase
|
||||||
|
{
|
||||||
|
};
|
||||||
|
struct MyDerived : public MyBase
|
||||||
|
{
|
||||||
|
};
|
||||||
|
struct Unrelated
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
// stand-in for a user-defined ref-counted class
|
||||||
|
template <typename T>
|
||||||
|
struct RefCounted
|
||||||
|
{
|
||||||
|
RefCounted(T* p) : p_(p) {}
|
||||||
|
operator T*() { return p_; }
|
||||||
|
T* p_;
|
||||||
|
};
|
||||||
|
|
||||||
|
// user defined smart pointer with comparison operators returning non bool value
|
||||||
|
template <typename T>
|
||||||
|
struct CustomPtr
|
||||||
|
{
|
||||||
|
CustomPtr(T* p) : p_(p) {}
|
||||||
|
operator T*() const { return p_; }
|
||||||
|
bool operator!=(std::nullptr_t) const { return p_ != nullptr; }
|
||||||
|
T* p_ = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator==(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) == reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator!=(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) != reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator<(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) < reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator>(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) > reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator<=(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) <= reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, typename U>
|
||||||
|
std::string operator>=(CustomPtr<T> const& lhs, CustomPtr<U> const& rhs)
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(type.1) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
return reinterpret_cast<const void*>(lhs.p_) >= reinterpret_cast<const void*>(rhs.p_) ? "true"
|
||||||
|
: "false";
|
||||||
|
}
|
||||||
|
|
||||||
|
struct NonCopyableNonMovable
|
||||||
|
{
|
||||||
|
NonCopyableNonMovable() = default;
|
||||||
|
NonCopyableNonMovable(const NonCopyableNonMovable&) = delete;
|
||||||
|
NonCopyableNonMovable& operator=(const NonCopyableNonMovable&) = delete;
|
||||||
|
NonCopyableNonMovable(NonCopyableNonMovable&&) = delete;
|
||||||
|
NonCopyableNonMovable& operator=(NonCopyableNonMovable&&) = delete;
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f .4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool helper(not_null<int*> p) { return *p == 12; }
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f .4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool helper_const(not_null<const int*> p) { return *p == 12; }
|
||||||
|
|
||||||
|
int* return_pointer() { return nullptr; }
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullConstructors)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
not_null<int*> p = nullptr; // yay...does not compile!
|
||||||
|
not_null<std::vector<char>*> p1 = 0; // yay...does not compile!
|
||||||
|
not_null<int*> p2; // yay...does not compile!
|
||||||
|
std::unique_ptr<int> up = std::make_unique<int>(120);
|
||||||
|
not_null<int*> p3 = up;
|
||||||
|
|
||||||
|
// Forbid non-nullptr assignable types
|
||||||
|
not_null<std::vector<int>> f(std::vector<int>{1});
|
||||||
|
not_null<int> z(10);
|
||||||
|
not_null<std::vector<int>> y({1, 2});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. TestNotNullConstructors";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
{
|
||||||
|
// from shared pointer
|
||||||
|
int i = 12;
|
||||||
|
auto rp = RefCounted<int>(&i);
|
||||||
|
not_null<int*> p(rp);
|
||||||
|
EXPECT_TRUE(p.get() == &i);
|
||||||
|
|
||||||
|
not_null<std::shared_ptr<int>> x(
|
||||||
|
std::make_shared<int>(10)); // shared_ptr<int> is nullptr assignable
|
||||||
|
|
||||||
|
int* pi = nullptr;
|
||||||
|
EXPECT_DEATH((not_null<decltype(pi)>(pi)), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// from pointer to local
|
||||||
|
int t = 42;
|
||||||
|
|
||||||
|
not_null<int*> x = &t;
|
||||||
|
helper(&t);
|
||||||
|
helper_const(&t);
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// from raw pointer
|
||||||
|
// from not_null pointer
|
||||||
|
|
||||||
|
int t = 42;
|
||||||
|
int* p = &t;
|
||||||
|
|
||||||
|
not_null<int*> x = p;
|
||||||
|
helper(p);
|
||||||
|
helper_const(p);
|
||||||
|
helper(x);
|
||||||
|
helper_const(x);
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// from raw const pointer
|
||||||
|
// from not_null const pointer
|
||||||
|
|
||||||
|
int t = 42;
|
||||||
|
const int* cp = &t;
|
||||||
|
|
||||||
|
not_null<const int*> x = cp;
|
||||||
|
helper_const(cp);
|
||||||
|
helper_const(x);
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// from not_null const pointer, using auto
|
||||||
|
int t = 42;
|
||||||
|
const int* cp = &t;
|
||||||
|
|
||||||
|
auto x = not_null<const int*>{cp};
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// from returned pointer
|
||||||
|
|
||||||
|
EXPECT_DEATH(helper(return_pointer()), expected);
|
||||||
|
EXPECT_DEATH(helper_const(return_pointer()), expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void ostream_helper(T v)
|
||||||
|
{
|
||||||
|
not_null<T*> p(&v);
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
std::ostringstream ref;
|
||||||
|
os << static_cast<void*>(p);
|
||||||
|
ref << static_cast<void*>(&v);
|
||||||
|
EXPECT_TRUE(os.str() == ref.str());
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::ostringstream os;
|
||||||
|
std::ostringstream ref;
|
||||||
|
os << *p;
|
||||||
|
ref << v;
|
||||||
|
EXPECT_TRUE(os.str() == ref.str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullostream)
|
||||||
|
{
|
||||||
|
ostream_helper<int>(17);
|
||||||
|
ostream_helper<float>(21.5f);
|
||||||
|
ostream_helper<double>(3.4566e-7);
|
||||||
|
ostream_helper<char>('c');
|
||||||
|
ostream_helper<uint16_t>(0x0123u);
|
||||||
|
ostream_helper<const char*>("cstring");
|
||||||
|
ostream_helper<std::string>("string");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullCasting)
|
||||||
|
{
|
||||||
|
MyBase base;
|
||||||
|
MyDerived derived;
|
||||||
|
Unrelated unrelated;
|
||||||
|
not_null<Unrelated*> u{&unrelated};
|
||||||
|
(void) u;
|
||||||
|
not_null<MyDerived*> p{&derived};
|
||||||
|
not_null<MyBase*> q(&base);
|
||||||
|
q = p; // allowed with heterogeneous copy ctor
|
||||||
|
EXPECT_TRUE(q == p);
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
q = u; // no viable conversion possible between MyBase* and Unrelated*
|
||||||
|
p = q; // not possible to implicitly convert MyBase* to MyDerived*
|
||||||
|
|
||||||
|
not_null<Unrelated*> r = p;
|
||||||
|
not_null<Unrelated*> s = reinterpret_cast<Unrelated*>(p);
|
||||||
|
#endif
|
||||||
|
not_null<Unrelated*> t(reinterpret_cast<Unrelated*>(p.get()));
|
||||||
|
EXPECT_TRUE(reinterpret_cast<void*>(p.get()) == reinterpret_cast<void*>(t.get()));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullAssignment)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. TestNotNullAssignmentd";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
int i = 12;
|
||||||
|
not_null<int*> p(&i);
|
||||||
|
EXPECT_TRUE(helper(p));
|
||||||
|
|
||||||
|
int* q = nullptr;
|
||||||
|
EXPECT_DEATH(p = not_null<int*>(q), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullRawPointerComparison)
|
||||||
|
{
|
||||||
|
int ints[2] = {42, 43};
|
||||||
|
int* p1 = &ints[0];
|
||||||
|
const int* p2 = &ints[1];
|
||||||
|
|
||||||
|
using NotNull1 = not_null<decltype(p1)>;
|
||||||
|
using NotNull2 = not_null<decltype(p2)>;
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) == NotNull1(p1)) == true);
|
||||||
|
EXPECT_TRUE((NotNull1(p1) == NotNull2(p2)) == false);
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) != NotNull1(p1)) == false);
|
||||||
|
EXPECT_TRUE((NotNull1(p1) != NotNull2(p2)) == true);
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) < NotNull1(p1)) == false);
|
||||||
|
EXPECT_TRUE((NotNull1(p1) < NotNull2(p2)) == (p1 < p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) < NotNull1(p1)) == (p2 < p1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) > NotNull1(p1)) == false);
|
||||||
|
EXPECT_TRUE((NotNull1(p1) > NotNull2(p2)) == (p1 > p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) > NotNull1(p1)) == (p2 > p1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) <= NotNull1(p1)) == true);
|
||||||
|
EXPECT_TRUE((NotNull1(p1) <= NotNull2(p2)) == (p1 <= p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) <= NotNull1(p1)) == (p2 <= p1));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullDereferenceOperator)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
auto sp1 = std::make_shared<NonCopyableNonMovable>();
|
||||||
|
|
||||||
|
using NotNullSp1 = not_null<decltype(sp1)>;
|
||||||
|
EXPECT_TRUE(typeid(*sp1) == typeid(*NotNullSp1(sp1)));
|
||||||
|
EXPECT_TRUE(std::addressof(*NotNullSp1(sp1)) == std::addressof(*sp1));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int ints[1] = {42};
|
||||||
|
CustomPtr<int> p1(&ints[0]);
|
||||||
|
|
||||||
|
using NotNull1 = not_null<decltype(p1)>;
|
||||||
|
EXPECT_TRUE(typeid(*NotNull1(p1)) == typeid(*p1));
|
||||||
|
EXPECT_TRUE(*NotNull1(p1) == 42);
|
||||||
|
*NotNull1(p1) = 43;
|
||||||
|
EXPECT_TRUE(ints[0] == 43);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int v = 42;
|
||||||
|
gsl::not_null<int*> p(&v);
|
||||||
|
EXPECT_TRUE(typeid(*p) == typeid(*(&v)));
|
||||||
|
*p = 43;
|
||||||
|
EXPECT_TRUE(v == 43);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullSharedPtrComparison)
|
||||||
|
{
|
||||||
|
auto sp1 = std::make_shared<int>(42);
|
||||||
|
auto sp2 = std::make_shared<const int>(43);
|
||||||
|
|
||||||
|
using NotNullSp1 = not_null<decltype(sp1)>;
|
||||||
|
using NotNullSp2 = not_null<decltype(sp2)>;
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) == NotNullSp1(sp1)) == true);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) == NotNullSp2(sp2)) == false);
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) != NotNullSp1(sp1)) == false);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) != NotNullSp2(sp2)) == true);
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) < NotNullSp1(sp1)) == false);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) < NotNullSp2(sp2)) == (sp1 < sp2));
|
||||||
|
EXPECT_TRUE((NotNullSp2(sp2) < NotNullSp1(sp1)) == (sp2 < sp1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) > NotNullSp1(sp1)) == false);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) > NotNullSp2(sp2)) == (sp1 > sp2));
|
||||||
|
EXPECT_TRUE((NotNullSp2(sp2) > NotNullSp1(sp1)) == (sp2 > sp1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) <= NotNullSp1(sp1)) == true);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) <= NotNullSp2(sp2)) == (sp1 <= sp2));
|
||||||
|
EXPECT_TRUE((NotNullSp2(sp2) <= NotNullSp1(sp1)) == (sp2 <= sp1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) >= NotNullSp1(sp1)) == true);
|
||||||
|
EXPECT_TRUE((NotNullSp1(sp1) >= NotNullSp2(sp2)) == (sp1 >= sp2));
|
||||||
|
EXPECT_TRUE((NotNullSp2(sp2) >= NotNullSp1(sp1)) == (sp2 >= sp1));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullCustomPtrComparison)
|
||||||
|
{
|
||||||
|
int ints[2] = {42, 43};
|
||||||
|
CustomPtr<int> p1(&ints[0]);
|
||||||
|
CustomPtr<const int> p2(&ints[1]);
|
||||||
|
|
||||||
|
using NotNull1 = not_null<decltype(p1)>;
|
||||||
|
using NotNull2 = not_null<decltype(p2)>;
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) == NotNull1(p1)) == "true");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) == NotNull2(p2)) == "false");
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) != NotNull1(p1)) == "false");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) != NotNull2(p2)) == "true");
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) < NotNull1(p1)) == "false");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) < NotNull2(p2)) == (p1 < p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) < NotNull1(p1)) == (p2 < p1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) > NotNull1(p1)) == "false");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) > NotNull2(p2)) == (p1 > p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) > NotNull1(p1)) == (p2 > p1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) <= NotNull1(p1)) == "true");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) <= NotNull2(p2)) == (p1 <= p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) <= NotNull1(p1)) == (p2 <= p1));
|
||||||
|
|
||||||
|
EXPECT_TRUE((NotNull1(p1) >= NotNull1(p1)) == "true");
|
||||||
|
EXPECT_TRUE((NotNull1(p1) >= NotNull2(p2)) == (p1 >= p2));
|
||||||
|
EXPECT_TRUE((NotNull2(p2) >= NotNull1(p1)) == (p2 >= p1));
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestNotNullConstructorTypeDeduction)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
|
||||||
|
not_null x{&i};
|
||||||
|
helper(not_null{&i});
|
||||||
|
helper_const(not_null{&i});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
|
||||||
|
not_null x{&i};
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(not_null{&i});
|
||||||
|
#endif
|
||||||
|
helper_const(not_null{&i});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
int* p = &i;
|
||||||
|
|
||||||
|
not_null x{p};
|
||||||
|
helper(not_null{p});
|
||||||
|
helper_const(not_null{p});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
const int* p = &i;
|
||||||
|
|
||||||
|
not_null x{p};
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(not_null{p});
|
||||||
|
#endif
|
||||||
|
helper_const(not_null{p});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. TestNotNullConstructorTypeDeduction";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
{
|
||||||
|
auto workaround_macro = []() {
|
||||||
|
int* p1 = nullptr;
|
||||||
|
const not_null x{p1};
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto workaround_macro = []() {
|
||||||
|
const int* p1 = nullptr;
|
||||||
|
const not_null x{p1};
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
|
||||||
|
EXPECT_DEATH(helper(not_null{p}), expected);
|
||||||
|
EXPECT_DEATH(helper_const(not_null{p}), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
{
|
||||||
|
not_null x{nullptr};
|
||||||
|
helper(not_null{nullptr});
|
||||||
|
helper_const(not_null{nullptr});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestVariantEmplace)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
std::variant<std::monostate, not_null<int*>> v;
|
||||||
|
v.emplace<not_null<int*>>(&i);
|
||||||
|
|
||||||
|
EXPECT_FALSE(v.valueless_by_exception());
|
||||||
|
EXPECT_TRUE(v.index() == 1);
|
||||||
|
EXPECT_TRUE(std::get<not_null<int*>>(v) == &i);
|
||||||
|
}
|
||||||
|
#endif // #if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestMakeNotNull)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
|
||||||
|
const auto x = make_not_null(&i);
|
||||||
|
helper(make_not_null(&i));
|
||||||
|
helper_const(make_not_null(&i));
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
|
||||||
|
const auto x = make_not_null(&i);
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(make_not_null(&i));
|
||||||
|
#endif
|
||||||
|
helper_const(make_not_null(&i));
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
int* p = &i;
|
||||||
|
|
||||||
|
const auto x = make_not_null(p);
|
||||||
|
helper(make_not_null(p));
|
||||||
|
helper_const(make_not_null(p));
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
const int* p = &i;
|
||||||
|
|
||||||
|
const auto x = make_not_null(p);
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(make_not_null(p));
|
||||||
|
#endif
|
||||||
|
helper_const(make_not_null(p));
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. TestMakeNotNull";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto workaround_macro = []() {
|
||||||
|
int* p1 = nullptr;
|
||||||
|
const auto x = make_not_null(p1);
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto workaround_macro = []() {
|
||||||
|
const int* p1 = nullptr;
|
||||||
|
const auto x = make_not_null(p1);
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
|
||||||
|
EXPECT_DEATH(helper(make_not_null(p)), expected);
|
||||||
|
EXPECT_DEATH(helper_const(make_not_null(p)), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
{
|
||||||
|
EXPECT_DEATH(make_not_null(nullptr), expected);
|
||||||
|
EXPECT_DEATH(helper(make_not_null(nullptr)), expected);
|
||||||
|
EXPECT_DEATH(helper_const(make_not_null(nullptr)), expected);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(notnull_tests, TestStdHash)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
int x = 42;
|
||||||
|
int y = 99;
|
||||||
|
not_null<int*> nn{&x};
|
||||||
|
const not_null<int*> cnn{&x};
|
||||||
|
|
||||||
|
std::hash<not_null<int*>> hash_nn;
|
||||||
|
std::hash<int*> hash_intptr;
|
||||||
|
|
||||||
|
EXPECT_TRUE(hash_nn(nn) == hash_intptr(&x));
|
||||||
|
EXPECT_FALSE(hash_nn(nn) == hash_intptr(&y));
|
||||||
|
EXPECT_FALSE(hash_nn(nn) == hash_intptr(nullptr));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int x = 42;
|
||||||
|
const int y = 99;
|
||||||
|
not_null<const int*> nn{&x};
|
||||||
|
const not_null<const int*> cnn{&x};
|
||||||
|
|
||||||
|
std::hash<not_null<const int*>> hash_nn;
|
||||||
|
std::hash<const int*> hash_intptr;
|
||||||
|
|
||||||
|
EXPECT_TRUE(hash_nn(nn) == hash_intptr(&x));
|
||||||
|
EXPECT_FALSE(hash_nn(nn) == hash_intptr(&y));
|
||||||
|
EXPECT_FALSE(hash_nn(nn) == hash_intptr(nullptr));
|
||||||
|
}
|
||||||
|
}
|
43
deps/GSL/tests/owner_tests.cpp
vendored
Normal file
43
deps/GSL/tests/owner_tests.cpp
vendored
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <gsl/pointers> // for owner
|
||||||
|
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
GSL_SUPPRESS(f .23) // NO-FORMAT: attribute
|
||||||
|
void f(int* i) { *i += 1; }
|
||||||
|
|
||||||
|
TEST(owner_tests, basic_test)
|
||||||
|
{
|
||||||
|
owner<int*> p = new int(120);
|
||||||
|
EXPECT_TRUE(*p == 120);
|
||||||
|
f(p);
|
||||||
|
EXPECT_TRUE(*p == 121);
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(owner_tests, check_pointer_constraint)
|
||||||
|
{
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
{
|
||||||
|
owner<int> integerTest = 10;
|
||||||
|
owner<std::shared_ptr<int>> sharedPtrTest(new int(10));
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
1023
deps/GSL/tests/span_compatibility_tests.cpp
vendored
Normal file
1023
deps/GSL/tests/span_compatibility_tests.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
380
deps/GSL/tests/span_ext_tests.cpp
vendored
Normal file
380
deps/GSL/tests/span_ext_tests.cpp
vendored
Normal file
@ -0,0 +1,380 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <gsl/span> // for span and span_ext
|
||||||
|
#include <gsl/util> // for narrow_cast, at
|
||||||
|
|
||||||
|
#include <array> // for array
|
||||||
|
#include <exception> // for terminate
|
||||||
|
#include <iostream> // for cerr
|
||||||
|
#include <vector> // for vector
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_pointer_length_constructor)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. from_pointer_length_constructor";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
int arr[4] = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(&arr[0], 2);
|
||||||
|
EXPECT_TRUE(s.size() == 2);
|
||||||
|
EXPECT_TRUE(s.data() == &arr[0]);
|
||||||
|
EXPECT_TRUE(s[0] == 1);
|
||||||
|
EXPECT_TRUE(s[1] == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
auto s = make_span(p, narrow_cast<gsl::span<int>::size_type>(0));
|
||||||
|
EXPECT_TRUE(s.size() == 0);
|
||||||
|
EXPECT_TRUE(s.data() == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
auto workaround_macro = [=]() { make_span(p, 2); };
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_pointer_pointer_construction)
|
||||||
|
{
|
||||||
|
int arr[4] = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(&arr[0], &arr[2]);
|
||||||
|
EXPECT_TRUE(s.size() == 2);
|
||||||
|
EXPECT_TRUE(s.data() == &arr[0]);
|
||||||
|
EXPECT_TRUE(s[0] == 1);
|
||||||
|
EXPECT_TRUE(s[1] == 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(&arr[0], &arr[0]);
|
||||||
|
EXPECT_TRUE(s.size() == 0);
|
||||||
|
EXPECT_TRUE(s.data() == &arr[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
auto s = make_span(p, p);
|
||||||
|
EXPECT_TRUE(s.size() == 0);
|
||||||
|
EXPECT_TRUE(s.data() == nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_array_constructor)
|
||||||
|
{
|
||||||
|
int arr[5] = {1, 2, 3, 4, 5};
|
||||||
|
int arr2d[2][3] = {1, 2, 3, 4, 5, 6};
|
||||||
|
int arr3d[2][3][2] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto s = make_span(arr);
|
||||||
|
EXPECT_TRUE(s.size() == 5);
|
||||||
|
EXPECT_TRUE(s.data() == std::addressof(arr[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto s = make_span(std::addressof(arr2d[0]), 1);
|
||||||
|
EXPECT_TRUE(s.size() == 1);
|
||||||
|
EXPECT_TRUE(s.data() == std::addressof(arr2d[0]));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const auto s = make_span(std::addressof(arr3d[0]), 1);
|
||||||
|
EXPECT_TRUE(s.size() == 1);
|
||||||
|
EXPECT_TRUE(s.data() == std::addressof(arr3d[0]));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_dynamic_array_constructor)
|
||||||
|
{
|
||||||
|
double(*arr)[3][4] = new double[100][3][4];
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(&arr[0][0][0], 10);
|
||||||
|
EXPECT_TRUE(s.size() == 10);
|
||||||
|
EXPECT_TRUE(s.data() == &arr[0][0][0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_std_array_constructor)
|
||||||
|
{
|
||||||
|
std::array<int, 4> arr = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(arr);
|
||||||
|
EXPECT_TRUE(s.size() == arr.size());
|
||||||
|
EXPECT_TRUE(s.data() == arr.data());
|
||||||
|
}
|
||||||
|
|
||||||
|
// This test checks for the bug found in gcc 6.1, 6.2, 6.3, 6.4, 6.5 7.1, 7.2, 7.3 - issue #590
|
||||||
|
{
|
||||||
|
gsl::span<int> s1 = make_span(arr);
|
||||||
|
|
||||||
|
static gsl::span<int> s2;
|
||||||
|
s2 = s1;
|
||||||
|
|
||||||
|
#if defined(__GNUC__) && __GNUC__ == 6 && (__GNUC_MINOR__ == 4 || __GNUC_MINOR__ == 5) && \
|
||||||
|
__GNUC_PATCHLEVEL__ == 0 && defined(__OPTIMIZE__)
|
||||||
|
// Known to be broken in gcc 6.4 and 6.5 with optimizations
|
||||||
|
// Issue in gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83116
|
||||||
|
EXPECT_TRUE(s1.size() == 4);
|
||||||
|
EXPECT_TRUE(s2.size() == 0);
|
||||||
|
#else
|
||||||
|
EXPECT_TRUE(s1.size() == s2.size());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_const_std_array_constructor)
|
||||||
|
{
|
||||||
|
const std::array<int, 4> arr = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(arr);
|
||||||
|
EXPECT_TRUE(s.size() == arr.size());
|
||||||
|
EXPECT_TRUE(s.data() == arr.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_std_array_const_constructor)
|
||||||
|
{
|
||||||
|
std::array<const int, 4> arr = {1, 2, 3, 4};
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(arr);
|
||||||
|
EXPECT_TRUE(s.size() == arr.size());
|
||||||
|
EXPECT_TRUE(s.data() == arr.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, make_span_from_container_constructor)
|
||||||
|
{
|
||||||
|
std::vector<int> v = {1, 2, 3};
|
||||||
|
const std::vector<int> cv = v;
|
||||||
|
|
||||||
|
{
|
||||||
|
auto s = make_span(v);
|
||||||
|
EXPECT_TRUE(s.size() == v.size());
|
||||||
|
EXPECT_TRUE(s.data() == v.data());
|
||||||
|
|
||||||
|
auto cs = make_span(cv);
|
||||||
|
EXPECT_TRUE(cs.size() == cv.size());
|
||||||
|
EXPECT_TRUE(cs.data() == cv.data());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_test, interop_with_gsl_at)
|
||||||
|
{
|
||||||
|
std::vector<int> vec{1, 2, 3, 4, 5};
|
||||||
|
gsl::span<int> sp{vec};
|
||||||
|
|
||||||
|
std::vector<int> cvec{1, 2, 3, 4, 5};
|
||||||
|
gsl::span<int> csp{cvec};
|
||||||
|
|
||||||
|
for (gsl::index i = 0; i < gsl::narrow_cast<gsl::index>(vec.size()); ++i)
|
||||||
|
{
|
||||||
|
EXPECT_TRUE(&gsl::at(sp, i) == &vec[gsl::narrow_cast<size_t>(i)]);
|
||||||
|
EXPECT_TRUE(&gsl::at(csp, i) == &cvec[gsl::narrow_cast<size_t>(i)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. interop_with_gsl_at";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
EXPECT_DEATH(gsl::at(sp, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(sp, gsl::narrow_cast<gsl::index>(sp.size())), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(csp, -1), expected);
|
||||||
|
EXPECT_DEATH(gsl::at(csp, gsl::narrow_cast<gsl::index>(sp.size())), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, iterator_free_functions)
|
||||||
|
{
|
||||||
|
int a[] = {1, 2, 3, 4};
|
||||||
|
gsl::span<int> s{a};
|
||||||
|
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(s.begin()), decltype(begin(s))>::value));
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(s.end()), decltype(end(s))>::value));
|
||||||
|
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(std::cbegin(s)), decltype(cbegin(s))>::value));
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(std::cend(s)), decltype(cend(s))>::value));
|
||||||
|
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(s.rbegin()), decltype(rbegin(s))>::value));
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(s.rend()), decltype(rend(s))>::value));
|
||||||
|
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(std::crbegin(s)), decltype(crbegin(s))>::value));
|
||||||
|
EXPECT_TRUE((std::is_same<decltype(std::crend(s)), decltype(crend(s))>::value));
|
||||||
|
|
||||||
|
EXPECT_TRUE(s.begin() == begin(s));
|
||||||
|
EXPECT_TRUE(s.end() == end(s));
|
||||||
|
|
||||||
|
EXPECT_TRUE(s.rbegin() == rbegin(s));
|
||||||
|
EXPECT_TRUE(s.rend() == rend(s));
|
||||||
|
|
||||||
|
EXPECT_TRUE(s.begin() == cbegin(s));
|
||||||
|
EXPECT_TRUE(s.end() == cend(s));
|
||||||
|
|
||||||
|
EXPECT_TRUE(s.rbegin() == crbegin(s));
|
||||||
|
EXPECT_TRUE(s.rend() == crend(s));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(span_ext_test, ssize_free_function)
|
||||||
|
{
|
||||||
|
int a[] = {1, 2, 3, 4};
|
||||||
|
gsl::span<int> s{a};
|
||||||
|
|
||||||
|
EXPECT_FALSE((std::is_same<decltype(s.size()), decltype(ssize(s))>::value));
|
||||||
|
EXPECT_TRUE(s.size() == static_cast<std::size_t>(ssize(s)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef GSL_KERNEL_MODE
|
||||||
|
TEST(span_ext_test, comparison_operators)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
gsl::span<int> s1;
|
||||||
|
gsl::span<int> s2;
|
||||||
|
EXPECT_TRUE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s1 != s2);
|
||||||
|
EXPECT_FALSE(s1 < s2);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s1 >= s2);
|
||||||
|
EXPECT_TRUE(s2 == s1);
|
||||||
|
EXPECT_FALSE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s2 != s1);
|
||||||
|
EXPECT_TRUE(s2 <= s1);
|
||||||
|
EXPECT_FALSE(s2 > s1);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int arr[] = {2, 1};
|
||||||
|
gsl::span<int> s1 = arr;
|
||||||
|
gsl::span<int> s2 = arr;
|
||||||
|
|
||||||
|
EXPECT_TRUE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s1 != s2);
|
||||||
|
EXPECT_FALSE(s1 < s2);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s1 >= s2);
|
||||||
|
EXPECT_TRUE(s2 == s1);
|
||||||
|
EXPECT_FALSE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s2 < s1);
|
||||||
|
EXPECT_TRUE(s2 <= s1);
|
||||||
|
EXPECT_FALSE(s2 > s1);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int arr[] = {2, 1}; // bigger
|
||||||
|
|
||||||
|
gsl::span<int> s1;
|
||||||
|
gsl::span<int> s2 = arr;
|
||||||
|
|
||||||
|
EXPECT_TRUE(s1 != s2);
|
||||||
|
EXPECT_TRUE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s2 == s1);
|
||||||
|
EXPECT_TRUE(s1 < s2);
|
||||||
|
EXPECT_FALSE(s2 < s1);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s2 <= s1);
|
||||||
|
EXPECT_TRUE(s2 > s1);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
EXPECT_FALSE(s1 >= s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int arr1[] = {1, 2};
|
||||||
|
int arr2[] = {1, 2};
|
||||||
|
gsl::span<int> s1 = arr1;
|
||||||
|
gsl::span<int> s2 = arr2;
|
||||||
|
|
||||||
|
EXPECT_TRUE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s1 != s2);
|
||||||
|
EXPECT_FALSE(s1 < s2);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s1 >= s2);
|
||||||
|
EXPECT_TRUE(s2 == s1);
|
||||||
|
EXPECT_FALSE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s2 < s1);
|
||||||
|
EXPECT_TRUE(s2 <= s1);
|
||||||
|
EXPECT_FALSE(s2 > s1);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int arr[] = {1, 2, 3};
|
||||||
|
|
||||||
|
gsl::span<int> s1 = {&arr[0], 2}; // shorter
|
||||||
|
gsl::span<int> s2 = arr; // longer
|
||||||
|
|
||||||
|
EXPECT_TRUE(s1 != s2);
|
||||||
|
EXPECT_TRUE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s2 == s1);
|
||||||
|
EXPECT_TRUE(s1 < s2);
|
||||||
|
EXPECT_FALSE(s2 < s1);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s2 <= s1);
|
||||||
|
EXPECT_TRUE(s2 > s1);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
EXPECT_FALSE(s1 >= s2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int arr1[] = {1, 2}; // smaller
|
||||||
|
int arr2[] = {2, 1}; // bigger
|
||||||
|
|
||||||
|
gsl::span<int> s1 = arr1;
|
||||||
|
gsl::span<int> s2 = arr2;
|
||||||
|
|
||||||
|
EXPECT_TRUE(s1 != s2);
|
||||||
|
EXPECT_TRUE(s2 != s1);
|
||||||
|
EXPECT_FALSE(s1 == s2);
|
||||||
|
EXPECT_FALSE(s2 == s1);
|
||||||
|
EXPECT_TRUE(s1 < s2);
|
||||||
|
EXPECT_FALSE(s2 < s1);
|
||||||
|
EXPECT_TRUE(s1 <= s2);
|
||||||
|
EXPECT_FALSE(s2 <= s1);
|
||||||
|
EXPECT_TRUE(s2 > s1);
|
||||||
|
EXPECT_FALSE(s1 > s2);
|
||||||
|
EXPECT_TRUE(s2 >= s1);
|
||||||
|
EXPECT_FALSE(s1 >= s2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // GSL_KERNEL_MODE
|
1383
deps/GSL/tests/span_tests.cpp
vendored
Normal file
1383
deps/GSL/tests/span_tests.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
304
deps/GSL/tests/strict_notnull_tests.cpp
vendored
Normal file
304
deps/GSL/tests/strict_notnull_tests.cpp
vendored
Normal file
@ -0,0 +1,304 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gsl/pointers> // for not_null, operator<, operator<=, operator>
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include "deathTestCommon.h"
|
||||||
|
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool helper(not_null<int*> p) { return *p == 12; }
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool helper_const(not_null<const int*> p) { return *p == 12; }
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool strict_helper(strict_not_null<int*> p) { return *p == 12; }
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
|
GSL_SUPPRESS(f.4) // NO-FORMAT: attribute
|
||||||
|
// clang-format on
|
||||||
|
bool strict_helper_const(strict_not_null<const int*> p) { return *p == 12; }
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
int* return_pointer() { return nullptr; }
|
||||||
|
const int* return_pointer_const() { return nullptr; }
|
||||||
|
#endif
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST(strict_notnull_tests, TestStrictNotNull)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
// raw ptr <-> strict_not_null
|
||||||
|
int x = 42;
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
strict_not_null<int*> snn = &x;
|
||||||
|
strict_helper(&x);
|
||||||
|
strict_helper_const(&x);
|
||||||
|
strict_helper(return_pointer());
|
||||||
|
strict_helper_const(return_pointer_const());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const strict_not_null<int*> snn1{&x};
|
||||||
|
|
||||||
|
helper(snn1);
|
||||||
|
helper_const(snn1);
|
||||||
|
|
||||||
|
EXPECT_TRUE(*snn1 == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// raw ptr <-> strict_not_null
|
||||||
|
const int x = 42;
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
strict_not_null<int*> snn = &x;
|
||||||
|
strict_helper(&x);
|
||||||
|
strict_helper_const(&x);
|
||||||
|
strict_helper(return_pointer());
|
||||||
|
strict_helper_const(return_pointer_const());
|
||||||
|
#endif
|
||||||
|
|
||||||
|
const strict_not_null<const int*> snn1{&x};
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(snn1);
|
||||||
|
#endif
|
||||||
|
helper_const(snn1);
|
||||||
|
|
||||||
|
EXPECT_TRUE(*snn1 == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// strict_not_null -> strict_not_null
|
||||||
|
int x = 42;
|
||||||
|
|
||||||
|
strict_not_null<int*> snn1{&x};
|
||||||
|
const strict_not_null<int*> snn2{&x};
|
||||||
|
|
||||||
|
strict_helper(snn1);
|
||||||
|
strict_helper_const(snn1);
|
||||||
|
strict_helper_const(snn2);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn1 == snn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// strict_not_null -> strict_not_null
|
||||||
|
const int x = 42;
|
||||||
|
|
||||||
|
strict_not_null<const int*> snn1{&x};
|
||||||
|
const strict_not_null<const int*> snn2{&x};
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
strict_helper(snn1);
|
||||||
|
#endif
|
||||||
|
strict_helper_const(snn1);
|
||||||
|
strict_helper_const(snn2);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn1 == snn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// strict_not_null -> not_null
|
||||||
|
int x = 42;
|
||||||
|
|
||||||
|
strict_not_null<int*> snn{&x};
|
||||||
|
|
||||||
|
const not_null<int*> nn1 = snn;
|
||||||
|
const not_null<int*> nn2{snn};
|
||||||
|
|
||||||
|
helper(snn);
|
||||||
|
helper_const(snn);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn == nn1);
|
||||||
|
EXPECT_TRUE(snn == nn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// strict_not_null -> not_null
|
||||||
|
const int x = 42;
|
||||||
|
|
||||||
|
strict_not_null<const int*> snn{&x};
|
||||||
|
|
||||||
|
const not_null<const int*> nn1 = snn;
|
||||||
|
const not_null<const int*> nn2{snn};
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(snn);
|
||||||
|
#endif
|
||||||
|
helper_const(snn);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn == nn1);
|
||||||
|
EXPECT_TRUE(snn == nn2);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// not_null -> strict_not_null
|
||||||
|
int x = 42;
|
||||||
|
|
||||||
|
not_null<int*> nn{&x};
|
||||||
|
|
||||||
|
const strict_not_null<int*> snn1{nn};
|
||||||
|
const strict_not_null<int*> snn2{nn};
|
||||||
|
|
||||||
|
strict_helper(nn);
|
||||||
|
strict_helper_const(nn);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn1 == nn);
|
||||||
|
EXPECT_TRUE(snn2 == nn);
|
||||||
|
|
||||||
|
std::hash<strict_not_null<int*>> hash_snn;
|
||||||
|
std::hash<not_null<int*>> hash_nn;
|
||||||
|
|
||||||
|
EXPECT_TRUE(hash_nn(snn1) == hash_nn(nn));
|
||||||
|
EXPECT_TRUE(hash_snn(snn1) == hash_nn(nn));
|
||||||
|
EXPECT_TRUE(hash_nn(snn1) == hash_nn(snn2));
|
||||||
|
EXPECT_TRUE(hash_snn(snn1) == hash_snn(nn));
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// not_null -> strict_not_null
|
||||||
|
const int x = 42;
|
||||||
|
|
||||||
|
not_null<const int*> nn{&x};
|
||||||
|
|
||||||
|
const strict_not_null<const int*> snn1{nn};
|
||||||
|
const strict_not_null<const int*> snn2{nn};
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
strict_helper(nn);
|
||||||
|
#endif
|
||||||
|
strict_helper_const(nn);
|
||||||
|
|
||||||
|
EXPECT_TRUE(snn1 == nn);
|
||||||
|
EXPECT_TRUE(snn2 == nn);
|
||||||
|
|
||||||
|
std::hash<strict_not_null<const int*>> hash_snn;
|
||||||
|
std::hash<not_null<const int*>> hash_nn;
|
||||||
|
|
||||||
|
EXPECT_TRUE(hash_nn(snn1) == hash_nn(nn));
|
||||||
|
EXPECT_TRUE(hash_snn(snn1) == hash_nn(nn));
|
||||||
|
EXPECT_TRUE(hash_nn(snn1) == hash_nn(snn2));
|
||||||
|
EXPECT_TRUE(hash_snn(snn1) == hash_snn(nn));
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
{
|
||||||
|
strict_not_null<int*> p{nullptr};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(__cplusplus) && (__cplusplus >= 201703L)
|
||||||
|
|
||||||
|
TEST(strict_notnull_tests, TestStrictNotNullConstructorTypeDeduction)
|
||||||
|
{
|
||||||
|
const auto terminateHandler = std::set_terminate([] {
|
||||||
|
std::cerr << "Expected Death. TestStrictNotNullConstructorTypeDeduction";
|
||||||
|
std::abort();
|
||||||
|
});
|
||||||
|
const auto expected = GetExpectedDeathString(terminateHandler);
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
|
||||||
|
strict_not_null x{&i};
|
||||||
|
helper(strict_not_null{&i});
|
||||||
|
helper_const(strict_not_null{&i});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
|
||||||
|
strict_not_null x{&i};
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(strict_not_null{&i});
|
||||||
|
#endif
|
||||||
|
helper_const(strict_not_null{&i});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int i = 42;
|
||||||
|
int* p = &i;
|
||||||
|
|
||||||
|
strict_not_null x{p};
|
||||||
|
helper(strict_not_null{p});
|
||||||
|
helper_const(strict_not_null{p});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
const int i = 42;
|
||||||
|
const int* p = &i;
|
||||||
|
|
||||||
|
strict_not_null x{p};
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
helper(strict_not_null{p});
|
||||||
|
#endif
|
||||||
|
helper_const(strict_not_null{p});
|
||||||
|
|
||||||
|
EXPECT_TRUE(*x == 42);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto workaround_macro = []() {
|
||||||
|
int* p1 = nullptr;
|
||||||
|
const strict_not_null x{p1};
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto workaround_macro = []() {
|
||||||
|
const int* p1 = nullptr;
|
||||||
|
const strict_not_null x{p1};
|
||||||
|
};
|
||||||
|
EXPECT_DEATH(workaround_macro(), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
int* p = nullptr;
|
||||||
|
|
||||||
|
EXPECT_DEATH(helper(strict_not_null{p}), expected);
|
||||||
|
EXPECT_DEATH(helper_const(strict_not_null{p}), expected);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef CONFIRM_COMPILATION_ERRORS
|
||||||
|
{
|
||||||
|
strict_not_null x{nullptr};
|
||||||
|
helper(strict_not_null{nullptr});
|
||||||
|
helper_const(strict_not_null{nullptr});
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
#endif // #if defined(__cplusplus) && (__cplusplus >= 201703L)
|
165
deps/GSL/tests/utils_tests.cpp
vendored
Normal file
165
deps/GSL/tests/utils_tests.cpp
vendored
Normal file
@ -0,0 +1,165 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
//
|
||||||
|
// Copyright (c) 2015 Microsoft Corporation. All rights reserved.
|
||||||
|
//
|
||||||
|
// This code is licensed under the MIT License (MIT).
|
||||||
|
//
|
||||||
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
// THE SOFTWARE.
|
||||||
|
//
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <algorithm> // for move
|
||||||
|
#include <complex>
|
||||||
|
#include <cstddef> // for std::ptrdiff_t
|
||||||
|
#include <cstdint> // for uint32_t, int32_t
|
||||||
|
#include <functional> // for reference_wrapper, _Bind_helper<>::type
|
||||||
|
#include <gsl/narrow> // for narrow, narrowing_error
|
||||||
|
#include <gsl/util> // finally, narrow_cast
|
||||||
|
#include <limits> // for numeric_limits
|
||||||
|
#include <type_traits> // for is_same
|
||||||
|
|
||||||
|
using namespace gsl;
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
void f(int& i) { i += 1; }
|
||||||
|
static int j = 0;
|
||||||
|
void g() { j += 1; }
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST(utils_tests, sanity_check_for_gsl_index_typedef)
|
||||||
|
{
|
||||||
|
static_assert(std::is_same<gsl::index, std::ptrdiff_t>::value,
|
||||||
|
"gsl::index represents wrong arithmetic type");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_lambda)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
auto _ = finally([&]() { f(i); });
|
||||||
|
EXPECT_TRUE(i == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_lambda_move)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
auto _1 = finally([&]() { f(i); });
|
||||||
|
{
|
||||||
|
auto _2 = std::move(_1);
|
||||||
|
EXPECT_TRUE(i == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
{
|
||||||
|
auto _2 = std::move(_1);
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_const_lvalue_lambda)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
const auto const_lvalue_lambda = [&]() { f(i); };
|
||||||
|
auto _ = finally(const_lvalue_lambda);
|
||||||
|
EXPECT_TRUE(i == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_mutable_lvalue_lambda)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
auto mutable_lvalue_lambda = [&]() { f(i); };
|
||||||
|
auto _ = finally(mutable_lvalue_lambda);
|
||||||
|
EXPECT_TRUE(i == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_function_with_bind)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
{
|
||||||
|
auto _ = finally([&i] { return f(i); });
|
||||||
|
EXPECT_TRUE(i == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(i == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_function_ptr)
|
||||||
|
{
|
||||||
|
j = 0;
|
||||||
|
{
|
||||||
|
auto _ = finally(&g);
|
||||||
|
EXPECT_TRUE(j == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(j == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, finally_function)
|
||||||
|
{
|
||||||
|
j = 0;
|
||||||
|
{
|
||||||
|
auto _ = finally(g);
|
||||||
|
EXPECT_TRUE(j == 0);
|
||||||
|
}
|
||||||
|
EXPECT_TRUE(j == 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST(utils_tests, narrow_cast)
|
||||||
|
{
|
||||||
|
int n = 120;
|
||||||
|
char c = narrow_cast<char>(n);
|
||||||
|
EXPECT_TRUE(c == 120);
|
||||||
|
|
||||||
|
n = 300;
|
||||||
|
unsigned char uc = narrow_cast<unsigned char>(n);
|
||||||
|
EXPECT_TRUE(uc == 44);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifndef GSL_KERNEL_MODE
|
||||||
|
TEST(utils_tests, narrow)
|
||||||
|
{
|
||||||
|
int n = 120;
|
||||||
|
const char c = narrow<char>(n);
|
||||||
|
EXPECT_TRUE(c == 120);
|
||||||
|
|
||||||
|
n = 300;
|
||||||
|
EXPECT_THROW(narrow<char>(n), narrowing_error);
|
||||||
|
|
||||||
|
const auto int32_max = std::numeric_limits<int32_t>::max();
|
||||||
|
const auto int32_min = std::numeric_limits<int32_t>::min();
|
||||||
|
|
||||||
|
EXPECT_TRUE(narrow<uint32_t>(int32_t(0)) == 0);
|
||||||
|
EXPECT_TRUE(narrow<uint32_t>(int32_t(1)) == 1);
|
||||||
|
EXPECT_TRUE(narrow<uint32_t>(int32_max) == static_cast<uint32_t>(int32_max));
|
||||||
|
|
||||||
|
EXPECT_THROW(narrow<uint32_t>(int32_t(-1)), narrowing_error);
|
||||||
|
EXPECT_THROW(narrow<uint32_t>(int32_min), narrowing_error);
|
||||||
|
|
||||||
|
n = -42;
|
||||||
|
EXPECT_THROW(narrow<unsigned>(n), narrowing_error);
|
||||||
|
|
||||||
|
EXPECT_TRUE(
|
||||||
|
narrow<std::complex<float>>(std::complex<double>(4, 2)) == std::complex<float>(4, 2));
|
||||||
|
EXPECT_THROW(narrow<std::complex<float>>(std::complex<double>(4.2)), narrowing_error);
|
||||||
|
|
||||||
|
EXPECT_TRUE(narrow<int>(float(1)) == 1);
|
||||||
|
}
|
||||||
|
#endif // GSL_KERNEL_MODE
|
249
deps/curl/.azure-pipelines.yml
vendored
Normal file
249
deps/curl/.azure-pipelines.yml
vendored
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
# https://dev.azure.com/daniel0244/curl/_build?view=runs
|
||||||
|
#
|
||||||
|
# Azure Pipelines configuration:
|
||||||
|
# https://aka.ms/yaml
|
||||||
|
|
||||||
|
trigger:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- 'master'
|
||||||
|
- '*/ci'
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- '.circleci/*'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- '.github/*'
|
||||||
|
- '.github/workflows/*'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/*'
|
||||||
|
- 'plan9/*'
|
||||||
|
|
||||||
|
pr:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- 'master'
|
||||||
|
paths:
|
||||||
|
exclude:
|
||||||
|
- '.circleci/*'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- '.github/*'
|
||||||
|
- '.github/workflows/*'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/*'
|
||||||
|
- 'plan9/*'
|
||||||
|
|
||||||
|
variables:
|
||||||
|
MAKEFLAGS: '-j 2'
|
||||||
|
|
||||||
|
stages:
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
### Linux jobs first
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
- stage: linux
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- job: ubuntu
|
||||||
|
# define defaults to make sure variables are always expanded/replaced
|
||||||
|
variables:
|
||||||
|
install: ''
|
||||||
|
configure: ''
|
||||||
|
tests: '!433'
|
||||||
|
timeoutInMinutes: 60
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
default:
|
||||||
|
name: default
|
||||||
|
install:
|
||||||
|
configure: --enable-debug --with-openssl
|
||||||
|
disable_ipv6:
|
||||||
|
name: w/o IPv6
|
||||||
|
configure: --disable-ipv6 --with-openssl
|
||||||
|
disable_http_smtp_imap:
|
||||||
|
name: w/o HTTP/SMTP/IMAP
|
||||||
|
configure: --disable-http --disable-smtp --disable-imap --without-ssl
|
||||||
|
disable_thredres:
|
||||||
|
name: sync resolver
|
||||||
|
configure: --disable-threaded-resolver --with-openssl
|
||||||
|
https_only:
|
||||||
|
name: HTTPS only
|
||||||
|
configure: --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-pop3 --disable-rtmp --disable-rtsp --disable-scp --disable-sftp --disable-smb --disable-smtp --disable-telnet --disable-tftp --with-openssl
|
||||||
|
torture:
|
||||||
|
name: torture
|
||||||
|
install: libnghttp2-dev
|
||||||
|
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl
|
||||||
|
tests: -n -t --shallow=25 !FTP
|
||||||
|
steps:
|
||||||
|
- script: sudo apt-get update && sudo apt-get install -y stunnel4 python3-impacket libzstd-dev libbrotli-dev libpsl-dev $(install)
|
||||||
|
displayName: 'apt install'
|
||||||
|
retryCountOnTaskFailure: 3
|
||||||
|
|
||||||
|
- script: autoreconf -fi && ./configure --enable-warnings --enable-werror $(configure)
|
||||||
|
displayName: 'configure $(name)'
|
||||||
|
|
||||||
|
- script: make V=1 && make V=1 examples && cd tests && make V=1
|
||||||
|
displayName: 'compile'
|
||||||
|
|
||||||
|
- script: make V=1 test-ci
|
||||||
|
displayName: 'test'
|
||||||
|
env:
|
||||||
|
AZURE_ACCESS_TOKEN: "$(System.AccessToken)"
|
||||||
|
TFLAGS: "-ac /usr/bin/curl -r $(tests)"
|
||||||
|
|
||||||
|
- stage: scanbuild
|
||||||
|
dependsOn: []
|
||||||
|
jobs:
|
||||||
|
- job: ubuntu
|
||||||
|
timeoutInMinutes: 30
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
steps:
|
||||||
|
- script: sudo apt-get update && sudo apt-get install -y clang-tools clang libssl-dev libssh2-1-dev libpsl-dev libbrotli-dev libzstd-dev
|
||||||
|
displayName: 'apt install'
|
||||||
|
retryCountOnTaskFailure: 3
|
||||||
|
|
||||||
|
- script: autoreconf -fi
|
||||||
|
displayName: 'autoreconf'
|
||||||
|
|
||||||
|
- script: scan-build ./configure --enable-debug --enable-werror --with-openssl --with-libssh2
|
||||||
|
displayName: 'configure'
|
||||||
|
env:
|
||||||
|
CC: "clang"
|
||||||
|
CCX: "clang++"
|
||||||
|
|
||||||
|
- script: scan-build --status-bugs make
|
||||||
|
displayName: 'make'
|
||||||
|
|
||||||
|
- script: scan-build --status-bugs make examples
|
||||||
|
displayName: 'make examples'
|
||||||
|
|
||||||
|
##########################################
|
||||||
|
### Windows jobs below
|
||||||
|
##########################################
|
||||||
|
|
||||||
|
- stage: windows
|
||||||
|
dependsOn: []
|
||||||
|
variables:
|
||||||
|
agent.preferPowerShellOnContainers: true
|
||||||
|
jobs:
|
||||||
|
- job: msys2
|
||||||
|
# define defaults to make sure variables are always expanded/replaced
|
||||||
|
variables:
|
||||||
|
container_img: ''
|
||||||
|
container_cmd: ''
|
||||||
|
configure: ''
|
||||||
|
tests: ''
|
||||||
|
timeoutInMinutes: 120
|
||||||
|
pool:
|
||||||
|
vmImage: 'windows-2019'
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
mingw32_openssl:
|
||||||
|
name: 32-bit OpenSSL/libssh2
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2
|
||||||
|
configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --with-libssh2 --with-openssl --without-libpsl
|
||||||
|
tests: "~571"
|
||||||
|
mingw64_openssl:
|
||||||
|
name: 64-bit OpenSSL/libssh2
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2
|
||||||
|
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --with-libssh2 --with-openssl --without-libpsl
|
||||||
|
tests: "~571"
|
||||||
|
mingw64_libssh:
|
||||||
|
name: 64-bit OpenSSL/libssh
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
prepare: pacman -S --needed --noconfirm --noprogressbar libssh-devel mingw-w64-x86_64-libssh
|
||||||
|
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --with-libssh --with-openssl --without-libpsl
|
||||||
|
tests: "~571 ~614"
|
||||||
|
mingw32:
|
||||||
|
name: 32-bit w/o zlib
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --without-zlib --without-ssl --without-libpsl
|
||||||
|
tests: "!203 !1143"
|
||||||
|
mingw64:
|
||||||
|
name: 64-bit w/o zlib
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --without-zlib --without-ssl --without-libpsl
|
||||||
|
tests: "!203 !1143"
|
||||||
|
mingw32_schannel:
|
||||||
|
name: 32-bit Schannel/SSPI/WinIDN/libssh2
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-i686-libssh2
|
||||||
|
configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 --without-libpsl
|
||||||
|
tests: "~571"
|
||||||
|
mingw64_schannel:
|
||||||
|
name: 64-bit Schannel/SSPI/WinIDN/libssh2
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
prepare: pacman -S --needed --noconfirm --noprogressbar libssh2-devel mingw-w64-x86_64-libssh2
|
||||||
|
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --with-libssh2 --without-libpsl
|
||||||
|
tests: "~571"
|
||||||
|
mingw32_schannel_nozlib:
|
||||||
|
name: 32-bit Schannel/SSPI/WinIDN w/o zlib
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw32:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
configure: --host=i686-w64-mingw32 --build=i686-w64-mingw32 --prefix=/mingw32 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --without-zlib --without-libpsl
|
||||||
|
tests: "!203 !1143"
|
||||||
|
mingw64_schannel_nozlib:
|
||||||
|
name: 64-bit Schannel/SSPI/WinIDN w/o zlib
|
||||||
|
container_img: ghcr.io/mback2k/curl-docker-winbuildenv/msys2-mingw64:ltsc2019
|
||||||
|
container_cmd: C:\msys64\usr\bin\sh
|
||||||
|
configure: --host=x86_64-w64-mingw32 --build=x86_64-w64-mingw32 --prefix=/mingw64 --enable-debug --enable-werror --enable-sspi --with-schannel --with-winidn --without-zlib --without-libpsl
|
||||||
|
tests: "!203 !1143"
|
||||||
|
container:
|
||||||
|
image: $(container_img)
|
||||||
|
env:
|
||||||
|
MSYS2_PATH_TYPE: inherit
|
||||||
|
steps:
|
||||||
|
- script: $(container_cmd) -l -c "cd $(echo '%cd%') && $(prepare)"
|
||||||
|
displayName: 'prepare'
|
||||||
|
condition: variables.prepare
|
||||||
|
retryCountOnTaskFailure: 3
|
||||||
|
|
||||||
|
- script: $(container_cmd) -l -c "cd $(echo '%cd%') && autoreconf -fi && ./configure $(configure)"
|
||||||
|
displayName: 'configure $(name)'
|
||||||
|
|
||||||
|
- script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 && make V=1 examples && cd tests && make V=1"
|
||||||
|
displayName: 'compile'
|
||||||
|
|
||||||
|
- script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 install && PATH=/usr/bin:/bin find . -type f -path '*/.libs/*.exe' -print -execdir mv -t .. {} \;"
|
||||||
|
displayName: 'install'
|
||||||
|
|
||||||
|
- script: $(container_cmd) -l -c "cd $(echo '%cd%') && make V=1 test-ci"
|
||||||
|
displayName: 'test'
|
||||||
|
env:
|
||||||
|
AZURE_ACCESS_TOKEN: "$(System.AccessToken)"
|
||||||
|
TFLAGS: "-ac /usr/bin/curl.exe !IDN !SCP ~612 $(tests)"
|
544
deps/curl/.circleci/config.yml
vendored
Normal file
544
deps/curl/.circleci/config.yml
vendored
Normal file
@ -0,0 +1,544 @@
|
|||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
# View these jobs in the browser: https://app.circleci.com/pipelines/github/curl/curl
|
||||||
|
#
|
||||||
|
# The macOS builds use M1 (ARM) machines for platform diversity.
|
||||||
|
# See https://circleci.com/docs/configuration-reference/#macos-execution-environment
|
||||||
|
|
||||||
|
# Use the latest 2.1 version of CircleCI pipeline process engine. See: https://circleci.com/docs/2.0/configuration-reference
|
||||||
|
version: 2.1
|
||||||
|
|
||||||
|
commands:
|
||||||
|
configure:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-werror --with-openssl
|
||||||
|
|
||||||
|
configure-openssl-no-verbose:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --disable-verbose --enable-werror --with-openssl
|
||||||
|
|
||||||
|
configure-no-proxy:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --disable-proxy --enable-werror --with-openssl
|
||||||
|
|
||||||
|
configure-macos-normal:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --without-ssl CFLAGS='-Wno-vla -mmacosx-version-min=10.9' CPPFLAGS="-I$(brew --prefix libpsl)/include" LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-debug:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --without-ssl --enable-debug CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-libssh2:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --without-ssl --with-libssh2=/opt/homebrew/opt/libssh2 --enable-debug CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-libssh-c-ares:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --with-openssl --with-libssh --enable-ares --enable-debug PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-libssh:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --with-openssl --with-libssh --enable-debug PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata" || tail -1000 config.log
|
||||||
|
|
||||||
|
configure-macos-c-ares:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --without-ssl --enable-ares --enable-debug CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-http-only:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-maintainer-mode --disable-dict --disable-file --disable-ftp --disable-gopher --disable-imap --disable-ldap --disable-mqtt --disable-pop3 --disable-rtsp --disable-smb --disable-smtp --disable-telnet --disable-tftp --disable-unix-sockets --disable-shared --without-brotli --without-gssapi --without-libidn2 --without-libpsl --without-librtmp --without-libssh2 --without-nghttp2 --without-ssl --without-zlib --enable-debug CFLAGS='-Wno-vla -mmacosx-version-min=10.15'
|
||||||
|
|
||||||
|
configure-macos-securetransport-http2:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --with-secure-transport CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.8' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-openssl-http2:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --with-openssl --enable-debug PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-libressl-http2:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --with-openssl --enable-debug PKG_CONFIG_PATH="$(brew --prefix libressl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-torture:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --disable-shared --disable-threaded-resolver --with-openssl --enable-debug PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
configure-macos-torture-ftp:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-websockets --disable-shared --disable-threaded-resolver --with-openssl --enable-debug PKG_CONFIG_PATH="$(brew --prefix openssl)/lib/pkgconfig" CPPFLAGS="-I$(brew --prefix libpsl)/include" CFLAGS='-Wno-vla -mmacosx-version-min=10.9' LDFLAGS="-L$(brew --prefix libpsl)/lib -L$(brew --prefix icu4c)/lib" LIBS="-licuuc -licudata"
|
||||||
|
|
||||||
|
install-cares:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y libc-ares-dev
|
||||||
|
|
||||||
|
install-libssh:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y libssh-dev
|
||||||
|
|
||||||
|
install-deps:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
sudo apt-get update && sudo apt-get install -y libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev python3-pip libpsl-dev
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
|
||||||
|
install-deps-brew:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
# Drop libressl as long as we're not trying to build it
|
||||||
|
echo libtool autoconf automake pkg-config nghttp2 libssh2 openssl libssh c-ares libpsl icu4c | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
|
||||||
|
while [ $? -eq 0 ]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
|
||||||
|
configure-libssh:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-werror --with-openssl --with-libssh
|
||||||
|
|
||||||
|
install-wolfssl:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
WOLFSSL_VER=5.6.0
|
||||||
|
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssl/archive/v$WOLFSSL_VER-stable.tar.gz
|
||||||
|
tar -xzf v$WOLFSSL_VER-stable.tar.gz
|
||||||
|
cd wolfssl-$WOLFSSL_VER-stable
|
||||||
|
./autogen.sh
|
||||||
|
./configure --enable-tls13 --enable-all --enable-harden --prefix=$HOME/wssl
|
||||||
|
make install
|
||||||
|
|
||||||
|
install-wolfssh:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
WOLFSSH_VER=1.4.12
|
||||||
|
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://github.com/wolfSSL/wolfssh/archive/v$WOLFSSH_VER-stable.tar.gz
|
||||||
|
tar -xzf v$WOLFSSH_VER-stable.tar.gz
|
||||||
|
cd wolfssh-$WOLFSSH_VER-stable
|
||||||
|
./autogen.sh
|
||||||
|
./configure --with-wolfssl=$HOME/wssl --prefix=$HOME/wssh --enable-scp --enable-sftp --disable-examples
|
||||||
|
make install
|
||||||
|
|
||||||
|
configure-cares:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-warnings --enable-werror --with-openssl --enable-ares
|
||||||
|
|
||||||
|
configure-wolfssh:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
LDFLAGS="-Wl,-rpath,$HOME/wssh/lib" ./configure --enable-warnings --enable-werror --with-wolfssl=$HOME/wssl --with-wolfssh=$HOME/wssh
|
||||||
|
|
||||||
|
configure-cares-debug:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
command: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --enable-debug --enable-werror --with-openssl --enable-ares
|
||||||
|
|
||||||
|
build:
|
||||||
|
steps:
|
||||||
|
- run: make -j3 V=1
|
||||||
|
- run: make -j3 V=1 examples
|
||||||
|
|
||||||
|
build-macos:
|
||||||
|
steps:
|
||||||
|
- run: make -j5 V=1
|
||||||
|
- run: make -j5 V=1 examples
|
||||||
|
|
||||||
|
test:
|
||||||
|
steps:
|
||||||
|
- run: make -j3 V=1 test-ci
|
||||||
|
|
||||||
|
test-macos:
|
||||||
|
steps:
|
||||||
|
- run: make -j5 V=1 test-ci
|
||||||
|
|
||||||
|
test-torture:
|
||||||
|
steps:
|
||||||
|
- run: make -j5 V=1 test-ci TFLAGS="-n -t --shallow=25 !FTP"
|
||||||
|
|
||||||
|
test-torture-ftp:
|
||||||
|
steps:
|
||||||
|
# Test 250 takes too long, causing Circle CI to kill the job
|
||||||
|
- run: make -j5 V=1 test-ci TFLAGS="-n -t --shallow=20 FTP !250 !251"
|
||||||
|
|
||||||
|
executors:
|
||||||
|
ubuntu:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2004:2024.01.1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
basic:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- configure
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
no-verbose:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- configure-openssl-no-verbose
|
||||||
|
- build
|
||||||
|
|
||||||
|
wolfssh:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- install-wolfssl
|
||||||
|
- install-wolfssh
|
||||||
|
- configure-wolfssh
|
||||||
|
- build
|
||||||
|
|
||||||
|
no-proxy:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- configure-no-proxy
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
cares:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- install-cares
|
||||||
|
- configure-cares
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
libssh:
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- install-libssh
|
||||||
|
- configure-libssh
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
arm:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2004:2024.01.1
|
||||||
|
resource_class: arm.medium
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- configure
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
arm-cares:
|
||||||
|
machine:
|
||||||
|
image: ubuntu-2004:2024.01.1
|
||||||
|
resource_class: arm.medium
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps
|
||||||
|
- install-cares
|
||||||
|
- configure-cares-debug
|
||||||
|
- build
|
||||||
|
- test
|
||||||
|
|
||||||
|
macos-arm-normal:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-normal
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-debug:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-debug
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-libssh2:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-libssh2
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-libssh-c-ares:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-libssh-c-ares
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-libssh:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-libssh
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-c-ares:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-c-ares
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-http-only:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-http-only
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-http-securetransport-http2:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-securetransport-http2
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-http-openssl-http2:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-openssl-http2
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-http-libressl-http2:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-libressl-http2
|
||||||
|
- build-macos
|
||||||
|
- test-macos
|
||||||
|
|
||||||
|
macos-arm-http-torture:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-torture
|
||||||
|
- build-macos
|
||||||
|
- test-torture
|
||||||
|
|
||||||
|
macos-arm-http-torture-ftp:
|
||||||
|
macos:
|
||||||
|
xcode: 15.0.0
|
||||||
|
resource_class: macos.m1.medium.gen1
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- install-deps-brew
|
||||||
|
- configure-macos-torture-ftp
|
||||||
|
- build-macos
|
||||||
|
- test-torture-ftp
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
x86-openssl:
|
||||||
|
jobs:
|
||||||
|
- basic
|
||||||
|
|
||||||
|
openssl-c-ares:
|
||||||
|
jobs:
|
||||||
|
- cares
|
||||||
|
|
||||||
|
openssl-libssh:
|
||||||
|
jobs:
|
||||||
|
- libssh
|
||||||
|
|
||||||
|
openssl-no-proxy:
|
||||||
|
jobs:
|
||||||
|
- no-proxy
|
||||||
|
|
||||||
|
openssl-no-verbose:
|
||||||
|
jobs:
|
||||||
|
- no-verbose
|
||||||
|
|
||||||
|
wolfssl-wolfssh:
|
||||||
|
jobs:
|
||||||
|
- wolfssh
|
||||||
|
|
||||||
|
arm-openssl:
|
||||||
|
jobs:
|
||||||
|
- arm
|
||||||
|
|
||||||
|
arm-openssl-c-ares:
|
||||||
|
jobs:
|
||||||
|
- arm-cares
|
||||||
|
|
||||||
|
macos-arm-normal:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-normal
|
||||||
|
|
||||||
|
macos-arm-debug:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-debug
|
||||||
|
|
||||||
|
macos-arm-libssh2:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-libssh2
|
||||||
|
|
||||||
|
macos-arm-libssh-c-ares:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-libssh-c-ares
|
||||||
|
|
||||||
|
macos-arm-libssh:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-libssh
|
||||||
|
|
||||||
|
macos-arm-c-ares:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-c-ares
|
||||||
|
|
||||||
|
macos-arm-http-only:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-http-only
|
||||||
|
|
||||||
|
macos-arm-http-securetransport-http2:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-http-securetransport-http2
|
||||||
|
|
||||||
|
macos-arm-http-openssl-http2:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-http-openssl-http2
|
||||||
|
|
||||||
|
# There are problem linking with LibreSSL on the CI boxes that prevent this
|
||||||
|
# from working.
|
||||||
|
# macos-arm-http-libressl-http2:
|
||||||
|
# jobs:
|
||||||
|
# - macos-arm-http-libressl-http2
|
||||||
|
|
||||||
|
macos-arm-http-torture:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-http-torture
|
||||||
|
|
||||||
|
macos-arm-http-torture-ftp:
|
||||||
|
jobs:
|
||||||
|
- macos-arm-http-torture-ftp
|
85
deps/curl/.cirrus.yml
vendored
Normal file
85
deps/curl/.cirrus.yml
vendored
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
# https://cirrus-ci.com/github/curl/curl
|
||||||
|
#
|
||||||
|
# Cirrus CI configuration:
|
||||||
|
# https://cirrus-ci.org/guide/writing-tasks/
|
||||||
|
|
||||||
|
freebsd_task:
|
||||||
|
skip: "changesIncludeOnly(
|
||||||
|
'**/CMakeLists.txt',
|
||||||
|
'.azure-pipelines.yml',
|
||||||
|
'.circleci/**',
|
||||||
|
'.github/**',
|
||||||
|
'appveyor.*',
|
||||||
|
'CMake/**',
|
||||||
|
'packages/**',
|
||||||
|
'plan9/**',
|
||||||
|
'projects/**',
|
||||||
|
'winbuild/**'
|
||||||
|
)"
|
||||||
|
|
||||||
|
name: FreeBSD
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
- name: FreeBSD 14.0
|
||||||
|
freebsd_instance:
|
||||||
|
image_family: freebsd-14-0
|
||||||
|
|
||||||
|
env:
|
||||||
|
CIRRUS_CLONE_DEPTH: 10
|
||||||
|
CRYPTOGRAPHY_DONT_BUILD_RUST: 1
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
|
||||||
|
pkginstall_script:
|
||||||
|
- pkg update -f
|
||||||
|
- pkg install -y autoconf automake libtool pkgconf brotli openldap26-client heimdal libpsl libssh2 libidn2 librtmp libnghttp2 nghttp2 stunnel py39-openssl py39-impacket py39-cryptography libpsl
|
||||||
|
- pkg delete -y curl
|
||||||
|
configure_script:
|
||||||
|
- autoreconf -fi
|
||||||
|
# Building with the address sanitizer is causing unexplainable test issues due to timeouts
|
||||||
|
# - case `uname -r` in
|
||||||
|
# 12.2*)
|
||||||
|
# export CC=clang;
|
||||||
|
# export CFLAGS="-fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g";
|
||||||
|
# export CXXFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g";
|
||||||
|
# export LDFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer" ;;
|
||||||
|
# esac
|
||||||
|
- ./configure --prefix="${HOME}"/install --enable-debug --with-openssl --with-libssh2 --with-brotli --with-gssapi --with-libidn2 --enable-manual --enable-ldap --enable-ldaps --with-librtmp --with-libpsl --with-nghttp2 || { tail -300 config.log; false; }
|
||||||
|
compile_script:
|
||||||
|
- make V=1 && make V=1 examples && cd tests && make V=1
|
||||||
|
test_script:
|
||||||
|
# blackhole?
|
||||||
|
- sysctl net.inet.tcp.blackhole
|
||||||
|
# make sure we don't run blackhole != 0
|
||||||
|
- sudo sysctl net.inet.tcp.blackhole=0
|
||||||
|
# Some tests won't run if run as root so run them as another user.
|
||||||
|
# Make directories world writable so the test step can write wherever it needs.
|
||||||
|
- find . -type d -exec chmod 777 {} \;
|
||||||
|
# The OpenSSH server instance for the testsuite cannot be started on FreeBSD,
|
||||||
|
# therefore the SFTP and SCP tests are disabled right away from the beginning.
|
||||||
|
#
|
||||||
|
- sudo -u nobody make V=1 TFLAGS="-n !SFTP !SCP" test-ci
|
||||||
|
install_script:
|
||||||
|
- make V=1 install
|
7
deps/curl/.dcignore
vendored
Normal file
7
deps/curl/.dcignore
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
tests/**
|
||||||
|
docs/**
|
||||||
|
docs/examples/**
|
33
deps/curl/.dir-locals.el
vendored
Normal file
33
deps/curl/.dir-locals.el
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
;;;***************************************************************************
|
||||||
|
;;; _ _ ____ _
|
||||||
|
;;; Project ___| | | | _ \| |
|
||||||
|
;;; / __| | | | |_) | |
|
||||||
|
;;; | (__| |_| | _ <| |___
|
||||||
|
;;; \___|\___/|_| \_\_____|
|
||||||
|
;;;
|
||||||
|
;;; Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
;;;
|
||||||
|
;;; This software is licensed as described in the file COPYING, which
|
||||||
|
;;; you should have received as part of this distribution. The terms
|
||||||
|
;;; are also available at https://curl.se/docs/copyright.html.
|
||||||
|
;;;
|
||||||
|
;;; You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
;;; copies of the Software, and permit persons to whom the Software is
|
||||||
|
;;; furnished to do so, under the terms of the COPYING file.
|
||||||
|
;;;
|
||||||
|
;;; This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
;;; KIND, either express or implied.
|
||||||
|
;;;
|
||||||
|
;;; SPDX-License-Identifier: curl
|
||||||
|
;;;
|
||||||
|
;;;***************************************************************************
|
||||||
|
;;; Directory Local Variables
|
||||||
|
;;; See Info node `(emacs) Directory Variables' for more information.
|
||||||
|
|
||||||
|
((nil . ((indent-tabs-mode . nil)
|
||||||
|
(show-trailing-whitespace . t)))
|
||||||
|
(c-mode . ((c-basic-offset . 2)
|
||||||
|
))
|
||||||
|
(c++-mode . ((c-basic-offset . 2)
|
||||||
|
))
|
||||||
|
)
|
6
deps/curl/.git-blame-ignore-revs
vendored
Normal file
6
deps/curl/.git-blame-ignore-revs
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
# Make repository REUSE compliant
|
||||||
|
ad9bc5976d6661cd5b03ebc379313bf657701c14
|
18
deps/curl/.gitattributes
vendored
Normal file
18
deps/curl/.gitattributes
vendored
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
*.dsw -crlf
|
||||||
|
buildconf eol=lf
|
||||||
|
configure.ac eol=lf
|
||||||
|
*.m4 eol=lf
|
||||||
|
*.in eol=lf
|
||||||
|
*.am eol=lf
|
||||||
|
*.sh eol=lf
|
||||||
|
*.[ch] whitespace=tab-in-indent
|
||||||
|
|
||||||
|
# Batch files (bat,btm,cmd) must be run with CRLF line endings.
|
||||||
|
# Refer to https://github.com/curl/curl/pull/6442
|
||||||
|
*.bat text eol=crlf
|
||||||
|
*.btm text eol=crlf
|
||||||
|
*.cmd text eol=crlf
|
3
deps/curl/.github/CODEOWNERS
vendored
Normal file
3
deps/curl/.github/CODEOWNERS
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
29
deps/curl/.github/CONTRIBUTING.md
vendored
Normal file
29
deps/curl/.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<!--
|
||||||
|
Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: curl
|
||||||
|
-->
|
||||||
|
|
||||||
|
How to contribute to curl
|
||||||
|
=========================
|
||||||
|
|
||||||
|
Join the community
|
||||||
|
------------------
|
||||||
|
|
||||||
|
1. Click 'watch' on the GitHub repo
|
||||||
|
|
||||||
|
2. Subscribe to the suitable [mailing lists](https://curl.se/mail/)
|
||||||
|
|
||||||
|
Read [CONTRIBUTE](../docs/CONTRIBUTE.md)
|
||||||
|
---------------------------------------
|
||||||
|
|
||||||
|
Send your suggestions using one of these methods:
|
||||||
|
-------------------------------------------------
|
||||||
|
|
||||||
|
1. in a mail to the mailing list
|
||||||
|
|
||||||
|
2. as a [pull request](https://github.com/curl/curl/pulls)
|
||||||
|
|
||||||
|
3. as an [issue](https://github.com/curl/curl/issues)
|
||||||
|
|
||||||
|
/ The curl team!
|
6
deps/curl/.github/FUNDING.yml
vendored
Normal file
6
deps/curl/.github/FUNDING.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
github: curl
|
||||||
|
open_collective: curl
|
55
deps/curl/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
55
deps/curl/.github/ISSUE_TEMPLATE/bug_report.yml
vendored
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Bug Report
|
||||||
|
description: Create a report to help us improve
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for taking the time to fill out this bug report!
|
||||||
|
|
||||||
|
Only file bugs here! Ask questions on the mailing lists https://curl.se/mail/
|
||||||
|
|
||||||
|
**SECURITY RELATED?** Post it here: https://hackerone.com/curl
|
||||||
|
|
||||||
|
There are collections of known issues to be aware of:
|
||||||
|
|
||||||
|
- https://curl.se/docs/knownbugs.html
|
||||||
|
- https://curl.se/docs/todo.html
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: reproducer
|
||||||
|
attributes:
|
||||||
|
label: I did this
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: expected-behaviour
|
||||||
|
attributes:
|
||||||
|
label: I expected the following
|
||||||
|
validations:
|
||||||
|
required: false
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: version
|
||||||
|
attributes:
|
||||||
|
label: curl/libcurl version
|
||||||
|
description: |
|
||||||
|
Please paste the output of `curl -V` here.
|
||||||
|
placeholder: 'curl 8.2.0'
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
- type: textarea
|
||||||
|
id: os
|
||||||
|
attributes:
|
||||||
|
label: operating system
|
||||||
|
description: |
|
||||||
|
On Unix please post the output of `uname -a` here.
|
||||||
|
placeholder: 'Fedora Linux 38'
|
||||||
|
validations:
|
||||||
|
required: true
|
15
deps/curl/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
15
deps/curl/.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Feature request
|
||||||
|
url: https://curl.se/mail/
|
||||||
|
about: To propose new features or enhancements, please bring that discussion to a suitable curl mailing list.
|
||||||
|
- name: Question
|
||||||
|
url: https://curl.se/mail/
|
||||||
|
about: Questions should go to the mailing list
|
||||||
|
- name: Commercial support
|
||||||
|
url: https://curl.se/support.html
|
||||||
|
about: Several companies are offering paid support for curl/libcurl
|
6
deps/curl/.github/dependabot.yml
vendored
Normal file
6
deps/curl/.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
258
deps/curl/.github/labeler.yml
vendored
Normal file
258
deps/curl/.github/labeler.yml
vendored
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
# Copyright (C) Daniel Fandrich, <dan@coneharvesters.com>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
# The workflow configures the .github/workflows/label.yml action
|
||||||
|
# to add labels to pull requests. This is not (yet?) a replacement for human
|
||||||
|
# triaging, but is intended to add labels to the easy cases. If the matching
|
||||||
|
# language becomes more powerful, more cases should be able to be handled.
|
||||||
|
#
|
||||||
|
# Labels are added in two ways: the any-glob-to-all-files ones are added if all
|
||||||
|
# the files fit into the category, and the any-glob-to-any-file ones are added
|
||||||
|
# as long as any file matches. The first ones are for "major" categories (the
|
||||||
|
# PR is all about that one topic, like HTTP/3), while the second ones are
|
||||||
|
# "addendums" that give useful information about a PR that's really mostly
|
||||||
|
# something else (e.g. CI if the PR also touches CI jobs).
|
||||||
|
#
|
||||||
|
# N.B. any-glob-to-all-files is misnamed; it acts like one-glob-to-all-files.
|
||||||
|
# Therefore, to get any-glob-to-all-files semantics, there must be a single glob
|
||||||
|
# with all matching patterns within braces.
|
||||||
|
#
|
||||||
|
# See https://github.com/actions/labeler/ for documentation on this file.
|
||||||
|
|
||||||
|
appleOS:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{.github/workflows/macos.yml,lib/config-mac.h,lib/macos*,lib/vtls/sectransp*,m4/curl-sectransp.m4,MacOSX-Framework}'
|
||||||
|
|
||||||
|
authentication:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/mk-ca-bundle.1,docs/libcurl/opts/CURLINFO_HTTPAUTH*,docs/libcurl/opts/CURLINFO_PROXYAUTH*,docs/libcurl/opts/CURLOPT_KRB*,docs/libcurl/opts/CURLOPT_SASL*,docs/libcurl/opts/CURLOPT_SERVICE_NAME*,docs/libcurl/opts/CURLOPT_USERNAME*,docs/libcurl/opts/CURLOPT_USERPWD*,docs/libcurl/opts/CURLOPT_XOAUTH*,lib/*gssapi*,lib/*krb5*,lib/*ntlm*,lib/curl_sasl.*,lib/http_aws*,lib/http_digest.*,lib/http_negotiate.*,lib/vauth/**,tests/server/fake_ntlm.c}'
|
||||||
|
|
||||||
|
build:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{**/CMakeLists.txt,**/Makefile.am,**/Makefile.inc,**/Makefile.mk,**/*.m4,**/*.mk,*.m4,docs/INSTALL.cmake,lib/curl_config.h.cmake,lib/libcurl*.in,CMake/**,CMakeLists.txt,configure.ac,m4/**,MacOSX-Framework,Makefile.*,packages/**,plan9/**,projects/**,winbuild/**,libcurl.def}'
|
||||||
|
|
||||||
|
CI:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- '.github/**'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'scripts/ci*'
|
||||||
|
- 'tests/azure.pm'
|
||||||
|
- 'tests/appveyor.pm'
|
||||||
|
- 'tests/CI.md'
|
||||||
|
|
||||||
|
cmake:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{**/CMakeLists.txt,CMake/**,docs/INSTALL.cmake,lib/curl_config.h.cmake}'
|
||||||
|
|
||||||
|
cmdline tool:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- 'docs/cmdline-opts/**'
|
||||||
|
- 'src/**'
|
||||||
|
|
||||||
|
connecting & proxies:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/CONNECTION-FILTERS.md,docs/examples/ipv6.c,docs/libcurl/opts/CURLINFO_CONNECT*,docs/libcurl/opts/CURLINFO_PROXY*,docs/libcurl/opts/CURLOPT_ADDRESS*,docs/libcurl/opts/CURLOPT_CONNECT*,docs/libcurl/opts/CURLOPT_HAPROXY*,docs/libcurl/opts/CURLOPT_OPENSOCKET*,docs/libcurl/opts/CURLOPT_PRE_PROXY*,docs/libcurl/opts/CURLOPT_PROXY*,docs/libcurl/opts/CURLOPT_SOCKOPT*,docs/libcurl/opts/CURLOPT_SOCKS*,docs/libcurl/opts/CURLOPT_TCP*,docs/libcurl/opts/CURLOPT_TIMEOUT*,lib/cf-*proxy.*,lib/cf-socket.*,lib/cfilters.*,lib/conncache.*,lib/connect.*,lib/http_proxy.*,lib/if2ip.*,lib/noproxy.*,lib/socks.*,tests/server/socksd.c}'
|
||||||
|
|
||||||
|
cookies:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/HTTP-COOKIES.md,docs/cmdline-opts/cookie*,docs/cmdline-opts/junk-session-cookies.d,docs/libcurl/opts/CURLINFO_COOKIE*,docs/libcurl/opts/CURLOPT_COOKIE*,docs/examples/cookie_interface.c,lib/cookie.*,lib/psl.*}'
|
||||||
|
|
||||||
|
cryptography:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/CIPHERS.md,docs/RUSTLS.md,docs/libcurl/opts/CURLOPT_EGDSOCKET*,lib/*sha256*,lib/curl_des.*,lib/curl_hmac.*,lib/curl_md?.*,lib/md?.*,lib/rand.*}'
|
||||||
|
|
||||||
|
DICT:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/dict.*,tests/dictserver.py}'
|
||||||
|
|
||||||
|
documentation:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{**/*.md,**/*.txt,**/*.1,**/*.3,CHANGES,docs/**,GIT-INFO,LICENSES/**,README,RELEASE-NOTES}'
|
||||||
|
- all-globs-to-all-files:
|
||||||
|
# negative matches
|
||||||
|
- '!**/CMakeLists.txt'
|
||||||
|
- '!**/Makefile.am'
|
||||||
|
|
||||||
|
FTP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/libcurl/opts/CURLINFO_FTP*,docs/libcurl/opts/CURLOPT_FTP*,docs/libcurl/opts/CURLOPT_WILDCARDMATCH*,docs/examples/ftp*,lib/curl_fnmatch.*,lib/curl_range.*,lib/ftp*,tests/ftp*'
|
||||||
|
|
||||||
|
GOPHER:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/gopher*}'
|
||||||
|
|
||||||
|
HTTP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/examples/hsts*,docs/examples/http-*,docs/examples/httpput*,docs/examples/https*,docs/examples/*post*,docs/HSTS.md,docs/HTTP-COOKIES.md,docs/libcurl/opts/CURLINFO_COOKIE*,docs/libcurl/opts/CURLOPT_COOKIE*,docs/libcurl/opts/CURLINFO_HTTP_**,docs/libcurl/opts/CURLINFO_REDIRECT*,docs/libcurl/opts/CURLINFO_REFER*,docs/libcurl/opts/CURLOPT_FOLLOWLOCATION*,docs/libcurl/opts/CURLOPT_HSTS*,docs/libcurl/opts/CURLOPT_HTTP*,docs/libcurl/opts/CURLOPT_POST.*,docs/libcurl/opts/CURLOPT_POSTFIELD*,docs/libcurl/opts/CURLOPT_POSTREDIR*,docs/libcurl/opts/CURLOPT_REDIR*,docs/libcurl/opts/CURLOPT_REFER*,docs/libcurl/opts/CURLOPT_TRAILER*,docs/libcurl/opts/CURLOPT_TRANSFER_ENCODING*,lib/cf-https*,lib/cf-h1*,lib/cf-h2*,lib/cookie.*,lib/http*,tests/http*,tests/http-server.pl,tests/http/*,tests/nghttp*}'
|
||||||
|
|
||||||
|
HTTP/2:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{CMake/FindNGHTTP2.cmake,CMake/FindQUICHE.cmake,docs/HTTP2.md,docs/libcurl/opts/CURLOPT_STREAM*,docs/examples/http2*,lib/http2*,tests/http2-server.pl}'
|
||||||
|
|
||||||
|
HTTP/3:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{.github/workflows/ngtcp2*,.github/workflows/quiche*,CMake/FindMSH3.cmake,CMake/FindNGHTTP3.cmake,CMake/FindNGTCP2.cmake,docs/HTTP3.md,docs/examples/http3*,lib/vquic/**,tests/http3-server.pl,tests/nghttpx.conf}'
|
||||||
|
|
||||||
|
Hyper:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/HYPER.md,lib/c-hyper.*}'
|
||||||
|
|
||||||
|
IMAP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/imap*,docs/examples/imap*}'
|
||||||
|
|
||||||
|
LDAP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/*ldap*}'
|
||||||
|
|
||||||
|
libcurl API:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- 'docs/libcurl/ABI.md'
|
||||||
|
- 'docs/libcurl/curl_*.3'
|
||||||
|
- 'include/curl/**'
|
||||||
|
|
||||||
|
logging:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/cmdline-opts/trace*,docs/libcurl/curl_global_trace*,lib/curl_trc*,tests/http/test_15_tracing.py}'
|
||||||
|
|
||||||
|
MIME:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/libcurl/curl_form*,docs/libcurl/curl_mime_*,docs/libcurl/opts/CURLOPT_MIME*,docs/libcurl/opts/CURLOPT_HTTPPOST*,lib/formdata*,lib/mime*,src/tool_formparse.*}'
|
||||||
|
|
||||||
|
MQTT:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/MQTT.md,lib/mqtt*,tests/server/mqttd.c}'
|
||||||
|
|
||||||
|
name lookup:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/examples/resolve.c,docs/libcurl/opts/CURLINFO_NAMELOOKUP*,docs/libcurl/opts/CURLOPT_DNS*,docs/libcurl/opts/CURLOPT_DOH*,docs/libcurl/opts/CURLOPT_RESOLVE*,lib/asyn*,lib/curl_gethostname.*,lib/doh*,lib/host*,lib/idn*,lib/inet_pton.*,lib/socketpair*,tests/server/resolve.c}'
|
||||||
|
|
||||||
|
POP3:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/examples/pop3*,lib/pop3.*}'
|
||||||
|
|
||||||
|
RTMP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/curl_rtmp.*}'
|
||||||
|
|
||||||
|
RTSP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/libcurl/opts/CURLINFO_RTSP*,docs/libcurl/opts/CURLOPT_RTSP*,lib/rtsp.*,tests/rtspserver.pl,tests/server/rtspd.c}'
|
||||||
|
|
||||||
|
SCP/SFTP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{CMake/FindLibSSH2.cmake,docs/libcurl/opts/CURLOPT_SSH*,docs/examples/sftp*,lib/vssh/**,tests/sshhelp.pm,tests/sshserver.pl}'
|
||||||
|
|
||||||
|
script:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{**/*.pl,**/*.sh,curl-config.in,docs/curl-config.1,docs/mk-ca-bundle.1,docs/THANKS-filter,scripts/**}'
|
||||||
|
|
||||||
|
SMB:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/smb.*,tests/smbserver.py}'
|
||||||
|
|
||||||
|
SMTP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/examples/smtp-*,docs/libcurl/opts/CURLOPT_MAIL*,lib/smtp.*}'
|
||||||
|
|
||||||
|
tests:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-any-file:
|
||||||
|
- 'tests/**'
|
||||||
|
|
||||||
|
TFTP:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{lib/tftp.*,tests/tftpserver.pl,tests/server/tftp*}'
|
||||||
|
|
||||||
|
TLS:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{CMake/FindBearSSL.cmake,CMake/FindMbedTLS.cmake,CMake/FindWolfSSL.cmake,docs/examples/ssl*,docs/examples/*ssl.*,docs/examples/*tls.*,docs/SSL*,docs/libcurl/curl_global_sslset*,docs/libcurl/opts/CURLINFO_CA*,docs/libcurl/opts/CURLINFO_CERT*,docs/libcurl/opts/CURLINFO_SSL*,docs/libcurl/opts/CURLINFO_TLS*,docs/libcurl/opts/CURLOPT_CA*,docs/libcurl/opts/CURLOPT_CERT*,docs/libcurl/opts/CURLOPT_PINNEDPUBLICKEY*,docs/libcurl/opts/CURLOPT_SSL*,docs/libcurl/opts/CURLOPT_TLS*,docs/libcurl/opts/CURLOPT_USE_SSL*,lib/vtls/**,m4/curl-bearssl.m4,m4/curl-gnutls.m4,m4/curl-mbedtls.m4,m4/curl-openssl.m4,m4/curl-rustls.m4,m4/curl-schannel.m4,m4/curl-sectransp.m4,m4/curl-wolfssl.m4}'
|
||||||
|
|
||||||
|
URL:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/libcurl/curl_url*,docs/URL-SYNTAX.md,docs/examples/parseurl*,include/curl/urlapi.h,lib/urlapi*}'
|
||||||
|
|
||||||
|
WebSocket:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{docs/WEBSOCKET.md*,docs/examples/websocket*,docs/libcurl/curl_ws_*,docs/libcurl/libcurl-ws*,docs/libcurl/opts/CURLOPT_WS_*,include/curl/websockets.h,lib/ws.*,tests/http/clients/ws*,tests/http/test_20_websockets.py,tests/http/testenv/ws*}'
|
||||||
|
|
||||||
|
Windows:
|
||||||
|
- all:
|
||||||
|
- changed-files:
|
||||||
|
- any-glob-to-all-files:
|
||||||
|
- '{appveyor.*,CMake/Platforms/WindowsCache.cmake,lib/*win32*,lib/curl_multibyte.*,lib/rename.*,lib/vtls/schannel*,m4/curl-schannel.m4,projects/**,src/tool_doswin.c,winbuild/**,libcurl.def}'
|
12
deps/curl/.github/lock.yml
vendored
Normal file
12
deps/curl/.github/lock.yml
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
# Configuration for lock-threads - https://github.com/dessant/lock-threads
|
||||||
|
|
||||||
|
# Number of days of inactivity before a closed issue or pull request is locked
|
||||||
|
daysUntilLock: 90
|
||||||
|
# Comment to post before locking. Set to `false` to disable
|
||||||
|
lockComment: false
|
||||||
|
# Limit to only `issues` or `pulls`
|
||||||
|
# only: issues
|
67
deps/curl/.github/scripts/badwords.pl
vendored
Normal file
67
deps/curl/.github/scripts/badwords.pl
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
# bad[:=]correct
|
||||||
|
#
|
||||||
|
# If separator is '=', the string will be compared case sensitively.
|
||||||
|
# If separator is ':', the check is done case insensitively.
|
||||||
|
#
|
||||||
|
my $w;
|
||||||
|
while(<STDIN>) {
|
||||||
|
chomp;
|
||||||
|
if($_ =~ /^#/) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
if($_ =~ /^([^:=]*)([:=])(.*)/) {
|
||||||
|
my ($bad, $sep, $better)=($1, $2, $3);
|
||||||
|
push @w, $bad;
|
||||||
|
$alt{$bad} = $better;
|
||||||
|
if($sep eq "=") {
|
||||||
|
$exactcase{$bad} = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $errors;
|
||||||
|
|
||||||
|
sub file {
|
||||||
|
my ($f) = @_;
|
||||||
|
my $l = 0;
|
||||||
|
open(F, "<$f");
|
||||||
|
while(<F>) {
|
||||||
|
my $in = $_;
|
||||||
|
$l++;
|
||||||
|
chomp $in;
|
||||||
|
if($in =~ /^ /) {
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
# remove the link part
|
||||||
|
$in =~ s/(\[.*\])\(.*\)/$1/g;
|
||||||
|
# remove backticked texts
|
||||||
|
$in =~ s/\`.*\`//g;
|
||||||
|
foreach my $w (@w) {
|
||||||
|
my $case = $exactcase{$w};
|
||||||
|
if(($in =~ /^(.*)$w/i && !$case) ||
|
||||||
|
($in =~ /^(.*)$w/ && $case) ) {
|
||||||
|
my $p = $1;
|
||||||
|
my $c = length($p)+1;
|
||||||
|
print STDERR "$f:$l:$c: error: found bad word \"$w\"\n";
|
||||||
|
printf STDERR " %4d | $in\n", $l;
|
||||||
|
printf STDERR " | %*s^%s\n", length($p), " ",
|
||||||
|
"~" x (length($w)-1);
|
||||||
|
printf STDERR " maybe use \"%s\" instead?\n", $alt{$w};
|
||||||
|
$errors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
}
|
||||||
|
|
||||||
|
my @files = @ARGV;
|
||||||
|
|
||||||
|
foreach my $each (@files) {
|
||||||
|
file($each);
|
||||||
|
}
|
||||||
|
exit $errors;
|
49
deps/curl/.github/scripts/badwords.txt
vendored
Normal file
49
deps/curl/.github/scripts/badwords.txt
vendored
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
back-end:backend
|
||||||
|
e-mail:email
|
||||||
|
run-time:runtime
|
||||||
|
set-up:setup
|
||||||
|
tool chain:toolchain
|
||||||
|
tool-chain:toolchain
|
||||||
|
wild-card:wildcard
|
||||||
|
wild card:wildcard
|
||||||
|
i'm:I am
|
||||||
|
you've:You have
|
||||||
|
they've:They have
|
||||||
|
they're:They are
|
||||||
|
should've:should have
|
||||||
|
don't:do not
|
||||||
|
could've:could have
|
||||||
|
doesn't:does not
|
||||||
|
isn't:is not
|
||||||
|
a html: an html
|
||||||
|
a http: an http
|
||||||
|
a ftp: an ftp
|
||||||
|
url =URL
|
||||||
|
internet\b=Internet
|
||||||
|
isation:ization
|
||||||
|
it's:it is
|
||||||
|
there's:there is
|
||||||
|
[^.]\. And: Rewrite it somehow?
|
||||||
|
^(And|So|But) = Rewrite it somehow?
|
||||||
|
\. But: Rewrite it somehow?
|
||||||
|
\. So : Rewrite without "so" ?
|
||||||
|
dir :directory
|
||||||
|
you'd:you would
|
||||||
|
you'll:you will
|
||||||
|
can't:cannot
|
||||||
|
that's:that is
|
||||||
|
web page:webpage
|
||||||
|
host name\b:hostname
|
||||||
|
host names\b:hostnames
|
||||||
|
file name\b:filename
|
||||||
|
file names\b:filenames
|
||||||
|
user name\b:username
|
||||||
|
user names\b:usernames
|
||||||
|
didn't:did not
|
||||||
|
doesn't:does not
|
||||||
|
won't:will not
|
||||||
|
couldn't:could not
|
54
deps/curl/.github/scripts/cleancmd.pl
vendored
Normal file
54
deps/curl/.github/scripts/cleancmd.pl
vendored
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
# Input: a cmdline docs markdown, it gets modfied *in place*
|
||||||
|
#
|
||||||
|
# The main purpose is to strip off the leading meta-data part, but also to
|
||||||
|
# clean up whatever else the spell checker might have a problem with that we
|
||||||
|
# still deem is fine.
|
||||||
|
|
||||||
|
my $header = 1;
|
||||||
|
while(1) {
|
||||||
|
# set this if the markdown has no meta-data header to skip
|
||||||
|
if($ARGV[0] eq "--no-header") {
|
||||||
|
shift @ARGV;
|
||||||
|
$header = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
my $f = $ARGV[0];
|
||||||
|
|
||||||
|
open(F, "<$f") or die;
|
||||||
|
|
||||||
|
my $ignore = $header;
|
||||||
|
my $sepcount = 0;
|
||||||
|
my @out;
|
||||||
|
while(<F>) {
|
||||||
|
if(/^---/ && $header) {
|
||||||
|
if(++$sepcount == 2) {
|
||||||
|
$ignore = 0;
|
||||||
|
}
|
||||||
|
next;
|
||||||
|
}
|
||||||
|
next if($ignore);
|
||||||
|
|
||||||
|
# strip out all long command line options
|
||||||
|
$_ =~ s/--[a-z0-9-]+//g;
|
||||||
|
|
||||||
|
# strip out https URLs, we don't want them spellchecked
|
||||||
|
$_ =~ s!https://[a-z0-9\#_/.-]+!!gi;
|
||||||
|
|
||||||
|
push @out, $_;
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
|
||||||
|
if(!$ignore) {
|
||||||
|
open(O, ">$f") or die;
|
||||||
|
print O @out;
|
||||||
|
close(O);
|
||||||
|
}
|
86
deps/curl/.github/scripts/cleanspell.pl
vendored
Normal file
86
deps/curl/.github/scripts/cleanspell.pl
vendored
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
# Given: a libcurl curldown man page
|
||||||
|
# Outputs: the same file, minus the SYNOPSIS and the EXAMPLE sections
|
||||||
|
#
|
||||||
|
|
||||||
|
my $f = $ARGV[0];
|
||||||
|
|
||||||
|
open(F, "<$f") or die;
|
||||||
|
|
||||||
|
my @out;
|
||||||
|
my $ignore = 0;
|
||||||
|
while(<F>) {
|
||||||
|
if($_ =~ /^# (SYNOPSIS|EXAMPLE)/) {
|
||||||
|
$ignore = 1;
|
||||||
|
}
|
||||||
|
elsif($ignore && ($_ =~ /^# [A-Z]/)) {
|
||||||
|
$ignore = 0;
|
||||||
|
}
|
||||||
|
elsif(!$ignore) {
|
||||||
|
# **bold**
|
||||||
|
$_ =~ s/\*\*(\S.*?)\*\*//g;
|
||||||
|
# *italics*
|
||||||
|
$_ =~ s/\*(\S.*?)\*//g;
|
||||||
|
|
||||||
|
$_ =~ s/CURL(M|SH|U|H)code//g;
|
||||||
|
$_ =~ s/CURL_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLALTSVC_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLAUTH_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLFORM_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLFTP_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLFTPAUTH_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLFTPMETHOD_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLFTPSSL_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLGSSAPI_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLHEADER_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLINFO_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLM_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLMIMEOPT_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLMOPT_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLOPT_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLPIPE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLPROTO_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLPROXY_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLPX_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLSHE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLSHOPT_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLSSLOPT_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLSSH_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLSSLBACKEND_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLU_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLUPART_[A-Z0-9_]*//g;
|
||||||
|
#$_ =~ s/\bCURLU\b//g; # stand-alone CURLU
|
||||||
|
$_ =~ s/CURLUE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLHE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLWS_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLKH[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLUPART_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLUSESSL_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLPAUSE_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/CURLHSTS_[A-Z0-9_]*//g;
|
||||||
|
$_ =~ s/curl_global_([a-z_]*)//g;
|
||||||
|
$_ =~ s/curl_(strequal|strnequal|formadd|waitfd|formget|getdate|formfree)//g;
|
||||||
|
$_ =~ s/curl_easy_([a-z]*)//g;
|
||||||
|
$_ =~ s/curl_multi_([a-z_]*)//g;
|
||||||
|
$_ =~ s/curl_mime_(subparts|addpart|filedata|data_cb)//g;
|
||||||
|
$_ =~ s/curl_ws_(send|recv|meta)//g;
|
||||||
|
$_ =~ s/curl_url_(dup)//g;
|
||||||
|
$_ =~ s/curl_pushheader_by(name|num)//g;
|
||||||
|
$_ =~ s/libcurl-(env|ws)//g;
|
||||||
|
$_ =~ s/libcurl\\-(env|ws)//g;
|
||||||
|
$_ =~ s/(^|\W)((tftp|https|http|ftp):\/\/[a-z0-9\-._~%:\/?\#\[\]\@!\$&'()*+,;=\\]+)//gi;
|
||||||
|
push @out, $_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
|
||||||
|
open(O, ">$f") or die;
|
||||||
|
for my $l (@out) {
|
||||||
|
print O $l;
|
||||||
|
}
|
||||||
|
close(O);
|
15
deps/curl/.github/scripts/codespell-ignore.txt
vendored
Normal file
15
deps/curl/.github/scripts/codespell-ignore.txt
vendored
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
clen
|
||||||
|
te
|
||||||
|
wont
|
||||||
|
statics
|
||||||
|
nome
|
||||||
|
wast
|
||||||
|
numer
|
||||||
|
anull
|
||||||
|
inout
|
||||||
|
msdos
|
||||||
|
ba
|
||||||
|
fo
|
932
deps/curl/.github/scripts/spellcheck.words
vendored
Normal file
932
deps/curl/.github/scripts/spellcheck.words
vendored
Normal file
@ -0,0 +1,932 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
ABI
|
||||||
|
accessor
|
||||||
|
ACK
|
||||||
|
AES
|
||||||
|
AIA
|
||||||
|
AIX
|
||||||
|
al
|
||||||
|
Alessandro
|
||||||
|
allocator
|
||||||
|
alnum
|
||||||
|
ALPN
|
||||||
|
Altera
|
||||||
|
AltSvc
|
||||||
|
ALTSVC
|
||||||
|
amiga
|
||||||
|
AmigaOS
|
||||||
|
AmiSSL
|
||||||
|
anyauth
|
||||||
|
anycast
|
||||||
|
apache
|
||||||
|
Apache
|
||||||
|
API
|
||||||
|
APIs
|
||||||
|
APOP
|
||||||
|
AppVeyor
|
||||||
|
archivers
|
||||||
|
Archos
|
||||||
|
Arntsen
|
||||||
|
Aros
|
||||||
|
ascii
|
||||||
|
asynch
|
||||||
|
AsynchDNS
|
||||||
|
atime
|
||||||
|
auth
|
||||||
|
autobuild
|
||||||
|
autobuilds
|
||||||
|
Autoconf
|
||||||
|
autoconf
|
||||||
|
Automake
|
||||||
|
Autotools
|
||||||
|
autotools
|
||||||
|
AVR
|
||||||
|
AWS
|
||||||
|
AWS-LC
|
||||||
|
axTLS
|
||||||
|
backend
|
||||||
|
backends
|
||||||
|
backoff
|
||||||
|
backticks
|
||||||
|
balancers
|
||||||
|
Baratov
|
||||||
|
basename
|
||||||
|
bashrc
|
||||||
|
BDFL
|
||||||
|
BearSSL
|
||||||
|
Benoit
|
||||||
|
BeOS
|
||||||
|
bitmask
|
||||||
|
bitwise
|
||||||
|
Björn
|
||||||
|
Bjørn
|
||||||
|
bool
|
||||||
|
boolean
|
||||||
|
BoringSSL
|
||||||
|
boringssl
|
||||||
|
Boukris
|
||||||
|
Broadcom
|
||||||
|
brotli
|
||||||
|
bufq
|
||||||
|
bufref
|
||||||
|
bugfix
|
||||||
|
bugfixes
|
||||||
|
buildable
|
||||||
|
buildbot
|
||||||
|
buildconf
|
||||||
|
Caddy
|
||||||
|
calloc
|
||||||
|
CAPA
|
||||||
|
capath
|
||||||
|
CCC
|
||||||
|
CDN
|
||||||
|
CentOS
|
||||||
|
CFLAGS
|
||||||
|
cflags
|
||||||
|
CGI's
|
||||||
|
CHACHA
|
||||||
|
chacha
|
||||||
|
Chaffraix
|
||||||
|
changelog
|
||||||
|
changeset
|
||||||
|
CharConv
|
||||||
|
charset
|
||||||
|
charsets
|
||||||
|
checksrc
|
||||||
|
checksums
|
||||||
|
chgrp
|
||||||
|
chmod
|
||||||
|
chown
|
||||||
|
ChromeOS
|
||||||
|
CI's
|
||||||
|
CIDR
|
||||||
|
CIFS
|
||||||
|
CLA
|
||||||
|
CLAs
|
||||||
|
cleartext
|
||||||
|
CLI
|
||||||
|
clientp
|
||||||
|
cliget
|
||||||
|
closesocket
|
||||||
|
CMake
|
||||||
|
cmake
|
||||||
|
CMake's
|
||||||
|
cmake's
|
||||||
|
CMakeLists
|
||||||
|
CodeQL
|
||||||
|
codeql
|
||||||
|
CODESET
|
||||||
|
codeset
|
||||||
|
Comcast
|
||||||
|
Config
|
||||||
|
config
|
||||||
|
conncache
|
||||||
|
connectdata
|
||||||
|
CookieInfo
|
||||||
|
Coverity
|
||||||
|
CPUs
|
||||||
|
CR
|
||||||
|
CRL
|
||||||
|
CRLF
|
||||||
|
crt
|
||||||
|
crypto
|
||||||
|
cryptographic
|
||||||
|
cryptographically
|
||||||
|
CSEQ
|
||||||
|
CSeq
|
||||||
|
csh
|
||||||
|
cshrc
|
||||||
|
CTRL
|
||||||
|
cURL
|
||||||
|
CURLcode
|
||||||
|
curldown
|
||||||
|
CURLE
|
||||||
|
CURLH
|
||||||
|
curlimages
|
||||||
|
CURLINFO
|
||||||
|
curlrc
|
||||||
|
curltest
|
||||||
|
customizable
|
||||||
|
CVE
|
||||||
|
CVSS
|
||||||
|
CWD
|
||||||
|
CWE
|
||||||
|
cyassl
|
||||||
|
Cygwin
|
||||||
|
daniel
|
||||||
|
datatracker
|
||||||
|
dbg
|
||||||
|
Debian
|
||||||
|
DEBUGBUILD
|
||||||
|
decrypt
|
||||||
|
deepcode
|
||||||
|
DELE
|
||||||
|
DER
|
||||||
|
deselectable
|
||||||
|
deserialization
|
||||||
|
Deserialized
|
||||||
|
destructor
|
||||||
|
detections
|
||||||
|
dev
|
||||||
|
devcpp
|
||||||
|
DevOps
|
||||||
|
devtools
|
||||||
|
DHCP
|
||||||
|
dir
|
||||||
|
distro
|
||||||
|
distro's
|
||||||
|
distros
|
||||||
|
DJGPP
|
||||||
|
dlist
|
||||||
|
DLL
|
||||||
|
dll
|
||||||
|
DLLs
|
||||||
|
DNS
|
||||||
|
dns
|
||||||
|
dnsop
|
||||||
|
DoH
|
||||||
|
doxygen
|
||||||
|
drftpd
|
||||||
|
dsa
|
||||||
|
Dudka
|
||||||
|
Dymond
|
||||||
|
dynbuf
|
||||||
|
EAGAIN
|
||||||
|
EBCDIC
|
||||||
|
ECC
|
||||||
|
ECDHE
|
||||||
|
ECH
|
||||||
|
ECONNREFUSED
|
||||||
|
eCOS
|
||||||
|
EFnet
|
||||||
|
EGD
|
||||||
|
EHLO
|
||||||
|
EINTR
|
||||||
|
else's
|
||||||
|
encodings
|
||||||
|
enctype
|
||||||
|
endianness
|
||||||
|
Engler
|
||||||
|
enum
|
||||||
|
epoll
|
||||||
|
EPRT
|
||||||
|
EPSV
|
||||||
|
ERRNO
|
||||||
|
errno
|
||||||
|
ESNI
|
||||||
|
et
|
||||||
|
etag
|
||||||
|
ETag
|
||||||
|
ETags
|
||||||
|
exe
|
||||||
|
executables
|
||||||
|
EXPN
|
||||||
|
extensibility
|
||||||
|
failsafe
|
||||||
|
Falkeborn
|
||||||
|
Fandrich
|
||||||
|
Fastly
|
||||||
|
fcpp
|
||||||
|
Fedora
|
||||||
|
Feltzing
|
||||||
|
ffi
|
||||||
|
filesize
|
||||||
|
filesystem
|
||||||
|
FLOSS
|
||||||
|
fnmatch
|
||||||
|
formpost
|
||||||
|
formposts
|
||||||
|
Fortnite
|
||||||
|
FOSS
|
||||||
|
FPL
|
||||||
|
fread
|
||||||
|
FreeBSD
|
||||||
|
FreeDOS
|
||||||
|
FreeRTOS
|
||||||
|
freshmeat
|
||||||
|
Frexx
|
||||||
|
FS
|
||||||
|
fseek
|
||||||
|
FTPing
|
||||||
|
fuzzer
|
||||||
|
fwrite
|
||||||
|
Garmin
|
||||||
|
gcc
|
||||||
|
GCM
|
||||||
|
gdb
|
||||||
|
Genode
|
||||||
|
Gentoo
|
||||||
|
Gergely
|
||||||
|
getaddrinfo
|
||||||
|
getenv
|
||||||
|
gethostbyname
|
||||||
|
gethostname
|
||||||
|
Getinfo
|
||||||
|
getinfo
|
||||||
|
GETing
|
||||||
|
getpwuid
|
||||||
|
ggcov
|
||||||
|
Ghedini
|
||||||
|
Gisle
|
||||||
|
Glesys
|
||||||
|
globbed
|
||||||
|
globbing
|
||||||
|
gmail
|
||||||
|
GnuTLS
|
||||||
|
gnutls
|
||||||
|
Golemon
|
||||||
|
GOST
|
||||||
|
GPG
|
||||||
|
GPL
|
||||||
|
GPLed
|
||||||
|
Greear
|
||||||
|
groff
|
||||||
|
gsasl
|
||||||
|
GSKit
|
||||||
|
gskit
|
||||||
|
GSS
|
||||||
|
GSSAPI
|
||||||
|
GTFO
|
||||||
|
Guenter
|
||||||
|
GUIs
|
||||||
|
Gunderson
|
||||||
|
Gustafsson
|
||||||
|
gzip
|
||||||
|
Gzipped
|
||||||
|
gzipped
|
||||||
|
HackerOne
|
||||||
|
HackerOne's
|
||||||
|
HAProxy
|
||||||
|
HardenedBSD
|
||||||
|
Hards
|
||||||
|
Haxx
|
||||||
|
haxx
|
||||||
|
Heimdal
|
||||||
|
HELO
|
||||||
|
HH
|
||||||
|
HMAC
|
||||||
|
Hoersken
|
||||||
|
Holme
|
||||||
|
homebrew
|
||||||
|
hostname
|
||||||
|
hostnames
|
||||||
|
Housley
|
||||||
|
Hruska
|
||||||
|
HSTS
|
||||||
|
hsts
|
||||||
|
HTC
|
||||||
|
html
|
||||||
|
http
|
||||||
|
HTTPAUTH
|
||||||
|
httpd
|
||||||
|
HTTPD
|
||||||
|
httpget
|
||||||
|
HttpGet
|
||||||
|
HTTPS
|
||||||
|
https
|
||||||
|
hyper's
|
||||||
|
Högskolan
|
||||||
|
IANA
|
||||||
|
Icecast
|
||||||
|
ICONV
|
||||||
|
iconv
|
||||||
|
IDN
|
||||||
|
IDNA
|
||||||
|
IETF
|
||||||
|
ietf
|
||||||
|
ifdef
|
||||||
|
ifdefed
|
||||||
|
Ifdefs
|
||||||
|
ifdefs
|
||||||
|
IIS
|
||||||
|
ILE
|
||||||
|
Illumos
|
||||||
|
IMAP
|
||||||
|
imap
|
||||||
|
IMAPS
|
||||||
|
imaps
|
||||||
|
impacket
|
||||||
|
init
|
||||||
|
initializer
|
||||||
|
inlined
|
||||||
|
interop
|
||||||
|
interoperable
|
||||||
|
interoperates
|
||||||
|
IoT
|
||||||
|
ipadOS
|
||||||
|
IPCXN
|
||||||
|
IPFS
|
||||||
|
ipld
|
||||||
|
IPNS
|
||||||
|
IPv
|
||||||
|
IPv4
|
||||||
|
IPv4/6
|
||||||
|
IPv6
|
||||||
|
IRIs
|
||||||
|
IRIX
|
||||||
|
Itanium
|
||||||
|
iX
|
||||||
|
Jakub
|
||||||
|
Jiri
|
||||||
|
jo
|
||||||
|
jpeg
|
||||||
|
jq
|
||||||
|
JSON
|
||||||
|
json
|
||||||
|
Julien
|
||||||
|
Kamil
|
||||||
|
Kaufmann
|
||||||
|
kB
|
||||||
|
KDE
|
||||||
|
keepalive
|
||||||
|
Keil
|
||||||
|
kerberos
|
||||||
|
Keychain
|
||||||
|
keychain
|
||||||
|
KiB
|
||||||
|
kickstart
|
||||||
|
Kirei
|
||||||
|
Knauf
|
||||||
|
kqueue
|
||||||
|
Krb
|
||||||
|
krb
|
||||||
|
Kubernetes
|
||||||
|
Kuhrt
|
||||||
|
Kungliga
|
||||||
|
Largefile
|
||||||
|
LDAP
|
||||||
|
ldap
|
||||||
|
LDAPS
|
||||||
|
ldaps
|
||||||
|
LF
|
||||||
|
LGTM
|
||||||
|
libbrotlidec
|
||||||
|
libc
|
||||||
|
libcurl
|
||||||
|
libcurl's
|
||||||
|
libcurls
|
||||||
|
libera
|
||||||
|
libev
|
||||||
|
libevent
|
||||||
|
libgsasl
|
||||||
|
libidn
|
||||||
|
libnssckbi
|
||||||
|
libnsspem
|
||||||
|
libpsl
|
||||||
|
Libre
|
||||||
|
libre
|
||||||
|
LibreSSL
|
||||||
|
libressl
|
||||||
|
librtmp
|
||||||
|
libs
|
||||||
|
libssh
|
||||||
|
libSSH
|
||||||
|
libssh2
|
||||||
|
Libtool
|
||||||
|
libuv
|
||||||
|
libWebSocket
|
||||||
|
libz
|
||||||
|
libzstd
|
||||||
|
LineageOS
|
||||||
|
linux
|
||||||
|
ln
|
||||||
|
localhost
|
||||||
|
LOGDIR
|
||||||
|
logfile
|
||||||
|
lookups
|
||||||
|
loopback
|
||||||
|
LPRT
|
||||||
|
LSB
|
||||||
|
lseek
|
||||||
|
Lua
|
||||||
|
lwIP
|
||||||
|
macdef
|
||||||
|
macOS
|
||||||
|
macos
|
||||||
|
Makefile
|
||||||
|
makefiles
|
||||||
|
malloc
|
||||||
|
mallocs
|
||||||
|
manpage
|
||||||
|
maprintf
|
||||||
|
Marek
|
||||||
|
Mavrogiannopoulos
|
||||||
|
Mbed
|
||||||
|
mbedTLS
|
||||||
|
Meglio
|
||||||
|
memdebug
|
||||||
|
MesaLink
|
||||||
|
mesalink
|
||||||
|
Metalink
|
||||||
|
mfprintf
|
||||||
|
Michal
|
||||||
|
Micrium
|
||||||
|
MicroBlaze
|
||||||
|
MicroOS
|
||||||
|
mingw
|
||||||
|
MinGW
|
||||||
|
MINIX
|
||||||
|
misconfigured
|
||||||
|
Mishyn
|
||||||
|
mitigations
|
||||||
|
MITM
|
||||||
|
mk
|
||||||
|
mkdir
|
||||||
|
mktime
|
||||||
|
Monnerat
|
||||||
|
monospace
|
||||||
|
MorphOS
|
||||||
|
MPE
|
||||||
|
MPL
|
||||||
|
mprintf
|
||||||
|
MQTT
|
||||||
|
mqtt
|
||||||
|
mqtts
|
||||||
|
MSB
|
||||||
|
MSGSENT
|
||||||
|
msh
|
||||||
|
MSIE
|
||||||
|
msnprintf
|
||||||
|
msprintf
|
||||||
|
msquic
|
||||||
|
mstate
|
||||||
|
MSVC
|
||||||
|
MSYS
|
||||||
|
msys
|
||||||
|
mtime
|
||||||
|
mTLS
|
||||||
|
MUA
|
||||||
|
multicwd
|
||||||
|
multiparts
|
||||||
|
MultiSSL
|
||||||
|
mumbo
|
||||||
|
musedev
|
||||||
|
mutex
|
||||||
|
mvaprintf
|
||||||
|
mvfprintf
|
||||||
|
mvprintf
|
||||||
|
mvsnprintf
|
||||||
|
mvsprintf
|
||||||
|
MX
|
||||||
|
Nagel
|
||||||
|
Nagle
|
||||||
|
NAMELOOKUP
|
||||||
|
Natively
|
||||||
|
NATs
|
||||||
|
nc
|
||||||
|
NCR
|
||||||
|
NDK
|
||||||
|
NEC
|
||||||
|
Necko
|
||||||
|
NetBSD
|
||||||
|
netrc
|
||||||
|
netstat
|
||||||
|
Netware
|
||||||
|
NFS
|
||||||
|
nghttp
|
||||||
|
nghttpx
|
||||||
|
ngtcp
|
||||||
|
Nikos
|
||||||
|
Nios
|
||||||
|
nitems
|
||||||
|
NixOS
|
||||||
|
NLST
|
||||||
|
nmake
|
||||||
|
nmemb
|
||||||
|
nocwd
|
||||||
|
NODELAY
|
||||||
|
NonStop
|
||||||
|
NOOP
|
||||||
|
Novell
|
||||||
|
NPN
|
||||||
|
nroff
|
||||||
|
nslookup
|
||||||
|
NSS
|
||||||
|
nss
|
||||||
|
NTLM
|
||||||
|
NTLMUSER
|
||||||
|
NTLMv
|
||||||
|
NUM
|
||||||
|
NuttX
|
||||||
|
OAuth
|
||||||
|
objcopy
|
||||||
|
OCSP
|
||||||
|
Ok
|
||||||
|
OpenBSD
|
||||||
|
OpenLDAP
|
||||||
|
OpenRISC
|
||||||
|
OpenSSF
|
||||||
|
OpenSSF's
|
||||||
|
OpenSSH
|
||||||
|
OpenSSL
|
||||||
|
OpenStep
|
||||||
|
openSUSE
|
||||||
|
openwall
|
||||||
|
Orbis
|
||||||
|
ORing
|
||||||
|
Osipov
|
||||||
|
OSS
|
||||||
|
pac
|
||||||
|
pacman
|
||||||
|
parser's
|
||||||
|
parsers
|
||||||
|
PASE
|
||||||
|
PASV
|
||||||
|
PEM
|
||||||
|
pem
|
||||||
|
perl
|
||||||
|
permafailing
|
||||||
|
PINGs
|
||||||
|
pipelining
|
||||||
|
PKCS
|
||||||
|
pkcs
|
||||||
|
PKGBUILD
|
||||||
|
PKI
|
||||||
|
pluggable
|
||||||
|
PolarSSL
|
||||||
|
Polhem
|
||||||
|
pollset
|
||||||
|
POSIX
|
||||||
|
Postfix
|
||||||
|
POSTing
|
||||||
|
POSTs
|
||||||
|
PowerShell
|
||||||
|
pre
|
||||||
|
prebuilt
|
||||||
|
precompiled
|
||||||
|
prepend
|
||||||
|
prepended
|
||||||
|
prepending
|
||||||
|
prepends
|
||||||
|
preprocess
|
||||||
|
preprocessed
|
||||||
|
Preprocessing
|
||||||
|
preprocessor
|
||||||
|
Prereq
|
||||||
|
PRET
|
||||||
|
pretransfer
|
||||||
|
printf
|
||||||
|
printf's
|
||||||
|
PSL
|
||||||
|
pthreads
|
||||||
|
PTR
|
||||||
|
ptr
|
||||||
|
punycode
|
||||||
|
PWD
|
||||||
|
pwd
|
||||||
|
py
|
||||||
|
pycurl
|
||||||
|
pytest
|
||||||
|
Pytest
|
||||||
|
QNX
|
||||||
|
QoS
|
||||||
|
Qubes
|
||||||
|
QUIC
|
||||||
|
quictls
|
||||||
|
quicwg
|
||||||
|
Raad
|
||||||
|
radix
|
||||||
|
RAS
|
||||||
|
RBS
|
||||||
|
ReactOS
|
||||||
|
README
|
||||||
|
realloc
|
||||||
|
Realtime
|
||||||
|
rebase
|
||||||
|
RECV
|
||||||
|
recv
|
||||||
|
Redhat
|
||||||
|
redirections
|
||||||
|
redirs
|
||||||
|
redistributable
|
||||||
|
Redox
|
||||||
|
reentrant
|
||||||
|
Referer
|
||||||
|
referer
|
||||||
|
reinitializes
|
||||||
|
Relatedly
|
||||||
|
repo
|
||||||
|
reprioritized
|
||||||
|
resending
|
||||||
|
resends
|
||||||
|
RETR
|
||||||
|
retransmit
|
||||||
|
retrigger
|
||||||
|
RHEL
|
||||||
|
RICS
|
||||||
|
Rikard
|
||||||
|
rmdir
|
||||||
|
ROADMAP
|
||||||
|
Roadmap
|
||||||
|
Rockbox
|
||||||
|
roffit
|
||||||
|
RPG
|
||||||
|
RSA
|
||||||
|
RTMP
|
||||||
|
rtmp
|
||||||
|
RTMPE
|
||||||
|
RTMPS
|
||||||
|
RTMPT
|
||||||
|
RTMPTE
|
||||||
|
RTMPTS
|
||||||
|
RTOS
|
||||||
|
RTP
|
||||||
|
RTSP
|
||||||
|
rtsp
|
||||||
|
RTT
|
||||||
|
runtests
|
||||||
|
runtime
|
||||||
|
Ruslan
|
||||||
|
rustc
|
||||||
|
rustls
|
||||||
|
Sagula
|
||||||
|
SanDisk
|
||||||
|
SAS
|
||||||
|
SASL
|
||||||
|
Satiro
|
||||||
|
Schannel
|
||||||
|
Schindelin
|
||||||
|
SCO
|
||||||
|
SCP
|
||||||
|
scp
|
||||||
|
SDK
|
||||||
|
se
|
||||||
|
SEB
|
||||||
|
SEK
|
||||||
|
selectable
|
||||||
|
Serv
|
||||||
|
setopt
|
||||||
|
setsockopt
|
||||||
|
setuid
|
||||||
|
SFTP
|
||||||
|
sftp
|
||||||
|
sha
|
||||||
|
SHOUTcast
|
||||||
|
SIGALRM
|
||||||
|
SIGCHLD
|
||||||
|
SIGPIPE
|
||||||
|
singlecwd
|
||||||
|
SINIX
|
||||||
|
Sintonen
|
||||||
|
sizeof
|
||||||
|
SLE
|
||||||
|
slist
|
||||||
|
sln
|
||||||
|
SMB
|
||||||
|
smb
|
||||||
|
SMBS
|
||||||
|
smbs
|
||||||
|
SMBv
|
||||||
|
SMTP
|
||||||
|
smtp
|
||||||
|
smtps
|
||||||
|
SMTPS
|
||||||
|
SNI
|
||||||
|
socketopen
|
||||||
|
socketpair
|
||||||
|
sockopt
|
||||||
|
SOCKOPT
|
||||||
|
SOCKSv
|
||||||
|
Solaris
|
||||||
|
SONAME
|
||||||
|
Soref
|
||||||
|
SPARC
|
||||||
|
SPDX
|
||||||
|
SPNEGO
|
||||||
|
Spotify
|
||||||
|
sprintf
|
||||||
|
src
|
||||||
|
SRP
|
||||||
|
SRWLOCK
|
||||||
|
SSL
|
||||||
|
ssl
|
||||||
|
SSLeay
|
||||||
|
SSLKEYLOGFILE
|
||||||
|
sslv
|
||||||
|
SSLv
|
||||||
|
SSLVERSION
|
||||||
|
SSPI
|
||||||
|
stackoverflow
|
||||||
|
STARTTLS
|
||||||
|
STARTTRANSFER
|
||||||
|
stateful
|
||||||
|
statvfs
|
||||||
|
stderr
|
||||||
|
stdin
|
||||||
|
stdout
|
||||||
|
Steinar
|
||||||
|
Stenberg
|
||||||
|
STOR
|
||||||
|
strcat
|
||||||
|
strcpy
|
||||||
|
strdup
|
||||||
|
strerror
|
||||||
|
strlen
|
||||||
|
strncat
|
||||||
|
struct
|
||||||
|
structs
|
||||||
|
Structs
|
||||||
|
stunnel
|
||||||
|
subdirectories
|
||||||
|
subdirectory
|
||||||
|
submitters
|
||||||
|
substring
|
||||||
|
substrings
|
||||||
|
SunOS
|
||||||
|
SunSSH
|
||||||
|
superset
|
||||||
|
svc
|
||||||
|
svcb
|
||||||
|
Svyatoslav
|
||||||
|
Swisscom
|
||||||
|
sws
|
||||||
|
Symbian
|
||||||
|
symlink
|
||||||
|
symlinks
|
||||||
|
syntaxes
|
||||||
|
Szakats
|
||||||
|
TABs
|
||||||
|
Tatsuhiro
|
||||||
|
TBD
|
||||||
|
TCP
|
||||||
|
tcpdump
|
||||||
|
Tekniska
|
||||||
|
testability
|
||||||
|
TFTP
|
||||||
|
tftp
|
||||||
|
threadsafe
|
||||||
|
Tizen
|
||||||
|
TLS
|
||||||
|
tlsv
|
||||||
|
TLSv
|
||||||
|
TODO
|
||||||
|
Tomtom
|
||||||
|
toolchain
|
||||||
|
toolchains
|
||||||
|
toolset
|
||||||
|
toplevel
|
||||||
|
TPF
|
||||||
|
TrackMemory
|
||||||
|
transcode
|
||||||
|
Tru
|
||||||
|
trustless
|
||||||
|
Tse
|
||||||
|
Tsujikawa
|
||||||
|
TTL
|
||||||
|
tvOS
|
||||||
|
txt
|
||||||
|
typedef
|
||||||
|
typedefed
|
||||||
|
Ubuntu
|
||||||
|
ucLinux
|
||||||
|
UDP
|
||||||
|
UI
|
||||||
|
UID
|
||||||
|
UIDL
|
||||||
|
Ultrix
|
||||||
|
Unary
|
||||||
|
unassign
|
||||||
|
UNC
|
||||||
|
uncompress
|
||||||
|
unencoded
|
||||||
|
unencrypted
|
||||||
|
unescape
|
||||||
|
Unglobbed
|
||||||
|
Unicode
|
||||||
|
UNICOS
|
||||||
|
unix
|
||||||
|
UnixSockets
|
||||||
|
UnixWare
|
||||||
|
unlink
|
||||||
|
unpause
|
||||||
|
unpaused
|
||||||
|
unpauses
|
||||||
|
unpausing
|
||||||
|
unsanitized
|
||||||
|
Unshare
|
||||||
|
unsharing
|
||||||
|
untrusted
|
||||||
|
UPN
|
||||||
|
upstreaming
|
||||||
|
URI
|
||||||
|
URIs
|
||||||
|
url
|
||||||
|
URL's
|
||||||
|
urlencoded
|
||||||
|
urlget
|
||||||
|
USD
|
||||||
|
userdata
|
||||||
|
Userinfo
|
||||||
|
userinfo
|
||||||
|
USERPROFILE
|
||||||
|
UTF
|
||||||
|
UX
|
||||||
|
valgrind
|
||||||
|
Vanem
|
||||||
|
vararg
|
||||||
|
VC
|
||||||
|
vcpkg
|
||||||
|
vexxhost
|
||||||
|
Viktor
|
||||||
|
VM
|
||||||
|
VMS
|
||||||
|
VMware
|
||||||
|
vnd
|
||||||
|
VRF
|
||||||
|
VRFY
|
||||||
|
VSE
|
||||||
|
vsprintf
|
||||||
|
vt
|
||||||
|
vtls
|
||||||
|
vxWorks
|
||||||
|
wakeup
|
||||||
|
Warta
|
||||||
|
watchOS
|
||||||
|
WAV
|
||||||
|
WB
|
||||||
|
web page
|
||||||
|
WebDAV
|
||||||
|
WebOS
|
||||||
|
webpage
|
||||||
|
WebSocket
|
||||||
|
WEBSOCKET
|
||||||
|
WHATWG
|
||||||
|
whitespace
|
||||||
|
Whitespaces
|
||||||
|
winbind
|
||||||
|
WinBind
|
||||||
|
winbuild
|
||||||
|
winidn
|
||||||
|
WinIDN
|
||||||
|
WinLDAP
|
||||||
|
WinSock
|
||||||
|
winsock
|
||||||
|
WinSSL
|
||||||
|
winssl
|
||||||
|
Wireshark
|
||||||
|
wolfSSH
|
||||||
|
wolfSSL
|
||||||
|
ws
|
||||||
|
WS
|
||||||
|
WSS
|
||||||
|
www
|
||||||
|
Xbox
|
||||||
|
XDG
|
||||||
|
xdigit
|
||||||
|
Xilinx
|
||||||
|
XP
|
||||||
|
Xtensa
|
||||||
|
XYZ
|
||||||
|
Youtube
|
||||||
|
YYYY
|
||||||
|
YYYYMMDD
|
||||||
|
Zakrzewski
|
||||||
|
Zitzmann
|
||||||
|
zlib
|
||||||
|
zsh
|
||||||
|
zstd
|
||||||
|
Zuul
|
||||||
|
zuul
|
32
deps/curl/.github/scripts/spellcheck.yaml
vendored
Normal file
32
deps/curl/.github/scripts/spellcheck.yaml
vendored
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
# Docs: https://github.com/UnicornGlobal/spellcheck-github-actions
|
||||||
|
matrix:
|
||||||
|
- name: Markdown
|
||||||
|
expect_match: false
|
||||||
|
apsell:
|
||||||
|
mode: en
|
||||||
|
dictionary:
|
||||||
|
wordlists:
|
||||||
|
- wordlist.txt
|
||||||
|
output: wordlist.dic
|
||||||
|
encoding: utf-8
|
||||||
|
pipeline:
|
||||||
|
- pyspelling.filters.markdown:
|
||||||
|
markdown_extensions:
|
||||||
|
- markdown.extensions.extra:
|
||||||
|
- pyspelling.filters.html:
|
||||||
|
comments: true
|
||||||
|
attributes:
|
||||||
|
- title
|
||||||
|
- alt
|
||||||
|
ignores:
|
||||||
|
- ':matches(code, pre)'
|
||||||
|
- 'code'
|
||||||
|
- 'pre'
|
||||||
|
- 'strong'
|
||||||
|
- 'em'
|
||||||
|
sources:
|
||||||
|
- '**/*.md|!docs/BINDINGS.md'
|
110
deps/curl/.github/scripts/verify-examples.pl
vendored
Normal file
110
deps/curl/.github/scripts/verify-examples.pl
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
my @files = @ARGV;
|
||||||
|
my $cfile = "test.c";
|
||||||
|
my $check = "./scripts/checksrc.pl";
|
||||||
|
my $error;
|
||||||
|
|
||||||
|
if($files[0] eq "-h") {
|
||||||
|
print "Usage: verify-synopsis [man pages]\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub testcompile {
|
||||||
|
my $rc = system("gcc -c test.c -DCURL_DISABLE_TYPECHECK -DCURL_ALLOW_OLD_MULTI_SOCKET -DCURL_DISABLE_DEPRECATION -Wunused -Werror -Wno-unused-but-set-variable -I include") >> 8;
|
||||||
|
return $rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub checksrc {
|
||||||
|
my $rc = system("$check test.c") >> 8;
|
||||||
|
return $rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub extract {
|
||||||
|
my($f) = @_;
|
||||||
|
my $syn = 0;
|
||||||
|
my $l = 0;
|
||||||
|
my $iline = 0;
|
||||||
|
my $fail = 0;
|
||||||
|
open(F, "<$f") or die "failed opening input file $f : $!";
|
||||||
|
open(O, ">$cfile") or die "failed opening output file $cfile : $!";
|
||||||
|
print O "#include <curl/curl.h>\n";
|
||||||
|
while(<F>) {
|
||||||
|
$iline++;
|
||||||
|
if(/^.SH EXAMPLE/) {
|
||||||
|
$syn = 1
|
||||||
|
}
|
||||||
|
elsif($syn == 1) {
|
||||||
|
if(/^.nf/) {
|
||||||
|
$syn++;
|
||||||
|
print O "/* !checksrc! disable UNUSEDIGNORE all */\n";
|
||||||
|
print O "/* !checksrc! disable COPYRIGHT all */\n";
|
||||||
|
print O "/* !checksrc! disable FOPENMODE all */\n";
|
||||||
|
printf O "#line %d \"$f\"\n", $iline+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($syn == 2) {
|
||||||
|
if(/^.fi/) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
if(/(?<!\\)(?:\\{2})*\\(?!\\)/) {
|
||||||
|
print STDERR
|
||||||
|
"Error while processing file $f line $iline:\n$_" .
|
||||||
|
"Error: Single backslashes \\ are not properly shown in " .
|
||||||
|
"manpage EXAMPLE output unless they are escaped \\\\.\n";
|
||||||
|
$fail = 1;
|
||||||
|
$error = 1;
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
# two backslashes become one
|
||||||
|
$_ =~ s/\\\\/\\/g;
|
||||||
|
print O $_;
|
||||||
|
$l++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
close(O);
|
||||||
|
|
||||||
|
return ($fail ? 0 : $l);
|
||||||
|
}
|
||||||
|
|
||||||
|
my $count;
|
||||||
|
for my $m (@files) {
|
||||||
|
#print "Verify $m\n";
|
||||||
|
my $out = extract($m);
|
||||||
|
if($out) {
|
||||||
|
$error |= testcompile($m);
|
||||||
|
$error |= checksrc($m);
|
||||||
|
}
|
||||||
|
$count++;
|
||||||
|
}
|
||||||
|
if(!$error) {
|
||||||
|
print "Verified $count man pages ok\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "Detected problems\n";
|
||||||
|
}
|
||||||
|
exit $error;
|
80
deps/curl/.github/scripts/verify-synopsis.pl
vendored
Normal file
80
deps/curl/.github/scripts/verify-synopsis.pl
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
#***************************************************************************
|
||||||
|
# _ _ ____ _
|
||||||
|
# Project ___| | | | _ \| |
|
||||||
|
# / __| | | | |_) | |
|
||||||
|
# | (__| |_| | _ <| |___
|
||||||
|
# \___|\___/|_| \_\_____|
|
||||||
|
#
|
||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# This software is licensed as described in the file COPYING, which
|
||||||
|
# you should have received as part of this distribution. The terms
|
||||||
|
# are also available at https://curl.se/docs/copyright.html.
|
||||||
|
#
|
||||||
|
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||||
|
# copies of the Software, and permit persons to whom the Software is
|
||||||
|
# furnished to do so, under the terms of the COPYING file.
|
||||||
|
#
|
||||||
|
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
# KIND, either express or implied.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
#
|
||||||
|
###########################################################################
|
||||||
|
|
||||||
|
my @files = @ARGV;
|
||||||
|
my $cfile = "test.c";
|
||||||
|
|
||||||
|
if($files[0] eq "-h") {
|
||||||
|
print "Usage: verify-synopsis [man pages]\n";
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
sub testcompile {
|
||||||
|
my $rc = system("gcc -c test.c -DCURL_DISABLE_TYPECHECK -DCURL_ALLOW_OLD_MULTI_SOCKET -I include") >> 8;
|
||||||
|
return $rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sub extract {
|
||||||
|
my($f) = @_;
|
||||||
|
my $syn = 0;
|
||||||
|
my $l = 0;
|
||||||
|
my $iline = 0;
|
||||||
|
open(F, "<$f");
|
||||||
|
open(O, ">$cfile");
|
||||||
|
while(<F>) {
|
||||||
|
$iline++;
|
||||||
|
if(/^.SH SYNOPSIS/) {
|
||||||
|
$syn = 1
|
||||||
|
}
|
||||||
|
elsif($syn == 1) {
|
||||||
|
if(/^.nf/) {
|
||||||
|
$syn++;
|
||||||
|
print O "#line $iline \"$f\"\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elsif($syn == 2) {
|
||||||
|
if(/^.fi/) {
|
||||||
|
last;
|
||||||
|
}
|
||||||
|
# turn the vararg argument into vararg
|
||||||
|
$_ =~ s/, parameter\)\;/, ...);/;
|
||||||
|
print O $_;
|
||||||
|
$l++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
close(F);
|
||||||
|
close(O);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my $error;
|
||||||
|
for my $m (@files) {
|
||||||
|
print "Verify $m\n";
|
||||||
|
extract($m);
|
||||||
|
$error |= testcompile($m);
|
||||||
|
}
|
||||||
|
exit $error;
|
21
deps/curl/.github/stale.yml
vendored
Normal file
21
deps/curl/.github/stale.yml
vendored
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
# Number of days of inactivity before an issue becomes stale
|
||||||
|
daysUntilStale: 180
|
||||||
|
# Number of days of inactivity before a stale issue is closed
|
||||||
|
daysUntilClose: 14
|
||||||
|
# Issues with these labels will never be considered stale
|
||||||
|
exemptLabels:
|
||||||
|
- pinned
|
||||||
|
- security
|
||||||
|
# Label to use when marking an issue as stale
|
||||||
|
staleLabel: stale
|
||||||
|
# Comment to post when marking an issue as stale. Set to `false` to disable
|
||||||
|
markComment: >
|
||||||
|
This issue has been automatically marked as stale because it has not had
|
||||||
|
recent activity. It will be closed if no further activity occurs. Thank you
|
||||||
|
for your contributions.
|
||||||
|
# Comment to post when closing a stale issue. Set to `false` to disable
|
||||||
|
closeComment: false
|
41
deps/curl/.github/workflows/appveyor-status.yml
vendored
Normal file
41
deps/curl/.github/workflows/appveyor-status.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: AppVeyor Status Report
|
||||||
|
|
||||||
|
on:
|
||||||
|
status
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.sha }}-${{ github.event.target_url }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
split:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ github.event.sender.login == 'appveyor[bot]' }}
|
||||||
|
permissions:
|
||||||
|
statuses: write
|
||||||
|
steps:
|
||||||
|
- name: Create individual AppVeyor build statuses
|
||||||
|
if: ${{ github.event.sha && github.event.target_url }}
|
||||||
|
env:
|
||||||
|
APPVEYOR_COMMIT_SHA: ${{ github.event.sha }}
|
||||||
|
APPVEYOR_TARGET_URL: ${{ github.event.target_url }}
|
||||||
|
APPVEYOR_REPOSITORY: ${{ github.event.repository.full_name }}
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
echo ${APPVEYOR_TARGET_URL} | sed 's/\/project\//\/api\/projects\//' | xargs -t -n1 curl -s | \
|
||||||
|
jq -c '.build.jobs[] | {target_url: ($target_url + "/job/" + .jobId),
|
||||||
|
context: (.name | sub("^(Environment: )?"; "AppVeyor / ")),
|
||||||
|
state: (.status | sub("queued"; "pending")
|
||||||
|
| sub("starting"; "pending")
|
||||||
|
| sub("running"; "pending")
|
||||||
|
| sub("failed"; "failure")
|
||||||
|
| sub("cancelled"; "error")),
|
||||||
|
description: .status}' \
|
||||||
|
--arg target_url ${APPVEYOR_TARGET_URL} | tee /dev/stderr | parallel --pipe -j 1 -N 1 \
|
||||||
|
gh api --silent --input - repos/${APPVEYOR_REPOSITORY}/statuses/${APPVEYOR_COMMIT_SHA}
|
152
deps/curl/.github/workflows/awslc.yml
vendored
Normal file
152
deps/curl/.github/workflows/awslc.yml
vendored
Normal file
@ -0,0 +1,152 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Linux AWS-LC
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Hardcoded workflow filename as workflow name above is just Linux again
|
||||||
|
group: awslc-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
awslc-version: 1.13.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autoconf:
|
||||||
|
name: awslc (autoconf)
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
timeout-minutes: 30
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update --yes
|
||||||
|
sudo apt-get install --yes libtool autoconf automake pkg-config stunnel4 libpsl-dev
|
||||||
|
# ensure we don't pick up openssl in this build
|
||||||
|
sudo apt remove --yes libssl-dev
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
name: 'install prereqs and impacket'
|
||||||
|
|
||||||
|
- name: cache awslc
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-awslc
|
||||||
|
env:
|
||||||
|
cache-name: cache-awslc
|
||||||
|
with:
|
||||||
|
path: /home/runner/awslc
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.awslc-version }}
|
||||||
|
|
||||||
|
- name: build awslc
|
||||||
|
if: steps.cache-awslc.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 \
|
||||||
|
https://github.com/awslabs/aws-lc/archive/refs/tags/v${{ env.awslc-version }}.tar.gz
|
||||||
|
tar xzf v${{ env.awslc-version }}.tar.gz
|
||||||
|
mkdir aws-lc-${{ env.awslc-version }}-build
|
||||||
|
cd aws-lc-${{ env.awslc-version }}-build
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=$HOME/awslc ../aws-lc-${{ env.awslc-version }}
|
||||||
|
cmake --build . --parallel
|
||||||
|
cmake --install .
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
../configure --enable-warnings --enable-werror --with-openssl=$HOME/awslc
|
||||||
|
cd ..
|
||||||
|
name: 'configure out-of-tree'
|
||||||
|
|
||||||
|
- run: make -C build V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: make -C build V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make -C build V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make -C build V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
|
||||||
|
cmake:
|
||||||
|
name: awslc (cmake)
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
timeout-minutes: 15
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install cmake stunnel4
|
||||||
|
# ensure we don't pick up openssl in this build
|
||||||
|
sudo apt remove --yes libssl-dev
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
name: 'install prereqs and impacket'
|
||||||
|
|
||||||
|
- name: cache awslc
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-awslc
|
||||||
|
env:
|
||||||
|
cache-name: cache-awslc
|
||||||
|
with:
|
||||||
|
path: /home/runner/awslc
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.awslc-version }}
|
||||||
|
|
||||||
|
- name: build awslc
|
||||||
|
if: steps.cache-awslc.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 \
|
||||||
|
https://github.com/awslabs/aws-lc/archive/refs/tags/v${{ env.awslc-version }}.tar.gz
|
||||||
|
tar xzf v${{ env.awslc-version }}.tar.gz
|
||||||
|
mkdir aws-lc-${{ env.awslc-version }}-build
|
||||||
|
cd aws-lc-${{ env.awslc-version }}-build
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=$HOME/awslc ../aws-lc-${{ env.awslc-version }}
|
||||||
|
cmake --build . --parallel
|
||||||
|
cmake --install .
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# CMAKE_COMPILE_WARNING_AS_ERROR is available in cmake 3.24 or later
|
||||||
|
- run: cmake -Bbuild -DOPENSSL_ROOT_DIR=$HOME/awslc -DBUILD_SHARED_LIBS=ON -DCMAKE_COMPILE_WARNING_AS_ERROR=ON .
|
||||||
|
name: 'cmake generate out-of-tree'
|
||||||
|
|
||||||
|
- run: cmake --build build --parallel
|
||||||
|
name: 'cmake build'
|
||||||
|
|
||||||
|
- run: cmake --install build --prefix $HOME/curl --strip
|
||||||
|
name: 'cmake install'
|
27
deps/curl/.github/workflows/badwords.yml
vendored
Normal file
27
deps/curl/.github/workflows/badwords.yml
vendored
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: badwords
|
||||||
|
|
||||||
|
on:
|
||||||
|
# Trigger the workflow on push or pull requests, but only for the
|
||||||
|
# master branch
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: check
|
||||||
|
run: ./.github/scripts/badwords.pl < .github/scripts/badwords.txt docs/*.md docs/libcurl/*.md docs/libcurl/opts/*.md
|
80
deps/curl/.github/workflows/codeql-analysis.yml
vendored
Normal file
80
deps/curl/.github/workflows/codeql-analysis.yml
vendored
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: CodeQL
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'tests/data/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'docs/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'tests/data/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * 4'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
codeql:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
security-events: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Initializes the CodeQL tools for scanning.
|
||||||
|
- name: Initialize CodeQL
|
||||||
|
uses: github/codeql-action/init@v3
|
||||||
|
with:
|
||||||
|
languages: cpp
|
||||||
|
queries: security-extended
|
||||||
|
|
||||||
|
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||||
|
# If this step fails, then you should remove it and run the build manually (see below)
|
||||||
|
- name: Autobuild
|
||||||
|
uses: github/codeql-action/autobuild@v3
|
||||||
|
|
||||||
|
# ℹ️ Command-line programs to run using the OS shell.
|
||||||
|
# 📚 https://git.io/JvXDl
|
||||||
|
|
||||||
|
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||||
|
# and modify them (or add more) to build your code if your project
|
||||||
|
# uses a compiled language
|
||||||
|
|
||||||
|
# - run: |
|
||||||
|
# make bootstrap
|
||||||
|
# make release
|
||||||
|
|
||||||
|
- name: Perform CodeQL Analysis
|
||||||
|
uses: github/codeql-action/analyze@v3
|
36
deps/curl/.github/workflows/codespell.yml
vendored
Normal file
36
deps/curl/.github/workflows/codespell.yml
vendored
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Codespell
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths:
|
||||||
|
- 'lib/**'
|
||||||
|
- 'src/**'
|
||||||
|
- 'include/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- 'lib/**'
|
||||||
|
- 'src/**'
|
||||||
|
- 'include/**'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
codespell:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: install
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install codespell
|
||||||
|
|
||||||
|
- name: spellcheck
|
||||||
|
run: codespell --skip src/tool_hugehelp.c -I .github/scripts/codespell-ignore.txt include src lib
|
45
deps/curl/.github/workflows/configure-vs-cmake.yml
vendored
Normal file
45
deps/curl/.github/workflows/configure-vs-cmake.yml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: configure-vs-cmake
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- '*.ac'
|
||||||
|
- '**/*.m4'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- 'lib/curl_config.h.cmake'
|
||||||
|
- 'scripts/cmp-config.pl'
|
||||||
|
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- '*.ac'
|
||||||
|
- '**/*.m4'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- 'lib/curl_config.h.cmake'
|
||||||
|
- 'scripts/cmp-config.pl'
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: run configure --with-openssl
|
||||||
|
run: |
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --with-openssl --without-libpsl
|
||||||
|
|
||||||
|
- name: run cmake
|
||||||
|
run: |
|
||||||
|
mkdir build && cd build && cmake ..
|
||||||
|
|
||||||
|
- name: compare generated curl_config.h files
|
||||||
|
run: ./scripts/cmp-config.pl lib/curl_config.h build/lib/curl_config.h
|
122
deps/curl/.github/workflows/distcheck.yml
vendored
Normal file
122
deps/curl/.github/workflows/distcheck.yml
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: dist
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
maketgz-and-verify-in-tree:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: sudo apt-get purge -y curl libcurl4 libcurl4-doc
|
||||||
|
name: 'remove preinstalled curl libcurl4{-doc}'
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure --without-ssl --without-libpsl
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1 && make V=1 clean
|
||||||
|
name: 'make and clean'
|
||||||
|
|
||||||
|
- run: ./maketgz 99.98.97
|
||||||
|
name: 'maketgz'
|
||||||
|
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'release-tgz'
|
||||||
|
path: 'curl-99.98.97.tar.gz'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "::stop-commands::$(uuidgen)"
|
||||||
|
tar xvf curl-99.98.97.tar.gz
|
||||||
|
pushd curl-99.98.97
|
||||||
|
./configure --prefix=$HOME/temp --without-ssl --without-libpsl
|
||||||
|
make
|
||||||
|
make test-ci
|
||||||
|
make install
|
||||||
|
popd
|
||||||
|
# basic check of the installed files
|
||||||
|
bash scripts/installcheck.sh $HOME/temp
|
||||||
|
rm -rf curl-99.98.97
|
||||||
|
name: 'verify in-tree configure build including install'
|
||||||
|
|
||||||
|
verify-out-of-tree-docs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
needs: maketgz-and-verify-in-tree
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'release-tgz'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "::stop-commands::$(uuidgen)"
|
||||||
|
tar xvf curl-99.98.97.tar.gz
|
||||||
|
touch curl-99.98.97/docs/{cmdline-opts,libcurl}/Makefile.inc
|
||||||
|
mkdir build
|
||||||
|
pushd build
|
||||||
|
../curl-99.98.97/configure --without-ssl --without-libpsl
|
||||||
|
make
|
||||||
|
make test-ci
|
||||||
|
popd
|
||||||
|
rm -rf build
|
||||||
|
rm -rf curl-99.98.97
|
||||||
|
name: 'verify out-of-tree configure build including docs'
|
||||||
|
|
||||||
|
verify-out-of-tree-autotools-debug:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
needs: maketgz-and-verify-in-tree
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'release-tgz'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "::stop-commands::$(uuidgen)"
|
||||||
|
tar xvf curl-99.98.97.tar.gz
|
||||||
|
pushd curl-99.98.97
|
||||||
|
mkdir build
|
||||||
|
pushd build
|
||||||
|
../configure --without-ssl --enable-debug "--prefix=${PWD}/pkg" --without-libpsl
|
||||||
|
make -j3
|
||||||
|
make -j3 test-ci
|
||||||
|
make -j3 install
|
||||||
|
name: 'verify out-of-tree autotools debug build'
|
||||||
|
|
||||||
|
verify-out-of-tree-cmake:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
timeout-minutes: 30
|
||||||
|
needs: maketgz-and-verify-in-tree
|
||||||
|
steps:
|
||||||
|
- uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: 'release-tgz'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
echo "::stop-commands::$(uuidgen)"
|
||||||
|
tar xvf curl-99.98.97.tar.gz
|
||||||
|
pushd curl-99.98.97
|
||||||
|
mkdir build
|
||||||
|
pushd build
|
||||||
|
cmake ..
|
||||||
|
make
|
||||||
|
name: 'verify out-of-tree cmake build'
|
50
deps/curl/.github/workflows/fuzz.yml
vendored
Normal file
50
deps/curl/.github/workflows/fuzz.yml
vendored
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Fuzzer
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'tests/data/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'tests/data/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
Fuzzing:
|
||||||
|
uses: curl/curl-fuzzer/.github/workflows/ci.yml@master
|
67
deps/curl/.github/workflows/hacktoberfest-accepted.yml
vendored
Normal file
67
deps/curl/.github/workflows/hacktoberfest-accepted.yml
vendored
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Hacktoberfest
|
||||||
|
|
||||||
|
on:
|
||||||
|
# this must not ever run on any other branch than master
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# this should not run in parallel, so just run one at a time
|
||||||
|
group: ${{ github.workflow }}
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# add hacktoberfest-accepted label to PRs opened starting from September 30th
|
||||||
|
# till November 1st which are closed via commit reference from master branch.
|
||||||
|
merged:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
# requires issues AND pull-requests write permissions to edit labels on PRs!
|
||||||
|
issues: write
|
||||||
|
pull-requests: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 100
|
||||||
|
|
||||||
|
- name: Check whether repo participates in Hacktoberfest
|
||||||
|
run: |
|
||||||
|
gh config set prompt disabled && echo "label=$(
|
||||||
|
gh repo view --json repositoryTopics --jq '.repositoryTopics[].name' | grep '^hacktoberfest$')" >> $GITHUB_OUTPUT
|
||||||
|
id: check
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Search relevant commit message lines starting with Closes/Merges
|
||||||
|
run: |
|
||||||
|
git log --format=email ${{ github.event.before }}..${{ github.event.after }} | \
|
||||||
|
grep -Ei "^Close[sd]? " | sort | uniq | tee log
|
||||||
|
if: steps.check.outputs.label == 'hacktoberfest'
|
||||||
|
|
||||||
|
- name: Search for Number-based PR references
|
||||||
|
run: |
|
||||||
|
grep -Eo "#([0-9]+)" log | cut -d# -f2 | sort | uniq | xargs -t -n1 -I{} \
|
||||||
|
gh pr view {} --json number,createdAt \
|
||||||
|
--jq '{number, opened: .createdAt} | [.number, .opened] | join(":")' | tee /dev/stderr | \
|
||||||
|
grep -Eo '^([0-9]+):[0-9]{4}-(09-30T|10-|11-01T)' | cut -d: -f1 | sort | uniq | xargs -t -n1 -I {} \
|
||||||
|
gh pr edit {} --add-label 'hacktoberfest-accepted'
|
||||||
|
if: steps.check.outputs.label == 'hacktoberfest'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Search for URL-based PR references
|
||||||
|
run: |
|
||||||
|
grep -Eo "github.com/(.+)/(.+)/pull/([0-9]+)" log | sort | uniq | xargs -t -n1 -I{} \
|
||||||
|
gh pr view "https://{}" --json number,createdAt \
|
||||||
|
--jq '{number, opened: .createdAt} | [.number, .opened] | join(":")' | tee /dev/stderr | \
|
||||||
|
grep -Eo '^([0-9]+):[0-9]{4}-(09-30T|10-|11-01T)' | cut -d: -f1 | sort | uniq | xargs -t -n1 -I {} \
|
||||||
|
gh pr edit {} --add-label 'hacktoberfest-accepted'
|
||||||
|
if: steps.check.outputs.label == 'hacktoberfest'
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
26
deps/curl/.github/workflows/label.yml
vendored
Normal file
26
deps/curl/.github/workflows/label.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
# Copyright (C) Daniel Fandrich, <dan@coneharvesters.com>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
# This workflow will triage pull requests and apply a label based on the
|
||||||
|
# paths that are modified in the pull request.
|
||||||
|
#
|
||||||
|
# To use this workflow, you will need to set up a .github/labeler.yml
|
||||||
|
# file with configuration. For more information, see:
|
||||||
|
# https://github.com/actions/labeler
|
||||||
|
|
||||||
|
name: Labeler
|
||||||
|
on: [pull_request_target]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
label:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/labeler@v5
|
||||||
|
with:
|
||||||
|
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
41
deps/curl/.github/workflows/linkcheck.yml
vendored
Normal file
41
deps/curl/.github/workflows/linkcheck.yml
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Markdown links
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/linkcheck.yml'
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/linkcheck.yml'
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Docs: https://github.com/marketplace/actions/markdown-link-check
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
name: checkout
|
||||||
|
|
||||||
|
- name: trim the cmdline docs markdown files
|
||||||
|
run: find docs/cmdline-opts -name "*.md" ! -name "_*" ! -name MANPAGE.md | xargs -n1 ./.github/scripts/cleancmd.pl
|
||||||
|
|
||||||
|
- uses: gaurav-nelson/github-action-markdown-link-check@v1
|
||||||
|
with:
|
||||||
|
use-quiet-mode: 'yes'
|
434
deps/curl/.github/workflows/linux.yml
vendored
Normal file
434
deps/curl/.github/workflows/linux.yml
vendored
Normal file
@ -0,0 +1,434 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Linux
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
bearssl-version: 0.6
|
||||||
|
libressl-version: v3.7.3
|
||||||
|
mbedtls-version: v3.5.0
|
||||||
|
mod_h2-version: v2.0.26
|
||||||
|
msh3-version: v0.6.0
|
||||||
|
openssl3-version: openssl-3.1.3
|
||||||
|
quictls-version: 3.1.4+quic
|
||||||
|
rustls-version: v0.10.0
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autotools:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
container: ${{ matrix.build.container }}
|
||||||
|
timeout-minutes: 90
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: bearssl
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: bearssl pytest
|
||||||
|
configure: LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: bearssl-clang
|
||||||
|
install_packages: zlib1g-dev clang
|
||||||
|
install_steps: bearssl
|
||||||
|
configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/bearssl/lib" --with-bearssl=$HOME/bearssl --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: libressl
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: libressl pytest
|
||||||
|
configure: LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: libressl-clang
|
||||||
|
install_packages: zlib1g-dev clang
|
||||||
|
install_steps: libressl
|
||||||
|
configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/libressl/lib" --with-openssl=$HOME/libressl --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: mbedtls
|
||||||
|
install_packages: libnghttp2-dev valgrind
|
||||||
|
install_steps: mbedtls pytest
|
||||||
|
configure: LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: mbedtls-clang
|
||||||
|
install_packages: libnghttp2-dev clang
|
||||||
|
install_steps: mbedtls
|
||||||
|
configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/mbedtls/lib" --with-mbedtls=$HOME/mbedtls --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: msh3
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: quictls msh3
|
||||||
|
configure: LDFLAGS="-Wl,-rpath,$HOME/msh3/lib -Wl,-rpath,$HOME/quictls/lib" --with-msh3=$HOME/msh3 --with-openssl=$HOME/quictls --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: openssl3
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: gcc-11 openssl3 pytest
|
||||||
|
configure: CFLAGS=-std=gnu89 LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: openssl3-O3
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: gcc-11 openssl3
|
||||||
|
configure: CPPFLAGS=-DCURL_WARN_SIGN_CONVERSION CFLAGS=-O3 LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: openssl3-clang
|
||||||
|
install_packages: zlib1g-dev clang
|
||||||
|
install_steps: openssl3
|
||||||
|
configure: CC=clang LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib" --with-openssl=$HOME/openssl3 --enable-debug --enable-websockets
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: address-sanitizer
|
||||||
|
install_packages: zlib1g-dev libssh2-1-dev clang libssl-dev libubsan1 libasan8 libtsan2
|
||||||
|
install_steps: pytest
|
||||||
|
configure: >
|
||||||
|
CC=clang
|
||||||
|
CFLAGS="-fsanitize=address,undefined,signed-integer-overflow -fno-sanitize-recover=undefined,integer -Wformat -Werror=format-security -Werror=array-bounds -g"
|
||||||
|
LDFLAGS="-fsanitize=address,undefined -fno-sanitize-recover=undefined,integer"
|
||||||
|
LIBS="-ldl -lubsan"
|
||||||
|
--with-openssl --enable-debug --enable-websockets
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: memory-sanitizer
|
||||||
|
install_packages: clang
|
||||||
|
install_steps:
|
||||||
|
configure: >
|
||||||
|
CC=clang
|
||||||
|
CFLAGS="-fsanitize=memory -Wformat -Werror=format-security -Werror=array-bounds -g"
|
||||||
|
LDFLAGS="-fsanitize=memory"
|
||||||
|
LIBS="-ldl"
|
||||||
|
--without-ssl --without-zlib --without-brotli --without-zstd --without-libpsl --without-nghttp2 --enable-debug --enable-websocketsx
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: event-based
|
||||||
|
install_packages: libssh-dev valgrind
|
||||||
|
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-libssh --with-openssl
|
||||||
|
tflags: -n -e '!TLS-SRP'
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: hyper
|
||||||
|
install_steps: rust hyper valgrind
|
||||||
|
configure: LDFLAGS="-Wl,-rpath,$HOME/hyper/target/debug" --with-openssl --with-hyper=$HOME/hyper --enable-debug --enable-websockets
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: rustls
|
||||||
|
install_steps: rust rustls pytest valgrind libpsl-dev
|
||||||
|
configure: --with-rustls=$HOME/rustls --enable-debug
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: Intel compiler - without SSL
|
||||||
|
install_packages: zlib1g-dev valgrind
|
||||||
|
install_steps: intel
|
||||||
|
configure: CC=icc --enable-debug --without-ssl
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: Intel compiler - OpenSSL
|
||||||
|
install_packages: zlib1g-dev libssl-dev valgrind
|
||||||
|
install_steps: intel
|
||||||
|
configure: CC=icc --enable-debug --with-openssl
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
- name: Slackware-openssl-with-gssapi-gcc
|
||||||
|
# These are essentially the same flags used to build the curl Slackware package
|
||||||
|
# https://ftpmirror.infania.net/slackware/slackware64-current/source/n/curl/curl.SlackBuild
|
||||||
|
configure: --with-openssl --with-libssh2 --with-gssapi --enable-ares --enable-static=no --without-ca-bundle --with-ca-path=/etc/ssl/certs
|
||||||
|
# Docker Hub image that `container-job` executes in
|
||||||
|
container: 'andy5995/slackware-build-essential:15.0'
|
||||||
|
|
||||||
|
- name: Alpine MUSL
|
||||||
|
configure: --enable-debug --enable-websockets --with-ssl --with-libssh2 --with-libidn2 --with-gssapi --enable-ldap --with-libpsl
|
||||||
|
container: 'alpine:3.18'
|
||||||
|
singleuse: --unit
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- if: matrix.build.container == null
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libtool autoconf automake pkg-config stunnel4 libpsl-dev libbrotli-dev libzstd-dev ${{ matrix.build.install_packages }}
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
name: 'install prereqs and impacket'
|
||||||
|
|
||||||
|
- if: startsWith(matrix.build.container, 'alpine')
|
||||||
|
run: |
|
||||||
|
apk add --no-cache build-base autoconf automake libtool perl openssl-dev libssh2-dev zlib-dev brotli-dev zstd-dev libidn2-dev openldap-dev heimdal-dev libpsl-dev py3-impacket py3-asn1 py3-six py3-pycryptodomex perl-time-hires openssh stunnel sudo git
|
||||||
|
name: 'install dependencies'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'gcc-11')
|
||||||
|
run: |
|
||||||
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install gcc-11
|
||||||
|
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100
|
||||||
|
sudo update-alternatives --set gcc /usr/bin/gcc-11
|
||||||
|
gcc --version
|
||||||
|
name: 'install gcc-11'
|
||||||
|
|
||||||
|
- name: cache bearssl
|
||||||
|
if: contains(matrix.build.install_steps, 'bearssl')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-bearssl
|
||||||
|
env:
|
||||||
|
cache-name: cache-bearssl
|
||||||
|
with:
|
||||||
|
path: /home/runner/bearssl
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-bearssl-${{ env.bearssl-version }}
|
||||||
|
|
||||||
|
- name: 'build bearssl'
|
||||||
|
if: contains(matrix.build.install_steps, 'bearssl') && steps.cache-bearssl.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
curl -LOsSf --retry 6 --retry-connrefused --max-time 999 https://bearssl.org/bearssl-${{ env.bearssl-version }}.tar.gz
|
||||||
|
tar -xzf bearssl-${{ env.bearssl-version }}.tar.gz
|
||||||
|
cd bearssl-${{ env.bearssl-version }}
|
||||||
|
make
|
||||||
|
mkdir -p $HOME/bearssl/lib $HOME/bearssl/include
|
||||||
|
cp inc/*.h $HOME/bearssl/include
|
||||||
|
cp build/libbearssl.* $HOME/bearssl/lib
|
||||||
|
|
||||||
|
- name: cache libressl
|
||||||
|
if: contains(matrix.build.install_steps, 'libressl')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-libressl
|
||||||
|
env:
|
||||||
|
cache-name: cache-libressl
|
||||||
|
with:
|
||||||
|
path: /home/runner/libressl
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-libressl-${{ env.libressl-version }}
|
||||||
|
|
||||||
|
- name: 'build libressl'
|
||||||
|
if: contains(matrix.build.install_steps, 'libressl') && steps.cache-libressl.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.libressl-version }} https://github.com/libressl-portable/portable.git libressl-git
|
||||||
|
cd libressl-git
|
||||||
|
./autogen.sh
|
||||||
|
./configure --prefix=$HOME/libressl
|
||||||
|
make install
|
||||||
|
|
||||||
|
- name: cache mbedtls
|
||||||
|
if: contains(matrix.build.install_steps, 'mbedtls')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-mbedtls
|
||||||
|
env:
|
||||||
|
cache-name: cache-mbedtls
|
||||||
|
with:
|
||||||
|
path: /home/runner/mbedtls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-mbedtls-${{ env.mbedtls-version }}
|
||||||
|
|
||||||
|
- name: 'build mbedtls'
|
||||||
|
if: contains(matrix.build.install_steps, 'mbedtls') && steps.cache-mbedtls.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.mbedtls-version }} https://github.com/ARMmbed/mbedtls
|
||||||
|
cd mbedtls
|
||||||
|
make DESTDIR=$HOME/mbedtls install
|
||||||
|
|
||||||
|
- name: cache openssl3
|
||||||
|
if: contains(matrix.build.install_steps, 'openssl3')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-openssl3
|
||||||
|
env:
|
||||||
|
cache-name: cache-openssl3
|
||||||
|
with:
|
||||||
|
path: /home/runner/openssl3
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl3-version }}
|
||||||
|
|
||||||
|
- name: 'install openssl3'
|
||||||
|
if: contains(matrix.build.install_steps, 'openssl3') && steps.cache-openssl3.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.openssl3-version }} https://github.com/openssl/openssl
|
||||||
|
cd openssl
|
||||||
|
./config --prefix=$HOME/openssl3 --libdir=$HOME/openssl3/lib
|
||||||
|
make -j1 install_sw
|
||||||
|
|
||||||
|
- name: cache quictls
|
||||||
|
if: contains(matrix.build.install_steps, 'quictls')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-quictls
|
||||||
|
env:
|
||||||
|
cache-name: cache-quictls
|
||||||
|
with:
|
||||||
|
path: /home/runner/quictls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-quictls-${{ env.quictls-version }}
|
||||||
|
|
||||||
|
- name: 'build quictls'
|
||||||
|
if: contains(matrix.build.install_steps, 'quictls') && steps.cache-quictls.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }} https://github.com/quictls/openssl
|
||||||
|
cd openssl
|
||||||
|
./config --prefix=$HOME/quictls --libdir=$HOME/quictls/lib
|
||||||
|
make -j1 install_sw
|
||||||
|
|
||||||
|
- name: cache msh3
|
||||||
|
if: contains(matrix.build.install_steps, 'msh3')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-msh3
|
||||||
|
env:
|
||||||
|
cache-name: cache-msh3
|
||||||
|
with:
|
||||||
|
path: /home/runner/msh3
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-msh3-${{ env.msh3-version }}
|
||||||
|
|
||||||
|
- name: 'build msh3'
|
||||||
|
if: contains(matrix.build.install_steps, 'msh3') && steps.cache-msh3.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet -b ${{ env.msh3-version }} --depth=1 --recursive https://github.com/nibanks/msh3
|
||||||
|
cd msh3 && mkdir build && cd build
|
||||||
|
cmake -G 'Unix Makefiles' -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/msh3 ..
|
||||||
|
cmake --build .
|
||||||
|
cmake --install .
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'rust')
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
curl -sSf --compressed https://sh.rustup.rs/ | sh -s -- -y
|
||||||
|
source $HOME/.cargo/env
|
||||||
|
rustup toolchain install nightly
|
||||||
|
name: 'install rust'
|
||||||
|
|
||||||
|
- name: cache rustls
|
||||||
|
if: contains(matrix.build.install_steps, 'rustls')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-rustls
|
||||||
|
env:
|
||||||
|
cache-name: cache-rustls
|
||||||
|
with:
|
||||||
|
path: /home/runner/rustls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-rustls-${{ env.rustls-version }}
|
||||||
|
|
||||||
|
- name: 'build rustls'
|
||||||
|
if: contains(matrix.build.install_steps, 'rustls') && steps.cache-rustls.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.rustls-version }} --recursive https://github.com/rustls/rustls-ffi.git
|
||||||
|
cd rustls-ffi
|
||||||
|
make DESTDIR=$HOME/rustls install
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'hyper')
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 https://github.com/hyperium/hyper.git
|
||||||
|
cd $HOME/hyper
|
||||||
|
RUSTFLAGS="--cfg hyper_unstable_ffi" cargo +nightly rustc --features client,http1,http2,ffi -Z unstable-options --crate-type cdylib
|
||||||
|
echo "LD_LIBRARY_PATH=$HOME/hyper/target/debug:/usr/local/lib" >> $GITHUB_ENV
|
||||||
|
name: 'install hyper'
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'intel')
|
||||||
|
run: |
|
||||||
|
cd /tmp
|
||||||
|
curl -sSf --compressed https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | sudo apt-key add -
|
||||||
|
sudo add-apt-repository "deb https://apt.repos.intel.com/oneapi all main"
|
||||||
|
sudo apt install --no-install-recommends intel-oneapi-compiler-dpcpp-cpp-and-cpp-classic
|
||||||
|
source /opt/intel/oneapi/setvars.sh
|
||||||
|
printenv >> $GITHUB_ENV
|
||||||
|
name: 'install Intel compilers'
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'pytest')
|
||||||
|
run: |
|
||||||
|
sudo apt-get install apache2 apache2-dev libnghttp2-dev
|
||||||
|
sudo python3 -m pip install -r tests/http/requirements.txt
|
||||||
|
name: 'install pytest and apach2-dev'
|
||||||
|
|
||||||
|
- name: cache mod_h2
|
||||||
|
if: contains(matrix.build.install_steps, 'pytest')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-mod_h2
|
||||||
|
env:
|
||||||
|
cache-name: cache-mod_h2
|
||||||
|
with:
|
||||||
|
path: /home/runner/mod_h2
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
|
||||||
|
|
||||||
|
- name: 'build mod_h2'
|
||||||
|
if: contains(matrix.build.install_steps, 'pytest') && steps.cache-mod_h2.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.mod_h2-version }} https://github.com/icing/mod_h2
|
||||||
|
cd mod_h2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
|
||||||
|
- name: 'install mod_h2'
|
||||||
|
if: contains(matrix.build.install_steps, 'pytest')
|
||||||
|
run: |
|
||||||
|
cd $HOME/mod_h2
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
git config --global --add safe.directory "*"
|
||||||
|
./scripts/singleuse.pl ${{ matrix.build.singleuse }} lib/.libs/libcurl.a
|
||||||
|
name: single-use function check
|
||||||
|
|
||||||
|
- run: ./src/curl -V
|
||||||
|
name: 'check curl -V output'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
|
||||||
|
- if: contains(matrix.build.install_steps, 'pytest')
|
||||||
|
# run for `tests` directory, so pytest does not pick up any other
|
||||||
|
# packages we might have built here
|
||||||
|
run:
|
||||||
|
pytest -v tests
|
||||||
|
name: 'run pytest'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
CURL_CI: github
|
93
deps/curl/.github/workflows/linux32.yml
vendored
Normal file
93
deps/curl/.github/workflows/linux32.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
# Copyright (C) Dan Fandrich
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: Linux 32-bit
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
linux-i686:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'ubuntu-22.04'
|
||||||
|
timeout-minutes: 90
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: Linux i686
|
||||||
|
install_packages: gcc-11-i686-linux-gnu libssl-dev:i386 zlib1g-dev:i386 libpsl-dev:i386 libbrotli-dev:i386 libzstd-dev:i386
|
||||||
|
configure: --enable-debug --enable-websockets --with-openssl --host=i686-linux-gnu CC=i686-linux-gnu-gcc-11 PKG_CONFIG_PATH=/usr/lib/i386-linux-gnu/pkgconfig CPPFLAGS=-I/usr/include/i386-linux-gnu LDFLAGS=-L/usr/lib/i386-linux-gnu
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo dpkg --add-architecture i386
|
||||||
|
sudo apt-get update -y
|
||||||
|
sudo apt-get install -y --no-install-suggests --no-install-recommends libtool autoconf automake pkg-config stunnel4 ${{ matrix.build.install_packages }}
|
||||||
|
sudo python3 -m pip install impacket
|
||||||
|
name: 'install prereqs'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: ./src/curl -V
|
||||||
|
name: 'check curl -V output'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
243
deps/curl/.github/workflows/macos.yml
vendored
Normal file
243
deps/curl/.github/workflows/macos.yml
vendored
Normal file
@ -0,0 +1,243 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: macOS
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
DEVELOPER_DIR: /Applications/Xcode_14.0.1.app/Contents/Developer
|
||||||
|
MAKEFLAGS: -j 5
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autotools:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'macos-latest'
|
||||||
|
timeout-minutes: 90
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: normal
|
||||||
|
install: nghttp2
|
||||||
|
configure: --without-ssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: debug
|
||||||
|
install: nghttp2
|
||||||
|
configure: --enable-debug --without-ssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: libssh2
|
||||||
|
install: nghttp2 libssh2
|
||||||
|
configure: --enable-debug --with-libssh2 --without-ssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: libssh-c-ares
|
||||||
|
install: openssl nghttp2 libssh
|
||||||
|
configure: --enable-debug --with-libssh --with-openssl=/usr/local/opt/openssl --enable-ares --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: libssh
|
||||||
|
install: openssl nghttp2 libssh
|
||||||
|
configure: --enable-debug --with-libssh --with-openssl=/usr/local/opt/openssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: c-ares
|
||||||
|
install: nghttp2
|
||||||
|
configure: --enable-debug --enable-ares --without-ssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: HTTP only
|
||||||
|
install: nghttp2
|
||||||
|
configure: |
|
||||||
|
--enable-debug \
|
||||||
|
--enable-maintainer-mode \
|
||||||
|
--disable-alt-svc \
|
||||||
|
--disable-dict \
|
||||||
|
--disable-file \
|
||||||
|
--disable-ftp \
|
||||||
|
--disable-gopher \
|
||||||
|
--disable-imap \
|
||||||
|
--disable-ldap \
|
||||||
|
--disable-pop3 \
|
||||||
|
--disable-rtmp \
|
||||||
|
--disable-rtsp \
|
||||||
|
--disable-scp \
|
||||||
|
--disable-sftp \
|
||||||
|
--disable-shared \
|
||||||
|
--disable-smb \
|
||||||
|
--disable-smtp \
|
||||||
|
--disable-telnet \
|
||||||
|
--disable-tftp \
|
||||||
|
--disable-unix-sockets \
|
||||||
|
--without-brotli \
|
||||||
|
--without-gssapi \
|
||||||
|
--without-libidn2 \
|
||||||
|
--without-libpsl \
|
||||||
|
--without-librtmp \
|
||||||
|
--without-libssh2 \
|
||||||
|
--without-nghttp2 \
|
||||||
|
--without-ntlm-auth \
|
||||||
|
--without-ssl \
|
||||||
|
--without-zlib \
|
||||||
|
--without-zstd
|
||||||
|
|
||||||
|
macosx-version-min: 10.15
|
||||||
|
- name: SecureTransport http2
|
||||||
|
install: nghttp2
|
||||||
|
configure: --enable-debug --with-secure-transport --enable-websockets
|
||||||
|
macosx-version-min: 10.8
|
||||||
|
- name: gcc SecureTransport
|
||||||
|
configure: CC=gcc-12 --enable-debug --with-secure-transport --enable-websockets --without-libpsl
|
||||||
|
macosx-version-min: 10.8
|
||||||
|
- name: OpenSSL http2
|
||||||
|
install: nghttp2 openssl
|
||||||
|
configure: --enable-debug --with-openssl=/usr/local/opt/openssl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: LibreSSL http2
|
||||||
|
install: nghttp2 libressl
|
||||||
|
configure: --enable-debug --with-openssl=/usr/local/opt/libressl --enable-websockets
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: torture
|
||||||
|
install: nghttp2 openssl
|
||||||
|
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=/usr/local/opt/openssl --enable-websockets
|
||||||
|
tflags: -n -t --shallow=25 !FTP
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: torture-ftp
|
||||||
|
install: nghttp2 openssl
|
||||||
|
configure: --enable-debug --disable-shared --disable-threaded-resolver --with-openssl=/usr/local/opt/openssl --enable-websockets
|
||||||
|
tflags: -n -t --shallow=20 FTP
|
||||||
|
macosx-version-min: 10.9
|
||||||
|
- name: macOS 10.15
|
||||||
|
install: nghttp2 libssh2 openssl
|
||||||
|
configure: --enable-debug --disable-ldap --with-openssl=/usr/local/opt/openssl --enable-websockets
|
||||||
|
macosx-version-min: 10.15
|
||||||
|
steps:
|
||||||
|
- run: echo libtool autoconf automake pkg-config libpsl ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
|
||||||
|
name: 'brew bundle'
|
||||||
|
|
||||||
|
# Run this command with retries because of spurious failures seen
|
||||||
|
# while running the tests, for example
|
||||||
|
# https://github.com/curl/curl/runs/4095721123?check_suite_focus=true
|
||||||
|
- run: "while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done"
|
||||||
|
name: 'brew install'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
case "${{ matrix.build.install }}" in
|
||||||
|
*openssl*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if test -d /usr/local/include/openssl; then
|
||||||
|
brew unlink openssl
|
||||||
|
fi;;
|
||||||
|
esac
|
||||||
|
name: 'brew unlink openssl'
|
||||||
|
|
||||||
|
- run: python3 -m pip install impacket
|
||||||
|
name: 'pip3 install'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure --enable-warnings --enable-werror ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
env:
|
||||||
|
CFLAGS: "-mmacosx-version-min=${{ matrix.build.macosx-version-min }}"
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }} ~1452"
|
||||||
|
|
||||||
|
cmake:
|
||||||
|
name: cmake ${{ matrix.compiler.CC }} ${{ matrix.build.name }}
|
||||||
|
runs-on: 'macos-latest'
|
||||||
|
env: ${{ matrix.compiler }}
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
compiler:
|
||||||
|
- CC: clang
|
||||||
|
CXX: clang++
|
||||||
|
CFLAGS: "-mmacosx-version-min=10.15 -Wno-deprecated-declarations"
|
||||||
|
- CC: gcc-12
|
||||||
|
CXX: g++-12
|
||||||
|
CFLAGS: "-mmacosx-version-min=10.15 -Wno-error=undef -Wno-error=conversion"
|
||||||
|
build:
|
||||||
|
- name: OpenSSL
|
||||||
|
install: nghttp2 openssl
|
||||||
|
generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9
|
||||||
|
- name: LibreSSL
|
||||||
|
install: nghttp2 libressl
|
||||||
|
generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/libressl -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON -DCMAKE_UNITY_BUILD=ON
|
||||||
|
- name: libssh2
|
||||||
|
install: nghttp2 openssl libssh2
|
||||||
|
generate: -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl -DCURL_USE_LIBSSH2=ON -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON
|
||||||
|
- name: GnuTLS
|
||||||
|
install: gnutls
|
||||||
|
generate: -DCURL_USE_GNUTLS=ON -DCURL_USE_OPENSSL=OFF -DCURL_DISABLE_LDAP=ON -DCURL_DISABLE_LDAPS=ON -DCMAKE_SHARED_LINKER_FLAGS=-L/usr/local/lib -DCMAKE_EXE_LINKER_FLAGS=-L/usr/local/lib
|
||||||
|
steps:
|
||||||
|
- run: echo libtool autoconf automake pkg-config ${{ matrix.build.install }} | xargs -Ix -n1 echo brew '"x"' > /tmp/Brewfile
|
||||||
|
name: 'brew bundle'
|
||||||
|
|
||||||
|
- run: "while [[ $? == 0 ]]; do for i in 1 2 3; do brew update && brew bundle install --no-lock --file /tmp/Brewfile && break 2 || { echo Error: wait to try again; sleep 10; } done; false Too many retries; done"
|
||||||
|
name: 'brew install'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
case "${{ matrix.build.install }}" in
|
||||||
|
*openssl*)
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if test -d /usr/local/include/openssl; then
|
||||||
|
brew unlink openssl
|
||||||
|
fi;;
|
||||||
|
esac
|
||||||
|
name: 'brew unlink openssl'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: cmake -S. -Bbuild -DCURL_WERROR=ON -DPICKY_COMPILER=ON ${{ matrix.build.generate }}
|
||||||
|
name: 'cmake generate'
|
||||||
|
|
||||||
|
- run: cmake --build build
|
||||||
|
name: 'cmake build'
|
35
deps/curl/.github/workflows/man-examples.yml
vendored
Normal file
35
deps/curl/.github/workflows/man-examples.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: manpage examples
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths:
|
||||||
|
- 'docs/libcurl/curl_*.3'
|
||||||
|
- 'docs/libcurl/opts/*.3'
|
||||||
|
- '.github/scripts/verify-examples.pl'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- 'docs/libcurl/curl_*.3'
|
||||||
|
- 'docs/libcurl/opts/*.3'
|
||||||
|
- '.github/scripts/verify-examples.pl'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
verify:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: render nroff versions
|
||||||
|
run: autoreconf -fi && ./configure --without-ssl --without-libpsl && make -C docs
|
||||||
|
|
||||||
|
- name: verify examples
|
||||||
|
run: ./.github/scripts/verify-examples.pl docs/libcurl/curl*.3 docs/libcurl/opts/*.3
|
270
deps/curl/.github/workflows/ngtcp2-linux.yml
vendored
Normal file
270
deps/curl/.github/workflows/ngtcp2-linux.yml
vendored
Normal file
@ -0,0 +1,270 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: ngtcp2-linux
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Hardcoded workflow filename as workflow name above is just Linux again
|
||||||
|
group: ngtcp2-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
quictls-version: 3.1.4+quic
|
||||||
|
gnutls-version: 3.8.3
|
||||||
|
wolfssl-version: master
|
||||||
|
nghttp3-version: v1.1.0
|
||||||
|
ngtcp2-version: v1.2.0
|
||||||
|
nghttp2-version: v1.59.0
|
||||||
|
mod_h2-version: v2.0.26
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autotools:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
timeout-minutes: 60
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: quictls
|
||||||
|
configure: >-
|
||||||
|
PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" LDFLAGS="-Wl,-rpath,$HOME/nghttpx/lib"
|
||||||
|
--with-ngtcp2=$HOME/nghttpx --enable-warnings --enable-werror --enable-debug --disable-ntlm
|
||||||
|
--with-test-nghttpx="$HOME/nghttpx/bin/nghttpx"
|
||||||
|
--with-openssl=$HOME/nghttpx
|
||||||
|
- name: gnutls
|
||||||
|
configure: >-
|
||||||
|
PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" LDFLAGS="-Wl,-rpath,$HOME/nghttpx/lib"
|
||||||
|
--with-ngtcp2=$HOME/nghttpx --enable-warnings --enable-werror --enable-debug
|
||||||
|
--with-test-nghttpx="$HOME/nghttpx/bin/nghttpx"
|
||||||
|
--with-gnutls=$HOME/nghttpx
|
||||||
|
- name: wolfssl
|
||||||
|
configure: >-
|
||||||
|
PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" LDFLAGS="-Wl,-rpath,$HOME/nghttpx/lib"
|
||||||
|
--with-ngtcp2=$HOME/nghttpx --enable-warnings --enable-werror --enable-debug
|
||||||
|
--with-test-nghttpx="$HOME/nghttpx/bin/nghttpx"
|
||||||
|
--with-wolfssl=$HOME/nghttpx
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libtool autoconf automake pkg-config stunnel4 \
|
||||||
|
libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev libev-dev libc-ares-dev \
|
||||||
|
nettle-dev libp11-kit-dev libtspi-dev libunistring-dev guile-2.2-dev libtasn1-bin \
|
||||||
|
libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \
|
||||||
|
texinfo texlive texlive-extra-utils autopoint libev-dev \
|
||||||
|
apache2 apache2-dev libnghttp2-dev
|
||||||
|
name: 'install prereqs and impacket, pytest, crypto, apache2'
|
||||||
|
|
||||||
|
- name: cache quictls
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-quictls-no-deprecated
|
||||||
|
env:
|
||||||
|
cache-name: cache-quictls-no-deprecated
|
||||||
|
with:
|
||||||
|
path: /home/runner/quictls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.quictls-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-quictls-no-deprecated.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }} https://github.com/quictls/openssl quictls
|
||||||
|
cd quictls
|
||||||
|
./config no-deprecated --prefix=$HOME/nghttpx --libdir=$HOME/nghttpx/lib
|
||||||
|
make
|
||||||
|
name: 'build quictls'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/quictls
|
||||||
|
make -j1 install_sw
|
||||||
|
name: 'install quictls'
|
||||||
|
|
||||||
|
|
||||||
|
- name: cache gnutls
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-gnutls
|
||||||
|
env:
|
||||||
|
cache-name: cache-gnutls
|
||||||
|
with:
|
||||||
|
path: /home/runner/gnutls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.gnutls-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-gnutls.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.gnutls-version }} https://github.com/gnutls/gnutls.git
|
||||||
|
cd gnutls
|
||||||
|
./bootstrap
|
||||||
|
./configure --prefix=$HOME/nghttpx \
|
||||||
|
PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" LDFLAGS="-Wl,-rpath,$HOME/nghttpx/lib -L$HOME/nghttpx/lib" \
|
||||||
|
--with-included-libtasn1 --with-included-unistring \
|
||||||
|
--disable-guile --disable-doc --disable-tests --disable-tools
|
||||||
|
make
|
||||||
|
name: 'build gnutls'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/gnutls
|
||||||
|
make install
|
||||||
|
name: 'install gnutls'
|
||||||
|
|
||||||
|
|
||||||
|
- name: cache wolfssl
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-wolfssl
|
||||||
|
env:
|
||||||
|
cache-name: cache-wolfssl
|
||||||
|
with:
|
||||||
|
path: /home/runner/wolfssl
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.wolfssl-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-wolfssl.outputs.cache-hit != 'true' || ${{ env.wolfssl-version }} == 'master'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
rm -rf wolfssl
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.wolfssl-version }} https://github.com/wolfSSL/wolfssl.git
|
||||||
|
cd wolfssl
|
||||||
|
./autogen.sh
|
||||||
|
./configure --enable-all --enable-quic --prefix=$HOME/nghttpx
|
||||||
|
make
|
||||||
|
name: 'build wolfssl'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/wolfssl
|
||||||
|
make install
|
||||||
|
name: 'install wolfssl'
|
||||||
|
|
||||||
|
|
||||||
|
- name: cache nghttp3
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-nghttp3
|
||||||
|
env:
|
||||||
|
cache-name: cache-nghttp3
|
||||||
|
with:
|
||||||
|
path: /home/runner/nghttp3
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.nghttp3-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-nghttp3.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp3-version }} https://github.com/ngtcp2/nghttp3
|
||||||
|
cd nghttp3
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only
|
||||||
|
make
|
||||||
|
name: 'build nghttp3'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/nghttp3
|
||||||
|
make install
|
||||||
|
name: 'install nghttp3'
|
||||||
|
|
||||||
|
# depends on all other cached libs built so far
|
||||||
|
- run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.ngtcp2-version }} https://github.com/ngtcp2/ngtcp2
|
||||||
|
cd ngtcp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only --with-openssl --with-gnutls --with-wolfssl
|
||||||
|
make install
|
||||||
|
name: 'install ngtcp2'
|
||||||
|
|
||||||
|
# depends on all other cached libs built so far
|
||||||
|
- run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp2-version }} https://github.com/nghttp2/nghttp2
|
||||||
|
cd nghttp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-http3
|
||||||
|
make install
|
||||||
|
name: 'install nghttp2'
|
||||||
|
|
||||||
|
- name: cache mod_h2
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-mod_h2
|
||||||
|
env:
|
||||||
|
cache-name: cache-mod_h2
|
||||||
|
with:
|
||||||
|
path: /home/runner/mod_h2
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-mod_h2.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.mod_h2-version }} https://github.com/icing/mod_h2
|
||||||
|
cd mod_h2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
name: 'build mod_h2'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/mod_h2
|
||||||
|
sudo make install
|
||||||
|
name: 'install mod_h2'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
sudo python3 -m pip install -r tests/requirements.txt -r tests/http/requirements.txt
|
||||||
|
name: 'install python test prereqs'
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
|
||||||
|
- run: pytest -v tests
|
||||||
|
name: 'run pytest'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
CURL_CI: github
|
233
deps/curl/.github/workflows/osslq-linux.yml
vendored
Normal file
233
deps/curl/.github/workflows/osslq-linux.yml
vendored
Normal file
@ -0,0 +1,233 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: osslq-linux
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Hardcoded workflow filename as workflow name above is just Linux again
|
||||||
|
group: osslq-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
openssl3-version: openssl-3.2.0
|
||||||
|
quictls-version: 3.1.4+quic
|
||||||
|
nghttp3-version: v1.1.0
|
||||||
|
ngtcp2-version: v1.2.0
|
||||||
|
nghttp2-version: v1.59.0
|
||||||
|
mod_h2-version: v2.0.26
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autotools:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
timeout-minutes: 60
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: openssl-quic
|
||||||
|
configure: >-
|
||||||
|
PKG_CONFIG_PATH="$HOME/openssl3/lib/pkgconfig" LDFLAGS="-Wl,-rpath,$HOME/openssl3/lib"
|
||||||
|
--enable-warnings --enable-werror --enable-debug --disable-ntlm
|
||||||
|
--with-test-nghttpx="$HOME/nghttpx/bin/nghttpx"
|
||||||
|
--with-openssl=$HOME/openssl3 --with-openssl-quic
|
||||||
|
--with-nghttp3=$HOME/nghttpx
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libtool autoconf automake pkg-config stunnel4 \
|
||||||
|
libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev libev-dev libc-ares-dev \
|
||||||
|
nettle-dev libp11-kit-dev libtspi-dev libunistring-dev guile-2.2-dev libtasn1-bin \
|
||||||
|
libtasn1-6-dev libidn2-0-dev gawk gperf libtss2-dev dns-root-data bison gtk-doc-tools \
|
||||||
|
texinfo texlive texlive-extra-utils autopoint libev-dev \
|
||||||
|
apache2 apache2-dev libnghttp2-dev
|
||||||
|
name: 'install prereqs and impacket, pytest, crypto, apache2'
|
||||||
|
|
||||||
|
- name: cache openssl3
|
||||||
|
if: contains(matrix.build.install_steps, 'openssl3')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-openssl3
|
||||||
|
env:
|
||||||
|
cache-name: cache-openssl3
|
||||||
|
with:
|
||||||
|
path: /home/runner/openssl3
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.openssl3-version }}
|
||||||
|
|
||||||
|
- name: 'install openssl3'
|
||||||
|
if: steps.cache-openssl3.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.openssl3-version }} https://github.com/openssl/openssl
|
||||||
|
cd openssl
|
||||||
|
./config --prefix=$HOME/openssl3 --libdir=$HOME/openssl3/lib
|
||||||
|
make -j1 install_sw
|
||||||
|
|
||||||
|
- name: cache quictls
|
||||||
|
if: contains(matrix.build.install_steps, 'quictls')
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-quictls
|
||||||
|
env:
|
||||||
|
cache-name: cache-quictls
|
||||||
|
with:
|
||||||
|
path: /home/runner/quictls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-quictls-${{ env.quictls-version }}
|
||||||
|
|
||||||
|
- name: cache quictls
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-quictls-no-deprecated
|
||||||
|
env:
|
||||||
|
cache-name: cache-quictls-no-deprecated
|
||||||
|
with:
|
||||||
|
path: /home/runner/quictls
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.quictls-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-quictls-no-deprecated.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b openssl-${{ env.quictls-version }} https://github.com/quictls/openssl quictls
|
||||||
|
cd quictls
|
||||||
|
./config no-deprecated --prefix=$HOME/nghttpx --libdir=$HOME/nghttpx/lib
|
||||||
|
make
|
||||||
|
name: 'build quictls'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/quictls
|
||||||
|
make -j1 install_sw
|
||||||
|
name: 'install quictls'
|
||||||
|
|
||||||
|
|
||||||
|
- name: cache nghttp3
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-nghttp3
|
||||||
|
env:
|
||||||
|
cache-name: cache-nghttp3
|
||||||
|
with:
|
||||||
|
path: /home/runner/nghttp3
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.nghttp3-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-nghttp3.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp3-version }} https://github.com/ngtcp2/nghttp3
|
||||||
|
cd nghttp3
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only
|
||||||
|
make
|
||||||
|
name: 'build nghttp3'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/nghttp3
|
||||||
|
make install
|
||||||
|
name: 'install nghttp3'
|
||||||
|
|
||||||
|
# depends on all other cached libs built so far
|
||||||
|
- run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.ngtcp2-version }} https://github.com/ngtcp2/ngtcp2
|
||||||
|
cd ngtcp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only --with-openssl
|
||||||
|
make install
|
||||||
|
name: 'install ngtcp2'
|
||||||
|
|
||||||
|
# depends on all other cached libs built so far
|
||||||
|
- run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp2-version }} https://github.com/nghttp2/nghttp2
|
||||||
|
cd nghttp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-http3
|
||||||
|
make install
|
||||||
|
name: 'install nghttp2'
|
||||||
|
|
||||||
|
- name: cache mod_h2
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-mod_h2
|
||||||
|
env:
|
||||||
|
cache-name: cache-mod_h2
|
||||||
|
with:
|
||||||
|
path: /home/runner/mod_h2
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-mod_h2.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.mod_h2-version }} https://github.com/icing/mod_h2
|
||||||
|
cd mod_h2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
name: 'build mod_h2'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/mod_h2
|
||||||
|
sudo make install
|
||||||
|
name: 'install mod_h2'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
sudo python3 -m pip install -r tests/requirements.txt -r tests/http/requirements.txt
|
||||||
|
name: 'install python test prereqs'
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
# 2500 and 25002 fail atm due to fin handling
|
||||||
|
TFLAGS: "!http/3"
|
||||||
|
|
||||||
|
- run: pytest -v tests
|
||||||
|
name: 'run pytest'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
CURL_CI: github
|
69
deps/curl/.github/workflows/proselint.yml
vendored
Normal file
69
deps/curl/.github/workflows/proselint.yml
vendored
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: proselint
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/proselint.yml'
|
||||||
|
- '**.md'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- '.github/workflows/proselint.yml'
|
||||||
|
- '**.md'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: install prereqs
|
||||||
|
run: sudo apt-get install python3-proselint
|
||||||
|
|
||||||
|
# config file help: https://github.com/amperser/proselint/
|
||||||
|
- name: create proselint config
|
||||||
|
run: |
|
||||||
|
cat <<JSON > $HOME/.proselintrc
|
||||||
|
{
|
||||||
|
"checks": {
|
||||||
|
"typography.diacritical_marks": false,
|
||||||
|
"typography.symbols": false,
|
||||||
|
"annotations.misc": false,
|
||||||
|
"security.password": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSON
|
||||||
|
|
||||||
|
- name: check prose
|
||||||
|
run: a=`git ls-files '*.md' | grep -v docs/CHECKSRC.md` && proselint $a README
|
||||||
|
|
||||||
|
# This is for CHECKSRC and files with aggressive exclamation mark needs
|
||||||
|
- name: create second proselint config
|
||||||
|
run: |
|
||||||
|
cat <<JSON > $HOME/.proselintrc
|
||||||
|
{
|
||||||
|
"checks": {
|
||||||
|
"typography.diacritical_marks": false,
|
||||||
|
"typography.symbols": false,
|
||||||
|
"typography.exclamation": false,
|
||||||
|
"annotations.misc": false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
JSON
|
||||||
|
|
||||||
|
- name: check special prose
|
||||||
|
run: a=docs/CHECKSRC.md && proselint $a
|
210
deps/curl/.github/workflows/quiche-linux.yml
vendored
Normal file
210
deps/curl/.github/workflows/quiche-linux.yml
vendored
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: quiche
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- '**/CMakeLists.txt'
|
||||||
|
- '.azure-pipelines.yml'
|
||||||
|
- '.circleci/**'
|
||||||
|
- '.cirrus.yml'
|
||||||
|
- 'appveyor.*'
|
||||||
|
- 'CMake/**'
|
||||||
|
- 'packages/**'
|
||||||
|
- 'plan9/**'
|
||||||
|
- 'projects/**'
|
||||||
|
- 'winbuild/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
# Hardcoded workflow filename as workflow name above is just Linux again
|
||||||
|
group: quiche-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
MAKEFLAGS: -j 3
|
||||||
|
openssl-version: 3.1.4+quic
|
||||||
|
nghttp3-version: v1.1.0
|
||||||
|
ngtcp2-version: v1.2.0
|
||||||
|
nghttp2-version: v1.59.0
|
||||||
|
quiche-version: 0.20.0
|
||||||
|
mod_h2-version: v2.0.26
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
autotools:
|
||||||
|
name: ${{ matrix.build.name }}
|
||||||
|
runs-on: 'ubuntu-latest'
|
||||||
|
timeout-minutes: 60
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
build:
|
||||||
|
- name: quiche
|
||||||
|
install: >-
|
||||||
|
libpsl-dev libbrotli-dev libzstd-dev zlib1g-dev libev-dev libc-ares-dev
|
||||||
|
install_steps: pytest
|
||||||
|
configure: >-
|
||||||
|
LDFLAGS="-Wl,-rpath,/home/runner/quiche/target/release"
|
||||||
|
--with-openssl=/home/runner/quiche/quiche/deps/boringssl/src
|
||||||
|
--enable-debug
|
||||||
|
--with-quiche=/home/runner/quiche/target/release
|
||||||
|
--with-test-nghttpx="$HOME/nghttpx/bin/nghttpx"
|
||||||
|
--with-ca-fallback
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install libtool autoconf automake pkg-config stunnel4 ${{ matrix.build.install }}
|
||||||
|
sudo apt-get install apache2 apache2-dev libnghttp2-dev
|
||||||
|
name: 'install prereqs and impacket, pytest, crypto'
|
||||||
|
|
||||||
|
- name: cache nghttpx
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-nghttpx
|
||||||
|
env:
|
||||||
|
cache-name: cache-nghttpx
|
||||||
|
with:
|
||||||
|
path: /home/runner/nghttpx
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-openssl-${{ env.openssl-version }}-nghttp3-${{ env.nghttp3-version }}-ngtcp2-${{ env.ngtcp2-version }}-nghttp2-${{ env.nghttp2-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-nghttpx.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b openssl-${{ env.openssl-version }} https://github.com/quictls/openssl
|
||||||
|
cd openssl
|
||||||
|
./config --prefix=$HOME/nghttpx --libdir=$HOME/nghttpx/lib
|
||||||
|
make -j1 install_sw
|
||||||
|
name: 'install quictls'
|
||||||
|
|
||||||
|
- if: steps.cache-nghttpx.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp3-version }} https://github.com/ngtcp2/nghttp3
|
||||||
|
cd nghttp3
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only
|
||||||
|
make install
|
||||||
|
name: 'install nghttp3'
|
||||||
|
|
||||||
|
- if: steps.cache-nghttpx.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.ngtcp2-version }} https://github.com/ngtcp2/ngtcp2
|
||||||
|
cd ngtcp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-lib-only --with-openssl
|
||||||
|
make install
|
||||||
|
name: 'install ngtcp2'
|
||||||
|
|
||||||
|
- if: steps.cache-nghttpx.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.nghttp2-version }} https://github.com/nghttp2/nghttp2
|
||||||
|
cd nghttp2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure --prefix=$HOME/nghttpx PKG_CONFIG_PATH="$HOME/nghttpx/lib/pkgconfig" --enable-http3
|
||||||
|
make install
|
||||||
|
name: 'install nghttp2'
|
||||||
|
|
||||||
|
- name: cache quiche
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-quiche
|
||||||
|
env:
|
||||||
|
cache-name: cache-quiche
|
||||||
|
with:
|
||||||
|
path: /home/runner/quiche
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-quiche-${{ env.quiche-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-quiche.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.quiche-version }} --recursive https://github.com/cloudflare/quiche.git
|
||||||
|
cd quiche
|
||||||
|
#### Work-around https://github.com/curl/curl/issues/7927 #######
|
||||||
|
#### See https://github.com/alexcrichton/cmake-rs/issues/131 ####
|
||||||
|
sed -i -e 's/cmake = "0.1"/cmake = "=0.1.45"/' quiche/Cargo.toml
|
||||||
|
|
||||||
|
cargo build -v --package quiche --release --features ffi,pkg-config-meta,qlog --verbose
|
||||||
|
mkdir -v quiche/deps/boringssl/src/lib
|
||||||
|
ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) quiche/deps/boringssl/src/lib/
|
||||||
|
|
||||||
|
# include dir
|
||||||
|
# /home/runner/quiche/quiche/deps/boringssl/src/include
|
||||||
|
# lib dir
|
||||||
|
# /home/runner/quiche/quiche/deps/boringssl/src/lib
|
||||||
|
name: 'build quiche and boringssl'
|
||||||
|
|
||||||
|
- name: cache mod_h2
|
||||||
|
uses: actions/cache@v4
|
||||||
|
id: cache-mod_h2
|
||||||
|
env:
|
||||||
|
cache-name: cache-mod_h2
|
||||||
|
with:
|
||||||
|
path: /home/runner/mod_h2
|
||||||
|
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.mod_h2-version }}
|
||||||
|
|
||||||
|
- if: steps.cache-mod_h2.outputs.cache-hit != 'true'
|
||||||
|
run: |
|
||||||
|
cd $HOME
|
||||||
|
git clone --quiet --depth=1 -b ${{ env.mod_h2-version }} https://github.com/icing/mod_h2
|
||||||
|
cd mod_h2
|
||||||
|
autoreconf -fi
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
name: 'build mod_h2'
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
cd $HOME/mod_h2
|
||||||
|
sudo make install
|
||||||
|
name: 'install mod_h2'
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- run: |
|
||||||
|
sudo python3 -m pip install -r tests/requirements.txt -r tests/http/requirements.txt
|
||||||
|
name: 'install python test prereqs'
|
||||||
|
|
||||||
|
- run: autoreconf -fi
|
||||||
|
name: 'autoreconf'
|
||||||
|
|
||||||
|
- run: ./configure ${{ matrix.build.configure }}
|
||||||
|
name: 'configure'
|
||||||
|
|
||||||
|
- run: make V=1
|
||||||
|
name: 'make'
|
||||||
|
|
||||||
|
- run: make V=1 examples
|
||||||
|
name: 'make examples'
|
||||||
|
|
||||||
|
- run: make V=1 -C tests
|
||||||
|
name: 'make tests'
|
||||||
|
|
||||||
|
- run: make V=1 test-ci
|
||||||
|
name: 'run tests'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
|
||||||
|
- run: pytest -v tests
|
||||||
|
name: 'run pytest'
|
||||||
|
env:
|
||||||
|
TFLAGS: "${{ matrix.build.tflags }}"
|
||||||
|
CURL_CI: github
|
29
deps/curl/.github/workflows/reuse.yml
vendored
Normal file
29
deps/curl/.github/workflows/reuse.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
|
# SPDX-FileCopyrightText: 2022 Free Software Foundation Europe e.V. <https://fsfe.org>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: curl
|
||||||
|
|
||||||
|
name: REUSE compliance
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- '*/ci'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: REUSE Compliance Check
|
||||||
|
uses: fsfe/reuse-action@v2
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user