Keep cxx.h up to date Bug: 528225104 Change-Id: I0fb75053057ac7b01d4973b5f49379166a6a6964 Reviewed-on: https://gn-review.googlesource.com/c/gn/+/23880 Reviewed-by: Takuto Ikuta <tikuta@google.com> Commit-Queue: Matt Stark <msta@google.com>
diff --git a/src/gn/ffi/update_bridge.sh b/src/gn/ffi/update_bridge.sh index 818fd10..181f947 100755 --- a/src/gn/ffi/update_bridge.sh +++ b/src/gn/ffi/update_bridge.sh
@@ -28,6 +28,12 @@ ( echo "// This file is generated by src/gn/ffi/update_bridge.sh. Do not edit manually." + echo "// Source: cxxbridge --header" + "${LOCAL_BIN_DIR}/bin/cxxbridge" --header +) > "${SCRIPT_DIR}/../starlark/vendor/cxx/include/cxx.h" + +( + echo "// This file is generated by src/gn/ffi/update_bridge.sh. Do not edit manually." echo "// Source: src/gn/ffi/starlark/crates/ffi/src/bridge.rs" "${LOCAL_BIN_DIR}/bin/cxxbridge" "${SCRIPT_DIR}/../starlark/crates/ffi/src/bridge.rs" --header ) > "${SCRIPT_DIR}/bridge.h"
diff --git a/src/gn/starlark/vendor/cxx/include/cxx.h b/src/gn/starlark/vendor/cxx/include/cxx.h index 1c97580..7e07004 100644 --- a/src/gn/starlark/vendor/cxx/include/cxx.h +++ b/src/gn/starlark/vendor/cxx/include/cxx.h
@@ -1,3 +1,5 @@ +// This file is generated by src/gn/ffi/update_bridge.sh. Do not edit manually. +// Source: cxxbridge --header #pragma once #include <algorithm> #include <array> @@ -168,6 +170,13 @@ std::array<std::uintptr_t, 2> repr; }; + +#if __cplusplus >= 201703L +inline Str cxx_to_rust(std::string_view view) { return Str(view); } +#endif + +inline Str cxx_to_rust(const std::string &s) { return Str(s); } + #endif // CXXBRIDGE1_RUST_STR #ifndef CXXBRIDGE1_RUST_SLICE @@ -528,7 +537,7 @@ #ifndef CXXBRIDGE1_PANIC #define CXXBRIDGE1_PANIC template <typename Exception> -void panic [[noreturn]] (const char *msg); +void panic [[noreturn]](const char *msg); #endif // CXXBRIDGE1_PANIC #ifndef CXXBRIDGE1_RUST_FN