curl/src
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
..
.gitignore copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
CMakeLists.txt cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
curl.rc copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
Makefile.am copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
Makefile.inc tool: improve --stderr handling 2023-03-12 00:58:40 -05:00
Makefile.mk copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
mkhelp.pl copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
slist_wc.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
slist_wc.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_binmode.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_binmode.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_bname.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_bname.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_dbg.c curl: cache the --trace-time value for a second 2023-05-28 10:22:53 +02:00
tool_cb_dbg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_hdr.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_cb_hdr.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_prg.c tool: improve --stderr handling 2023-03-12 00:58:40 -05:00
tool_cb_prg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_rea.c curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_cb_rea.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_see.c curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_cb_see.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cb_wrt.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_cb_wrt.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_cfgable.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
tool_cfgable.h haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
tool_dirhie.c tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_dirhie.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_doswin.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_doswin.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_easysrc.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_easysrc.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_filetime.c tool: remove newlines from all helpf/notef/warnf/errorf calls 2023-06-01 08:18:21 +02:00
tool_filetime.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_findfile.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_findfile.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_formparse.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_formparse.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_getparam.c tool_getparam: fix comment 2023-06-05 20:10:36 +02:00
tool_getparam.h tool_getparam: fix hiding of command line secrets 2023-01-12 14:09:23 +01:00
tool_getpass.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_getpass.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_help.c curl: output warning at --verbose output for debug-enabled version 2023-01-12 17:59:26 +01:00
tool_help.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_helpers.c tool: remove newlines from all helpf/notef/warnf/errorf calls 2023-06-01 08:18:21 +02:00
tool_helpers.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_hugehelp.c.cvs copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_hugehelp.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_libinfo.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_libinfo.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_listhelp.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
tool_main.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_main.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_msgs.c tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_msgs.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_operate.c haproxy: add --haproxy-clientip flag to spoof client IPs 2023-06-05 20:08:37 +02:00
tool_operate.h curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_operhlp.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
tool_operhlp.h tool_operate: Fix error codes on bad URL & OOM 2023-02-07 08:20:04 +01:00
tool_paramhlp.c tool: remove newlines from all helpf/notef/warnf/errorf calls 2023-06-01 08:18:21 +02:00
tool_paramhlp.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_parsecfg.c tool: remove exclamation marks from error/warning messages 2023-06-01 08:19:21 +02:00
tool_parsecfg.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_progress.c tool: improve --stderr handling 2023-03-12 00:58:40 -05:00
tool_progress.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_sdecls.h curl: count uploaded data to stop at the originally given size 2023-06-01 13:43:28 +02:00
tool_setopt.c tool: remove newlines from all helpf/notef/warnf/errorf calls 2023-06-01 08:18:21 +02:00
tool_setopt.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_setup.h cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_sleep.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_sleep.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_stderr.c tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_stderr.h tool: use errorf() for error output 2023-06-01 08:19:11 +02:00
tool_strdup.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_strdup.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_urlglob.c tool_urlglob: use curl_off_t instead of longs 2023-05-31 08:14:41 +02:00
tool_urlglob.h tool_urlglob: use curl_off_t instead of longs 2023-05-31 08:14:41 +02:00
tool_util.c cmake: add support for "unity" builds 2023-06-07 13:06:08 +00:00
tool_util.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_version.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_vms.c copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_vms.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_writeout_json.c checksrc: fix SPACEBEFOREPAREN for conditions starting with "*" 2023-04-27 17:24:47 +02:00
tool_writeout_json.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00
tool_writeout.c tool_writeout: add URL component variables 2023-04-04 14:42:44 +02:00
tool_writeout.h tool_writeout: add URL component variables 2023-04-04 14:42:44 +02:00
tool_xattr.c checksrc: disallow spaces before labels 2023-05-18 20:45:04 +02:00
tool_xattr.h copyright: update all copyright lines and remove year ranges 2023-01-03 09:19:21 +01:00