[gcc r14-7829] gccrs: proc_macro: Mirror FFIString changes in C++library
Arthur Cohen
cohenarthur@gcc.gnu.org
Tue Jan 16 18:02:08 GMT 2024
https://gcc.gnu.org/g:973f4088efa74e3c181169b77c22358ae179d4d6
commit r14-7829-g973f4088efa74e3c181169b77c22358ae179d4d6
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date: Wed Jul 26 15:39:25 2023 +0200
gccrs: proc_macro: Mirror FFIString changes in C++library
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>
Diff:
---
libgrust/libproc_macro/literal.cc | 2 +-
libgrust/libproc_macro/literal.h | 3 +--
libgrust/libproc_macro/tokenstream.cc | 5 ++---
libgrust/libproc_macro/tokenstream.h | 5 +++--
4 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/libgrust/libproc_macro/literal.cc b/libgrust/libproc_macro/literal.cc
index 4ad45c90331..8e1e0a4a116 100644
--- a/libgrust/libproc_macro/literal.cc
+++ b/libgrust/libproc_macro/literal.cc
@@ -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 ();
diff --git a/libgrust/libproc_macro/literal.h b/libgrust/libproc_macro/literal.h
index e1b7079451a..fb8a8b442e2 100644
--- a/libgrust/libproc_macro/literal.h
+++ b/libgrust/libproc_macro/literal.h
@@ -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
diff --git a/libgrust/libproc_macro/tokenstream.cc b/libgrust/libproc_macro/tokenstream.cc
index c3502f1c7b7..5d9abb69a2d 100644
--- a/libgrust/libproc_macro/tokenstream.cc
+++ b/libgrust/libproc_macro/tokenstream.cc
@@ -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;
diff --git a/libgrust/libproc_macro/tokenstream.h b/libgrust/libproc_macro/tokenstream.h
index 8b2432b9a68..0fde5ea5397 100644
--- a/libgrust/libproc_macro/tokenstream.h
+++ b/libgrust/libproc_macro/tokenstream.h
@@ -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);
More information about the Gcc-cvs
mailing list