]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
gccrs: proc_macro: Mirror FFIString changes in C++library
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 26 Jul 2023 13:39:25 +0000 (15:39 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:55:59 +0000 (18:55 +0100)
Recent changes in the rust interface on some extern C function shall be
synced up in the C++ library.

libgrust/ChangeLog:

* libproc_macro/literal.cc (Literal__from_string):
Update to match rust interface.
* libproc_macro/literal.h (Literal__from_string):
Likewise.
* libproc_macro/tokenstream.cc (TokenStream__from_string):
Likewise.
* libproc_macro/tokenstream.h (TokenStream__from_string):
Likewise.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
libgrust/libproc_macro/literal.cc
libgrust/libproc_macro/literal.h
libgrust/libproc_macro/tokenstream.cc
libgrust/libproc_macro/tokenstream.h

index 4ad45c903315f1ba066741fee4056ed80b16a96a..8e1e0a4a116c5d29cc8d6c8f4eaacb3d2418d1c1 100644 (file)
@@ -28,7 +28,7 @@ namespace ProcMacro {
 
 extern "C" {
 bool
-Literal__from_string (const unsigned char *str, std::uint64_t len, Literal *lit)
+Literal__from_string (FFIString str, Literal *lit)
 {
   // FIXME: implement this function with lexer
   std::abort ();
index e1b7079451a6b3f81f3fd781826d94439fd06da3..fb8a8b442e29ed0b070e18c68f6804c45d951bdb 100644 (file)
@@ -105,8 +105,7 @@ public:
 
 extern "C" {
 bool
-Literal__from_string (const unsigned char *str, std::uint64_t len,
-                     Literal *lit);
+Literal__from_string (FFIString str, Literal *lit);
 }
 } // namespace ProcMacro
 
index c3502f1c7b7a96c9bf56732c31c6c98e4a032df1..5d9abb69a2dd6003d034fbcc89fef9377b592709 100644 (file)
@@ -103,11 +103,10 @@ TokenSream__push (TokenStream *stream, TokenTree tree)
 }
 
 extern "C" bool
-TokenStream__from_string (unsigned char *str, std::uint64_t len,
-                         TokenStream *ts)
+TokenStream__from_string (FFIString str, TokenStream *ts)
 {
   bool result;
-  auto source = std::string (reinterpret_cast<const char *> (str), len);
+  auto source = str.to_string ();
 
   *ts = TokenStream::make_tokenstream (source, result);
   return result;
index 8b2432b9a685b5ee8c62ae755f19b5cc7fbb01a1..0fde5ea5397f8513dea2fa2674ddbe2114764180 100644 (file)
@@ -27,6 +27,8 @@
 #include <vector>
 #include <string>
 
+#include "ffistring.h"
+
 namespace ProcMacro {
 struct TokenTree;
 
@@ -59,8 +61,7 @@ extern "C" void
 TokenSream__push (TokenStream *stream, TokenTree tree);
 
 extern "C" bool
-TokenStream__from_string (unsigned char *str, std::uint64_t len,
-                         TokenStream *ts);
+TokenStream__from_string (FFIString str, TokenStream *ts);
 
 extern "C" TokenStream
 TokenStream__clone (const TokenStream *ts);