Skip to content

Conversation

KaganCanSit
Copy link
Contributor

Hello Botan Development Team,

This PR addresses the TODO comment in ffi_util.h regarding the use of C++20's std::source_location to eliminate macro usage.

TODO Message

// TODO: C++20 introduces std::source_location which will allow to eliminate this
//       macro altogether. Instead, using code would just call the C++ function
//       that makes use of std::source_location like so:
//
//   template<typename T, uint32_t M, typename F>
//   int botan_ffi_visit(botan_struct<T, M>* obj, F func,
//                       const std::source_location sl = std::source_location::current())
//      {
//      // [...]
//      if constexpr(...)
//         {
//         return ffi_guard_thunk(sl.function_name(), [&] { return func(*p); })
//         }
//      // [...]
//      }
// NOLINTNEXTLINE(*-macro-usage)
#define BOTAN_FFI_VISIT(obj, lambda) botan_ffi_visit(obj, lambda, __func__)

Changes

  • Modified botan_ffi_visit template function to accept std::source_location parameter
  • Added #include <source_location> header
  • Eliminated BOTAN_FFI_VISIT macro as planned
  • Updated all call sites to use direct function calls instead of macro

Built and tested with:

ninja clean && ./configure.py --without-documentation --with-boost --cc=clang --compiler-cache=ccache --build-targets=static,cli,tests --build-tool=ninja && ninja && ./botan-test --test-threads=8 --run-long-tests

If you would like any changes or if I have made a mistake, please leave a comment and I will try to resolve it as soon as possible.

Best regards.

@KaganCanSit KaganCanSit changed the title Replace BOTAN_FFI_VISIT macro with std::source_location and remove macro usage Replace BOTAN_FFI_VISIT macro with std::source_location (use botan_ffi_visit function) Aug 31, 2025
@coveralls
Copy link

Coverage Status

coverage: 90.689% (+0.02%) from 90.669%
when pulling 90a0f53 on KaganCanSit:modernize-ffi-visit-source-location-remove-macro
into 73ef154 on randombit:master.

@KaganCanSit
Copy link
Contributor Author

Various CI processes failed. I will address the errors that occurred for Clang-Tidy. However, at first glance, I couldn't determine why Linux (clang, shared) failed. That said, clang is also present in other CI processes and is successful. I will try to look into this after work.

CLANG

### Errors in src/lib/ffi/ffi_mp.cpp
src/lib/ffi/ffi_mp.cpp:48:27: warning: variable 'base' is not initialized [cppcoreguidelines-init-variables]
   48 |       Botan::BigInt::Base base;
      |                           ^

Checked src/lib/ffi/ffi_mp.cpp
Checked src/lib/ffi/ffi_oid.cpp
### Errors in src/lib/ffi/ffi_pk_op.cpp
src/lib/ffi/ffi_pk_op.cpp:214:10: warning: 'auto kak' can be declared as 'const auto *kak' [readability-qualified-auto]
  214 |       if(auto kak = dynamic_cast<const Botan::PK_Key_Agreement_Key*>(&k)) {
      |          ^~~~
      |          const auto *

Checked src/lib/ffi/ffi_pk_op.cpp
Checked src/lib/ffi/ffi_pkey.cpp
### Errors in src/lib/ffi/ffi_pkey_algs.cpp
src/lib/ffi/ffi_pkey_algs.cpp:773:10: warning: 'auto ed' can be declared as 'const auto *ed' [readability-qualified-auto]
  773 |       if(auto ed = dynamic_cast<const Botan::Ed25519_PrivateKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:793:10: warning: 'auto ed' can be declared as 'const auto *ed' [readability-qualified-auto]
  793 |       if(auto ed = dynamic_cast<const Botan::Ed25519_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:847:10: warning: 'auto ed' can be declared as 'const auto *ed' [readability-qualified-auto]
  847 |       if(auto ed = dynamic_cast<const Botan::Ed448_PrivateKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:864:10: warning: 'auto ed' can be declared as 'const auto *ed' [readability-qualified-auto]
  864 |       if(auto ed = dynamic_cast<const Botan::Ed448_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:915:10: warning: 'auto x25519' can be declared as 'const auto *x25519' [readability-qualified-auto]
  915 |       if(auto x25519 = dynamic_cast<const Botan::X25519_PrivateKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:935:10: warning: 'auto x25519' can be declared as 'const auto *x25519' [readability-qualified-auto]
  935 |       if(auto x25519 = dynamic_cast<const Botan::X25519_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:985:10: warning: 'auto x448' can be declared as 'const auto *x448' [readability-qualified-auto]
  985 |       if(auto x448 = dynamic_cast<const Botan::X448_PrivateKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:1002:10: warning: 'auto x448' can be declared as 'const auto *x448' [readability-qualified-auto]
 1002 |       if(auto x448 = dynamic_cast<const Botan::X448_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:1086:10: warning: 'auto kyber' can be declared as 'const auto *kyber' [readability-qualified-auto]
 1086 |       if(auto kyber = dynamic_cast<const Botan::Kyber_PrivateKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:1101:10: warning: 'auto kyber' can be declared as 'const auto *kyber' [readability-qualified-auto]
 1101 |       if(auto kyber = dynamic_cast<const Botan::Kyber_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *
src/lib/ffi/ffi_pkey_algs.cpp:1356:10: warning: 'auto ecc' can be declared as 'const auto *ecc' [readability-qualified-auto]
 1356 |       if(auto ecc = dynamic_cast<const Botan::EC_PublicKey*>(&k)) {
      |          ^~~~
      |          const auto *

COMPILE ERROR - LINUX(clang, shared)

In file included from src/lib/ffi/ffi.cpp:14:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:311: build/obj/lib/ffi.o] Error 1
  In file included from src/lib/ffi/ffi_block.cpp:10:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_block.cpp:43:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(bc, [](auto& b) { b.clear(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:53:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(bc, [=](auto& b) { b.set_key(key, len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:61:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(bc, [](const auto& b) { return static_cast<int>(b.block_size()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:68:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(bc, [=](const auto& b) { b.encrypt_n(in, out, blocks); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:75:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(bc, [=](const auto& b) { b.decrypt_n(in, out, blocks); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:83:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& bc) { return write_str_output(name, name_len, bc.name()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_block.cpp:90:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& bc) {
            ^~~~~~~~~~~~~~~
  9 errors generated.
  make: *** [Makefile:314: build/obj/lib/ffi_block.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_fpe.cpp -o build/obj/lib/ffi_fpe.o
  In file included from src/lib/ffi/ffi_cipher.cpp:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_cipher.cpp:118:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [](auto& c) { c.clear(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:122:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [](auto& c) { c.reset(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:130:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { *out_len = c.output_length(in_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:134:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:144:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:158:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](auto& c) { c.set_key(key, key_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:288:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](auto& c) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:298:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { return c.valid_nonce_length(nl) ? 1 : 0; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:302:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { *nl = c.default_nonce_length(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:306:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& /*c*/) { *ug = cipher->update_size(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:310:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { *ug = c.ideal_granularity(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:314:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { *tl = c.tag_size(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:318:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { return c.authenticated() ? 1 : 0; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:322:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { return c.requires_entire_message() ? 1 : 0; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cipher.cpp:326:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cipher, [=](const auto& c) { return write_str_output(name, name_len, c.name()); });
            ^~~~~~~~~~~~~~~
  17 errors generated.
  make: *** [Makefile:320: build/obj/lib/ffi_cipher.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_hash.cpp -o build/obj/lib/ffi_hash.o
  In file included from src/lib/ffi/ffi_cert.cpp:9:
  In file included from build/include/internal/botan/internal/ffi_pkey.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_cert.cpp:103:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:121:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:142:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { return invoke_view_callback(view, ctx, c.to_string()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:151:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:175:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert,
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:185:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert,
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:195:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { *time_since_epoch = c.not_before().time_since_epoch(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:204:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { *time_since_epoch = c.not_after().time_since_epoch(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:213:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.serial_number()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:224:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:235:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.authority_key_id()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:244:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { return write_vec_output(out, out_len, c.subject_key_id()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:257:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert,
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:271:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(cert, [=](const auto& c) { return c.matches_dns_name(hostname) ? 0 : -1; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_cert.cpp:409:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(crl, [=](const auto& c) { return c.is_revoked(safe_get(cert)) ? 0 : -1; });
            ^~~~~~~~~~~~~~~
  17 errors generated.
  make: *** [Makefile:317: build/obj/lib/ffi_cert.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_hotp.cpp -o build/obj/lib/ffi_hotp.o
  In file included from src/lib/ffi/ffi_ec.cpp:10:
  In file included from build/include/internal/botan/internal/ffi_ec.h:12:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_ec.cpp:124:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(ec_group,
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_ec.cpp:129:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(ec_group, [=](const auto& g) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_ec.cpp:135:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(ec_group, [=](const auto& g) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_ec.cpp:148:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(ec_group, [=](const auto& g) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_ec.cpp:186:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(curve1_w, [=](const auto& curve1) -> int { return curve1 == safe_get(curve2_w); });
            ^~~~~~~~~~~~~~~
  7 errors generated.
  In file included from src/lib/ffi/ffi_fpe.cpp:9:
  In file included from build/include/internal/botan/internal/ffi_mp.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:326: build/obj/lib/ffi_fpe.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_kdf.cpp -o build/obj/lib/ffi_kdf.o
  make: *** [Makefile:323: build/obj/lib/ffi_ec.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_keywrap.cpp -o build/obj/lib/ffi_keywrap.o
  In file included from src/lib/ffi/ffi_hash.cpp:10:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_hash.cpp:45:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [=](const auto& h) { *out = h.output_length(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:52:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [=](const auto& h) { *out = h.hash_block_size(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:56:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [](auto& h) { h.clear(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:68:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [=](auto& h) { h.update(buf, len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:75:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [=](auto& h) { h.final(out); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:80:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(source, [=](const auto& src) { return ffi_new_object(dest, src.copy_state()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hash.cpp:88:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hash, [=](const auto& h) { return write_str_output(name, name_len, h.name()); });
            ^~~~~~~~~~~~~~~
  9 errors generated.
  make: *** [Makefile:329: build/obj/lib/ffi_hash.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_mac.cpp -o build/obj/lib/ffi_mac.o
  In file included from src/lib/ffi/ffi_hotp.cpp:9:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_hotp.cpp:58:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hotp, [=](auto& h) { *hotp_code = h.generate_hotp(hotp_counter); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_hotp.cpp:69:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(hotp, [=](auto& h) {
            ^~~~~~~~~~~~~~~
  4 errors generated.
  make: *** [Makefile:332: build/obj/lib/ffi_hotp.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_mp.cpp -o build/obj/lib/ffi_mp.o
  In file included from src/lib/ffi/ffi_keywrap.cpp:10:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:338: build/obj/lib/ffi_keywrap.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_oid.cpp -o build/obj/lib/ffi_oid.o
  In file included from src/lib/ffi/ffi_kdf.cpp:11:
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_pk_op.cpp -o build/obj/lib/ffi_pk_op.o
  In file included from build/include/internal/botan/internal/ffi_rng.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:335: build/obj/lib/ffi_kdf.o] Error 1
  In file included from src/lib/ffi/ffi_mac.cpp:10:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_mac.cpp:41:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](auto& m) { m.set_key(key, key_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:45:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](auto& m) { m.start(nonce, nonce_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:49:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](const auto& m) { *out = m.output_length(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:53:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [](auto& m) { m.clear(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:57:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](auto& m) { m.update(buf, len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:61:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](auto& m) { m.final(out); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:65:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](const auto& m) { return write_str_output(name, name_len, m.name()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mac.cpp:72:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mac, [=](auto& m) {
            ^~~~~~~~~~~~~~~
  10 errors generated.
  make: *** [Makefile:341: build/obj/lib/ffi_mac.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_pkey.cpp -o build/obj/lib/ffi_pkey.o
  In file included from src/lib/ffi/ffi_mp.cpp:13:
  In file included from build/include/internal/botan/internal/ffi_mp.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_mp.cpp:35:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [](auto& bn) { bn.clear(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:39:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](auto& bn) { bn = Botan::BigInt::from_s32(initial_value); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:43:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](auto& bn) { bn = Botan::BigInt(str); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:47:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](auto& bn) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:65:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(dest, [=](auto& bn) { bn = safe_get(source); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:69:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [](const auto& bn) { return bn.is_negative() ? 1 : 0; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:73:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [](const auto& bn) { return bn.is_positive() ? 1 : 0; });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:77:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [](auto& bn) { bn.flip_sign(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:81:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](auto& bn) { bn._assign_from_bytes({bin, bin_len}); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:85:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](const auto& bn) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:92:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](const auto& bn) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:104:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](const auto& bn) { bn.serialize_to(std::span{vec, bn.bytes()}); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:111:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(mp, [=](const auto& bn) { *val = bn.to_u32bit(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:119:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(result, [=](auto& res) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:129:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(result, [=](auto& res) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:139:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(result, [=](auto& res) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_mp.cpp:149:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(result, [=](auto& res) {
            ^~~~~~~~~~~~~~~
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  make: *** [Makefile:344: build/obj/lib/ffi_mp.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_pkey_algs.cpp -o build/obj/lib/ffi_pkey_algs.o
  In file included from src/lib/ffi/ffi_oid.cpp:11:
  In file included from build/include/internal/botan/internal/ffi_oid.h:12:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_oid.cpp:42:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(oid, [=](const auto& o) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_oid.cpp:52:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(oid, [=](const auto& o) -> int { return invoke_view_callback(view, ctx, o.to_string()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_oid.cpp:56:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_rng.cpp -o build/obj/lib/ffi_rng.o
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_oid.cpp:61:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(a_w, [=](const auto& a) -> int { return a == safe_get(b_w); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_oid.cpp:65:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(a_w, [=](auto& a) {
            ^~~~~~~~~~~~~~~
  7 errors generated.
  make: *** [Makefile:347: build/obj/lib/ffi_oid.o] Error 1
  In file included from src/lib/ffi/ffi_pk_op.cpp:11:
  In file included from build/include/internal/botan/internal/ffi_pkey.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_pk_op.cpp:53:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) { *ctext_len = o.ciphertext_length(ptext_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:62:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:98:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) { *ptext_len = o.plaintext_length(ctext_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:103:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:139:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) { *sig_len = o.signature_length(); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:143:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& o) { o.update(in, in_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:147:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& o) { return write_vec_output(out, out_len, o.signature(safe_get(rng_obj))); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:173:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& o) { o.update(in, in_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:177:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& o) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:213:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:223:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:239:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](const auto& o) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:267:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& kem) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:279:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& kem) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:294:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& kem) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:325:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& kem) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pk_op.cpp:339:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(op, [=](auto& kem) {
            ^~~~~~~~~~~~~~~
  19 errors generated.
  make: *** [Makefile:350: build/obj/lib/ffi_pk_op.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_srp6.cpp -o build/obj/lib/ffi_srp6.o
  In file included from src/lib/ffi/ffi_pkey.cpp:15:
  In file included from build/include/internal/botan/internal/ffi_ec.h:12:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_pkey.cpp:144:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) { return write_str_output(out, out_len, k.algo_name()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:148:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) { return write_str_output(out, out_len, k.algo_name()); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:154:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:161:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:179:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:184:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:189:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:206:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key,
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:211:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:216:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:267:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:293:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:339:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:364:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:378:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:391:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey.cpp:404:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  fatal error: too many errors emitted, stopping now [-ferror-limit=]
  20 errors generated.
  make: *** [Makefile:353: build/obj/lib/ffi_pkey.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_totp.cpp -o build/obj/lib/ffi_totp.o
  In file included from src/lib/ffi/ffi_rng.cpp:12:
  In file included from build/include/internal/botan/internal/ffi_rng.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_tpm2.cpp -o build/obj/lib/ffi_tpm2.o
                                                                                     ~~~~~^
  src/lib/ffi/ffi_rng.cpp:164:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(rng, [=](auto& r) { r.randomize(out, out_len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_rng.cpp:175:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(rng, [=](auto& r) { r.reseed_from_rng(Botan::system_rng(), bits); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_rng.cpp:179:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(rng, [=](auto& r) { r.add_entropy(input, len); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_rng.cpp:183:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(rng, [=](auto& r) { r.reseed_from_rng(safe_get(source_rng), bits); });
            ^~~~~~~~~~~~~~~
  6 errors generated.
  make: *** [Makefile:359: build/obj/lib/ffi_rng.o] Error 1
  In file included from src/lib/ffi/ffi_srp6.cpp:10:
  In file included from build/include/internal/botan/internal/ffi_rng.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_srp6.cpp:71:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(srp6, [=](auto& s) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_srp6.cpp:95:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(srp6, [=](auto& s) -> int {
            ^~~~~~~~~~~~~~~
  4 errors generated.
  make: *** [Makefile:362: build/obj/lib/ffi_srp6.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/ffi/ffi_zfec.cpp -o build/obj/lib/ffi_zfec.o
  In file included from src/lib/ffi/ffi_pkey_algs.cpp:13:
  In file included from build/include/internal/botan/internal/ffi_mp.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_pkey_algs.cpp:195:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) { safe_get(output) = pubkey_get_field(k, field_name); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:205:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) { safe_get(output) = privkey_get_field(k, field_name); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:301:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(rsa_key, [=](const auto& k) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:772:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:792:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:846:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:863:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:914:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:934:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:984:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:1001:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:1085:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:1100:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) -> int {
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_pkey_algs.cpp:1355:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(key, [=](const auto& k) -> int {
            ^~~~~~~~~~~~~~~
  16 errors generated.
  In file included from src/lib/ffi/ffi_totp.cpp:9:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  src/lib/ffi/ffi_totp.cpp:59:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(totp, [=](auto& t) { *totp_code = t.generate_totp(timestamp); });
            ^~~~~~~~~~~~~~~
  src/lib/ffi/ffi_totp.cpp:69:11: error: no matching function for call to 'botan_ffi_visit'
     return botan_ffi_visit(totp, [=](auto& t) {
            ^~~~~~~~~~~~~~~
  4 errors generated.
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/filters/algo_filt.cpp -o build/obj/lib/filters_algo_filt.o
  make: *** [Makefile:356: build/obj/lib/ffi_pkey_algs.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/filters/b64_filt.cpp -o build/obj/lib/filters_b64_filt.o
  make: *** [Makefile:365: build/obj/lib/ffi_totp.o] Error 1
  In file included from src/lib/ffi/ffi_tpm2.cpp:10:
  In file included from build/include/internal/botan/internal/ffi_pkey.h:11:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:368: build/obj/lib/ffi_tpm2.o] Error 1
  ccache clang++ -fPIC -fvisibility=hidden -fstack-protector -m64 -pthread -std=c++20 -D_REENTRANT  -O3 --system-header-prefix=boost/ -Wall -Wextra -Wpedantic -Wshadow -Wstrict-aliasing -Wstrict-overflow=5 -Wcast-align -Wmissing-declarations -Wpointer-arith -Wcast-qual -Wshorten-64-to-32 -Wcomma -Wdocumentation -Werror -Wno-error=unused-parameter -Wno-error=unreachable-code -Wno-error=unused-lambda-capture -DBOTAN_IS_BEING_BUILT  -I build/include/public -I build/include/internal  -isystem build/include/external -c src/lib/filters/basefilt.cpp -o build/obj/lib/filters_basefilt.o
  In file included from src/lib/ffi/ffi_zfec.cpp:9:
  build/include/internal/botan/internal/ffi_util.h:115:63: error: no type named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                           ~~~~~^
  build/include/internal/botan/internal/ffi_util.h:115:89: error: no member named 'source_location' in namespace 'std'
  int botan_ffi_visit(botan_struct<T, M>* o, F func, const std::source_location sl = std::source_location::current()) {
                                                                                     ~~~~~^
  2 errors generated.
  make: *** [Makefile:371: build/obj/lib/ffi_zfec.o] Error 1

@reneme reneme mentioned this pull request Sep 1, 2025
34 tasks
@reneme
Copy link
Collaborator

reneme commented Sep 1, 2025

I appreciate the effort. Unfortunately that won't work before we increase the minimum compiler requirements of the library. At the moment, we are supporting GCC 11 and Clang 14. While those compilers support most of C++20 they don't support everything. Especially library support is lacking behind. According to cppreference, std::source_location is fully supported on Clang 16 only.

I couldn't determine why Linux (clang, shared) failed.

We run the "Linux clang shared" job deliberately on the older Ubuntu 22.04, to verify that we don't break compatibility with Clang 14 that this version ob Ubuntu ships. Other CI jobs run on newer Ubuntu versions with newer Clangs. That's why they succeed while "Linux clang shared" fails.
Unfortunately this old Clang is holding us back on using other C++20 features as well. Most notably most of the std::ranges algorithms shipped in C++20.

I referenced your pull request in #4666 to be considered when we start working on Botan4 (which will shed support for some older compilers). This won't happen before much later in 2026 or perhaps even 2027 however. Until then, I'll close this. But it'll certainly come in handy once the time for it is right! Thanks.

@reneme reneme closed this Sep 1, 2025
@KaganCanSit
Copy link
Contributor Author

In my professional life, I often encounter compiler features that are not fully supported. I sincerely understand this situation. At least here, I was able to raise awareness without taking up your time. After future updates, the improvements here can be merged.

I will keep this branch up to date in my own repository. I will rebase it from time to time.

Thank you for your knowledge and guidance. (@reneme)
Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants