gcc/libgrust
Pierre-Emmanuel Patry 10c9b9f0cc 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>
2024-01-16 18:37:19 +01:00
..
libproc_macro gccrs: libproc_macro: Change cpp literal representation 2024-01-16 18:37:19 +01:00
aclocal.m4
ChangeLog Daily bump. 2024-01-09 00:17:50 +00:00
configure libgrust: 'AM_ENABLE_MULTILIB' only for target builds [PR113056] 2024-01-08 12:01:05 +01:00
configure.ac libgrust: 'AM_ENABLE_MULTILIB' only for target builds [PR113056] 2024-01-08 12:01:05 +01:00
Makefile.am gccrs: libproc_macro: Build statically 2024-01-16 18:34:16 +01:00
Makefile.in gccrs: libproc_macro: Build statically 2024-01-16 18:34:16 +01:00