curl/lib
Viktor Szakats 3f8fc25720
cmake: add support for "unity" builds
Aka "jumbo" or "amalgamation" builds. It means to compile all sources
per target as a single C source. This is experimental.

You can enable it by passing `-DCMAKE_UNITY_BUILD=ON` to cmake.
It requires CMake 3.16 or newer.

It makes builds (much) faster, allows for better optimizations and tends
to promote less ambiguous code.

Also add a new AppVeyor CI job and convert an existing one to use
"unity" mode (one MSVC, one MinGW), and enable it for one macOS CI job.

Fix related issues:
- add missing include guard to `easy_lock.h`.
- rename static variables and functions (and a macro) with names reused
  across sources, or shadowed by local variables.
- add an `#undef` after use.
- add a missing `#undef` before use.
- move internal definitions from `ftp.h` to `ftp.c`.
- `curl_memory.h` fixes to make it work when included repeatedly.
- stop building/linking curlx bits twice for a static-mode curl tool.
  These caused doubly defined symbols in unity builds.
- silence missing extern declarations compiler warning for ` _CRT_glob`.
- fix extern declarations for `tool_freq` and `tool_isVistaOrGreater`.
- fix colliding static symbols in debug mode: `debugtime()` and
  `statename`.
- rename `ssl_backend_data` structure to unique names for each
  TLS-backend, along with the `ssl_connect_data` struct member
  referencing them. This required adding casts for each access.
- add workaround for missing `[P]UNICODE_STRING` types in certain Windows
  builds when compiling `lib/ldap.c`. To support "unity" builds, we had
  to enable `SCHANNEL_USE_BLACKLISTS` for Schannel (a Windows
  `schannel.h` option) _globally_. This caused an indirect inclusion of
  Windows `schannel.h` from `ldap.c` via `winldap.h` to have it enabled
  as well. This requires `[P]UNICODE_STRING` types, which is apperantly
  not defined automatically (as seen with both MSVS and mingw-w64).
  This patch includes `<subauth.h>` to fix it.
  Ref: https://github.com/curl/curl/runs/13987772013
  Ref: https://dev.azure.com/daniel0244/curl/_build/results?buildId=15827&view=logs&jobId=2c9f582d-e278-56b6-4354-f38a4d851906&j=2c9f582d-e278-56b6-4354-f38a4d851906&t=90509b00-34fa-5a81-35d7-5ed9569d331c
- tweak unity builds to compile `lib/memdebug.c` separately in memory
  trace builds to avoid PP confusion.
- force-disable unity for test programs.
- do not compile and link libcurl sources to libtests _twice_ when libcurl
  is built in static mode.

KNOWN ISSUES:
- running tests with unity builds may fail in cases.
- some build configurations/env may not compile in unity mode. E.g.:
  https://ci.appveyor.com/project/curlorg/curl/builds/47230972/job/51wfesgnfuauwl8q#L250

Ref: https://github.com/libssh2/libssh2/issues/1034
Ref: https://cmake.org/cmake/help/latest/prop_tgt/UNITY_BUILD.html
Ref: https://en.wikipedia.org/wiki/Unity_build

Closes #11095
2023-06-07 13:06:08 +00:00
..
vauth misc: fix spelling mistakes 2023-05-23 10:42:09 +02:00
vquic cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
vssh libssh2: provide error message when setting host key type fails 2023-06-02 23:00:27 +02:00
vtls cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
.checksrc
.gitattributes
.gitignore
altsvc.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
altsvc.h
amigaos.c
amigaos.h
arpa_telnet.h
asyn-ares.c
asyn-thread.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
asyn.h
base64.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
bufq.c bufq: make write/pass methods more robust 2023-06-05 20:11:41 +02:00
bufq.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
bufref.c
bufref.h
c-hyper.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
c-hyper.h
cf-h1-proxy.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
cf-h1-proxy.h proxy: http2 proxy tunnel implementation 2023-04-06 13:04:46 +02:00
cf-h2-proxy.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
cf-h2-proxy.h proxy: http2 proxy tunnel implementation 2023-04-06 13:04:46 +02:00
cf-haproxy.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
cf-haproxy.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
cf-https-connect.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
cf-https-connect.h
cf-socket.c cf-socket: restore Curl_sock_assign_addr() 2023-05-25 14:34:39 +02:00
cf-socket.h cf-socket: restore Curl_sock_assign_addr() 2023-05-25 14:34:39 +02:00
cfilters.c lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
cfilters.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
CMakeLists.txt cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
config-amigaos.h amiga: Fix CA certificate paths for AmiSSL and MorphOS 2023-05-01 14:08:55 -04:00
config-dos.h config-dos.h: fix SIZEOF_CURL_OFF_T for MS-DOS/DJGPP 2023-04-08 23:53:50 +02:00
config-mac.h
config-os400.h
config-plan9.h
config-riscos.h
config-win32.h
config-win32ce.h
conncache.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
conncache.h
connect.c lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
connect.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
content_encoding.c content_encoding: only do tranfer-encoding compression if asked to 2023-04-07 13:39:20 +02:00
content_encoding.h
cookie.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
cookie.h cookie: update the comment on cookie length and size limits 2023-05-18 20:43:25 +02:00
curl_addrinfo.c misc: fix spelling mistakes 2023-05-23 10:42:09 +02:00
curl_addrinfo.h
curl_base64.h
curl_config.h.cmake build: drop unused/redundant HAVE_WINLDAP_H 2023-06-05 16:31:38 +00:00
curl_ctype.h
curl_des.c
curl_des.h
curl_endian.c
curl_endian.h
curl_fnmatch.c
curl_fnmatch.h
curl_get_line.c
curl_get_line.h
curl_gethostname.c
curl_gethostname.h
curl_gssapi.c
curl_gssapi.h
curl_hmac.h
curl_krb5.h
curl_ldap.h
curl_log.c curl_log: evaluate log statement only when transfer is verbose 2023-06-02 23:03:45 +02:00
curl_log.h curl_log: evaluate log statement only when transfer is verbose 2023-06-02 23:03:45 +02:00
curl_md4.h
curl_md5.h
curl_memory.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
curl_memrchr.c
curl_memrchr.h
curl_multibyte.c
curl_multibyte.h
curl_ntlm_core.c openssl: interop with AWS-LC 2023-03-30 10:56:14 +02:00
curl_ntlm_core.h
curl_ntlm_wb.c
curl_ntlm_wb.h
curl_path.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
curl_path.h
curl_printf.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
curl_range.c
curl_range.h
curl_rtmp.c lib: unify the upload/method handling 2023-04-25 12:38:38 +02:00
curl_rtmp.h
curl_sasl.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
curl_sasl.h
curl_setup_once.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
curl_setup.h cf-socket: completely remove the disabled USE_RECV_BEFORE_SEND_WORKAROUND 2023-05-18 20:55:16 +02:00
curl_sha256.h
curl_sspi.c
curl_sspi.h
curl_threads.c
curl_threads.h
curlx.h
dict.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
dict.h
doh.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
doh.h
dynbuf.c dynbuf: never allocate larger than "toobig" 2023-03-28 10:22:53 +02:00
dynbuf.h
dynhds.c lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
dynhds.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
easy_lock.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
easy.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
easygetopt.c
easyif.h Websocket en-/decoding 2023-04-25 23:16:51 +02:00
easyoptions.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
easyoptions.h
escape.c
escape.h
file.c lib: unify the upload/method handling 2023-04-25 12:38:38 +02:00
file.h
fileinfo.c ftplistparser: replace realloc with dynbuf 2023-03-28 10:11:33 +02:00
fileinfo.h ftplistparser: replace realloc with dynbuf 2023-03-28 10:11:33 +02:00
fopen.c
fopen.h
formdata.c
formdata.h
ftp.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
ftp.h
ftplistparser.c ftplistparser: replace realloc with dynbuf 2023-03-28 10:11:33 +02:00
ftplistparser.h
functypes.h
getenv.c
getinfo.c
getinfo.h
gopher.c
gopher.h
hash.c hash: fix assigning same value 2023-04-14 09:26:26 +02:00
hash.h
headers.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
headers.h
hmac.c
hostasyn.c
hostip4.c
hostip6.c
hostip.c lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
hostip.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
hostsyn.c
hsts.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
hsts.h
http1.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
http1.h lib: rename struct 'http_req' to 'httpreq' 2023-05-20 23:03:01 +02:00
http2.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
http2.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
http_aws_sigv4.c checksrc: fix SPACEBEFOREPAREN for conditions starting with "*" 2023-04-27 17:24:47 +02:00
http_aws_sigv4.h
http_chunks.c
http_chunks.h
http_digest.c
http_digest.h
http_negotiate.c
http_negotiate.h
http_ntlm.c
http_ntlm.h
http_proxy.c http_proxy: provide missing arg to infof() call 2023-04-07 23:48:38 +02:00
http_proxy.h CURLPROXY_HTTPS2: for HTTPS proxy that may speak HTTP/2 2023-04-08 00:27:53 +02:00
http.c lib: rename struct 'http_req' to 'httpreq' 2023-05-20 23:03:01 +02:00
http.h lib: rename struct 'http_req' to 'httpreq' 2023-05-20 23:03:01 +02:00
idn.c
idn.h
if2ip.c
if2ip.h
imap.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
imap.h
inet_ntop.c checksrc: find bad indentation in conditions without open brace 2023-04-28 23:11:00 +02:00
inet_ntop.h
inet_pton.c
inet_pton.h
krb5.c
ldap.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
libcurl.plist.in
libcurl.rc
libcurl.vers.in
llist.c
llist.h
Makefile.am
Makefile.inc cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
Makefile.mk
Makefile.soname
md4.c md(4|5): don't use deprecated iOS functions 2023-05-13 09:57:54 +02:00
md5.c md(4|5): don't use deprecated iOS functions 2023-05-13 09:57:54 +02:00
memdebug.c
memdebug.h
mime.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
mime.h
mprintf.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
mqtt.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
mqtt.h
multi.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
multihandle.h multi: remove PENDING + MSGSENT handles from the main linked list 2023-03-26 17:43:28 +02:00
multiif.h
netrc.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
netrc.h
nonblock.c
nonblock.h
noproxy.c noproxy: pointer to local array 'hostip' is stored outside scope 2023-04-12 09:00:20 +02:00
noproxy.h
openldap.c checksrc: find bad indentation in conditions without open brace 2023-04-28 23:11:00 +02:00
optiontable.pl
parsedate.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
parsedate.h
pingpong.c pingpong: fix compiler warning "assigning an enum to unsigned char" 2023-04-28 13:38:21 +02:00
pingpong.h
pop3.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
pop3.h
progress.c
progress.h
psl.c
psl.h
rand.c socketpair: verify with a random value 2023-04-25 17:40:15 +02:00
rand.h
rename.c
rename.h
rtsp.c lib: unify the upload/method handling 2023-04-25 12:38:38 +02:00
rtsp.h rtsp: convert mallocs to dynbuf for RTP buffering 2023-04-04 14:44:25 +02:00
select.c select: avoid returning an error on EINTR from select() or poll() 2023-05-19 16:16:26 +02:00
select.h
sendf.c Websocket en-/decoding 2023-04-25 23:16:51 +02:00
sendf.h
setopt.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
setopt.h
setup-os400.h
setup-vms.h
setup-win32.h
sha256.c lib/sha256.c: typo fix in comment (duplicated "is available") 2023-03-28 17:52:41 +02:00
share.c
share.h
sigpipe.h
slist.c
slist.h
smb.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
smb.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
smtp.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
smtp.h
sockaddr.h
socketpair.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
socketpair.h
socks_gssapi.c
socks_sspi.c
socks.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
socks.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
speedcheck.c
speedcheck.h
splay.c
splay.h
strcase.c
strcase.h
strdup.c
strdup.h
strerror.c checksrc: check for spaces before the colon of switch labels 2023-04-27 23:26:50 +02:00
strerror.h
strtok.c
strtok.h
strtoofft.c
strtoofft.h
system_win32.c
system_win32.h
telnet.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
telnet.h
tftp.c lib: unify the upload/method handling 2023-04-25 12:38:38 +02:00
tftp.h
timediff.c
timediff.h
timeval.c
timeval.h
transfer.c http2: better support for --limit-rate 2023-06-02 23:06:12 +02:00
transfer.h
url.c lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
url.h lib: remove unused functions, make single-use static 2023-05-23 11:08:51 +02:00
urlapi-int.h urlapi: make internal function start with Curl_ 2023-04-27 08:36:51 +02:00
urlapi.c urlapi: scheme starts with alpha 2023-06-05 16:28:27 +02:00
urldata.h haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
version_win32.c
version_win32.h
version.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
warnless.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
warnless.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
ws.c ws: fix CONT opcode check 2023-04-27 11:08:48 +02:00
ws.h Websocket en-/decoding 2023-04-25 23:16:51 +02:00