]> gcc.gnu.org Git - gcc.git/commit
gccrs: libproc_macro: Change cpp literal representation
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Wed, 10 May 2023 13:17:46 +0000 (15:17 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:37:19 +0000 (18:37 +0100)
commit10c9b9f0ccc340e53e1dfd3e8ca9125f280d8e66
tree23b844d40f50858c3e131ce7dbf68885689f6a6f
parent5605333c907883486f821088a1ceb22d2bb24aa3
gccrs: libproc_macro: Change cpp literal representation

Change the literal representation on cpp side to match the new one in
rust. This means FFIString had to be implemented on cpp side. A few
helper functions has also been introduced.

libgrust/ChangeLog:

* libproc_macro/Makefile.am: Add ffistring unit to
compiled objects list.
* libproc_macro/Makefile.in: Regenerate.
* libproc_macro/literal.cc (Literal::drop): Change with
a call to ffistring drop function.
(Literal::make_literal): Add new helper constructor
(Literal__drop): Remove this function.
(Literal__string): Likewise.
(Literal__byte_string): Likewise.
(Literal__from_string): Moved this function.
(Literal::make_unsigned): Changed the constructor to match the
new layout.
(Literal::make_signed): Likewise.
(Literal::clone): Reimplement th eclone function.
(Literal::make_u8): Changed the constructor, make suffixed by
default.
(Literal::make_u16): Likewise.
(Literal::make_u32): Likewise.
(Literal::make_u64): Likewise.
(Literal::make_i8): Likewise.
(Literal::make_i16): Likewise.
(Literal::make_i32): Likewise.
(Literal::make_i64): Likewise.
(Literal::make_string): Likewise.
(Literal::make_byte_string): Likewise.
(Literal::make_f32): Likewise.
(Literal::make_f64): Likewise.
(Literal::make_char): Likewise.
(Literal::make_usize): Likewise.
(Literal::make_isize): Likewise.
(LitKind::make_byte): Add new helper constructor to avoid having
to set the payload value.
(LitKind::make_char): Likewise.
(LitKind::make_integer): Likewise.
(LitKind::make_float): Likewise.
(LitKind::make_str): Likewise.
(LitKind::make_str_raw): Add a new helper constructor which
takes the payload value as an argument.
(LitKind::make_byte_str): Add new helper constructor to avoid
mistakes with payload value.
(LitKind::make_byte_str_raw): Add a new helper constructor which
takes the payload value as an argument.
* libproc_macro/literal.h: Add new functions prototype.
(enum UnsignedTag): Removed because it is now unused.
(struct Payload128): Likewise.
(union UnsignedPayload): Likewise.
(struct Unsigned): Likewise.
(enum SignedTag): Likewise.
(union SignedPayload): Likewise.
(struct Signed): Likewise.
(enum LiteralTag): Likewise.
(enum LitKindTag): Likewise.
(struct StringPayload): Likewise.
(struct ByteStringPayload): Likewise.
(union LitKindPayload): Likewise.
(struct UnsignedSuffixPayload): Likewise.
(struct LitKind): Add new literal kind struct representation to
match the enum on rust side.
(struct SignedSuffixPayload): Removed because now unused.
(struct UsizePayload): Likewise.
(struct IsizePayload): Likewise.
(struct Float32Payload): Likewise.
(struct Float64Payload): Likewise.
(union LiteralPayload): Likewise.
(struct Literal): Changed the internals of the structure.
(Literal__drop): Removed the drop function fom the c interface.
(Literal__string): Removed unused function.
(Literal__byte_string): Removed unused function.
* libproc_macro/ffistring.cc: New file.
* libproc_macro/ffistring.h: New file.

gcc/rust/ChangeLog:

* lex/rust-token.h: Implement hash for token id enumeration.
* util/rust-token-converter.cc (dispatch_float_literals): Update
to new internals.
(dispatch_integer_literals): Likewise.
(convert): Likewise.
(string_literal): Remove function.
(byte_string_literal): Likewise.
(unsigned_literal): Likewise.
(signed_literal): Likewise.
(from_literal): Update with new internals.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/lex/rust-token.h
gcc/rust/util/rust-token-converter.cc
libgrust/libproc_macro/Makefile.am
libgrust/libproc_macro/Makefile.in
libgrust/libproc_macro/ffistring.cc [new file with mode: 0644]
libgrust/libproc_macro/ffistring.h [new file with mode: 0644]
libgrust/libproc_macro/literal.cc
libgrust/libproc_macro/literal.h
This page took 0.059241 seconds and 5 git commands to generate.