Skip to content
Snippets Groups Projects
  1. Jan 02, 2025
  2. Dec 10, 2024
  3. Dec 09, 2024
    • Arthur Cohen's avatar
      Rust: libformat_parser: Lower minimum Rust version to 1.49 · be38c37f
      Arthur Cohen authored
      libgrust/ChangeLog:
      
      	* libformat_parser/Cargo.toml: Change Rust edition from 2021 to 2018.
      	* libformat_parser/generic_format_parser/Cargo.toml: Likewise.
      	* libformat_parser/generic_format_parser/src/lib.rs: Remove usage of
      	then-unstable std features and language constructs.
      	* libformat_parser/src/lib.rs: Likewise, plus provide extension trait
      	for String::leak.
      be38c37f
    • Thomas Schwinge's avatar
      Rust: Work around 'error[E0599]: no method named `leak` found for struct... · 9e4a87ce
      Thomas Schwinge authored
      Rust: Work around 'error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope'
      
      Compiling with Debian GNU/Linux 12 (bookworm) packages:
      
          $ apt-cache madison cargo rustc
               cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main ppc64el Packages
               cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main Sources
               rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main ppc64el Packages
               rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main Sources
      
      ..., we run into:
      
             Compiling libformat_parser v0.1.0 ([...]/source-gcc/libgrust/libformat_parser)
          error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope
             --> src/lib.rs:396:18
              |
          396 |         ptr: str.leak().as_ptr(),
              |                  ^^^^ method not found in `std::string::String`
      
          error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope
             --> src/lib.rs:434:7
              |
          434 |     s.leak();
              |       ^^^^ method not found in `std::string::String`
      
          error[E0599]: no method named `leak` found for struct `std::string::String` in the current scope
             --> src/lib.rs:439:23
              |
          439 |         ptr: cloned_s.leak().as_ptr(),
              |                       ^^^^ method not found in `std::string::String`
      
      Locally replace 1.72.0+ method 'leak' for struct 'std::string::String'.
      
      	libgrust/
      	* libformat_parser/src/lib.rs: Work around 'error[E0599]:
      	no method named `leak` found for struct `std::string::String` in the current scope'.
      9e4a87ce
    • Thomas Schwinge's avatar
      Rust: Work around 'error[E0658]: `let...else` statements are unstable' · 85f81ba6
      Thomas Schwinge authored
      Compiling with Debian GNU/Linux 12 (bookworm) packages:
      
          $ apt-cache madison cargo rustc
               cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main ppc64el Packages
               cargo | 0.66.0+ds1-1 | http://deb.debian.org/debian bookworm/main Sources
               rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main ppc64el Packages
               rustc | 1.63.0+dfsg1-2 | http://deb.debian.org/debian bookworm/main Sources
      
      ..., we run into:
      
             Compiling generic_format_parser v0.1.0 ([...]/source-gcc/libgrust/libformat_parser/generic_format_parser)
          error[E0658]: `let...else` statements are unstable
             --> generic_format_parser/src/lib.rs:994:5
              |
          994 | /     let Some(unescaped) = unescape_string(snippet) else {
          995 | |         return InputStringKind::NotALiteral;
          996 | |     };
              | |______^
              |
              = note: see issue #87335 <https://github.com/rust-lang/rust/issues/87335> for more information
      
      Rewrite backwards, per <https://rust-lang.github.io/rfcs/3137-let-else.html>.
      
      	libgrust/
      	* libformat_parser/generic_format_parser/src/lib.rs: Work around
      	'error[E0658]: `let...else` statements are unstable'.
      85f81ba6
  4. Aug 02, 2024
  5. Aug 01, 2024
    • Arthur Cohen's avatar
      gccrs: format-args: Start storing string in Rust memory · 9b540c42
      Arthur Cohen authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-fmt.cc (ffi::RustHamster::to_string): New.
      	(Pieces::collect): Adapt to use new handle API.
      	(Pieces::~Pieces): Likewise.
      	(Pieces::Pieces): Likewise.
      	(Pieces::operator=): Likewise.
      	* ast/rust-fmt.h (struct RustString): Add members.
      	(struct FormatArgsHandle): New.
      	(clone_pieces): Adapt for new FFI API.
      	(destroy_pieces): Likewise.
      	(struct Pieces): Store new FormatArgsHandle type.
      	* expand/rust-expand-format-args.cc (expand_format_args): Use proper
      	namespace.
      	* resolve/rust-ast-resolve-base.cc (ResolverBase::visit): FormatArgs
      	nodes are already resolved, so do nothing.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/src/lib.rs: Use new Handle struct and expose it.
      9b540c42
    • Arthur Cohen's avatar
      gccrs: format-args: Fix Rust interface and add input parsing. · 68cb878c
      Arthur Cohen authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-ast.cc: Make FormatArgs inherit from AST::Expr
      	* ast/rust-builtin-ast-nodes.h: Improve FormatArg* nodes and helpers.
      	* ast/rust-fmt.cc (Pieces::collect): Fix interface to match FFI function.
      	* ast/rust-fmt.h (collect_pieces): Likewise.
      	(struct Pieces): Add append_newline parameter.
      	* expand/rust-macro-builtins.cc: Add proper parsing of format_args
      	input.
      	* hir/rust-ast-lower-base.cc: Include diagnostics header.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/src/lib.rs: Switch interface to use more parser
      	parameters.
      	* libformat_parser/src/bin.rs: Use new interface.
      68cb878c
    • Arthur Cohen's avatar
      gccrs: format-parser: Add `is_some_and` method for Option<T> · 433fbb15
      Arthur Cohen authored
      Workaround for Ubuntu 18.04, since we still use it for the GCC 4.8 CI.
      The default Rust package is 1.65 (and unlikely to change I assume?),
      but the generic format parser library uses `is_some_and` which was
      introduced in 1.70. So this is a simple reimplementation, directly taken
      from the standard library sources.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/generic_format_parser/src/lib.rs: Add IsSomeAnd<T>
      	trait, impl it for Option<T>.
      433fbb15
    • Arthur Cohen's avatar
      gccrs: libformat_parser: Fix Rust warnings. · f7dafa7d
      Arthur Cohen authored
      libgrust/ChangeLog:
      
      	* libformat_parser/generic_format_parser/src/lib.rs: Remove
      	unused deprecated attribute and unused import.
      	* libformat_parser/src/lib.rs: Remove unused import.
      f7dafa7d
    • Arthur Cohen's avatar
      gccrs: rust-fmt: Store parsed string in Pieces struct · 0f966850
      Arthur Cohen authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-fmt.cc (Pieces::collect): Fix signature to take ownership
      	of the given string.
      	* ast/rust-fmt.h (struct Pieces): Store parsed string in the struct.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/src/lib.rs: Add debug prompt.
      0f966850
    • Arthur Cohen's avatar
      gccrs: libformat_parser: Send boxed values across FFI properly · 6e04e69b
      Arthur Cohen authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-fmt.cc (Pieces::~Pieces): Call libformat_parser's release
      	function in destructor.
      	* ast/rust-fmt.h (struct PieceSlice): Add capacity.
      	(destroy_pieces): New.
      	(struct Pieces): Add destructor.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/src/lib.rs: Leak Boxes properly for C++ to
      	see them, add memory release function.
      6e04e69b
    • Arthur Cohen's avatar
      gccrs: libformat_parser: Update header and remove old interface · d6332141
      Arthur Cohen authored
      gcc/rust/ChangeLog:
      
      	* ast/rust-fmt.cc (Pieces::collect): Use new Pieces API.
      	* ast/rust-fmt.h: Update interface with new FFI bindings.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/src/lib.rs: Add IntoFFI trait.
      	* libformat_parser/libformat-parser.h: Removed.
      d6332141
    • Arthur Cohen's avatar
      gccrs: libformat_parser: Start experimenting with cbindgen · 6a7d0e5d
      Arthur Cohen authored
      libgrust/ChangeLog:
      
      	* libformat_parser/cbindgen.toml: New file.
      	* libformat_parser/libformat-parser.h: New file.
      
      gcc/rust/ChangeLog:
      
      	* ast/rust-fmt.h: Add remaining FFI types.
      6a7d0e5d
    • Arthur Cohen's avatar
      gccrs: libformat_parser: Add FFI safe interface · 8647682e
      Arthur Cohen authored
      libgrust/ChangeLog:
      
      	* libformat_parser/generic_format_parser/src/lib.rs: Add generic
      	library.
      	* libformat_parser/src/lib.rs: Add base for FFI interface.
      8647682e
    • Thomas Schwinge's avatar
      Rust: Move 'libformat_parser' build into libgrust · 8e284d02
      Thomas Schwinge authored
      Addresses #2883.
      
      	contrib/
      	* gcc_update (files_and_dependencies): Update for
      	'libformat_parser' in libgrust.
      	gcc/rust/
      	* Make-lang.in (LIBFORMAT_PARSER): Point to 'libformat_parser'
      	build in libgrust.
      	(%.toml:, $(LIBFORMAT_PARSER):): Remove.
      	libgrust/
      	* libformat_parser/Makefile.am: New.
      	* Makefile.am [!TARGET_LIBRARY] (SUBDIRS): Add 'libformat_parser'.
      	* configure.ac: Handle it.
      	(TARGET_LIBRARY): New 'AM_CONDITIONAL'.
      	* libformat_parser/Makefile.in: Generate.
      	* Makefile.in: Regenerate.
      	* configure: Likewise.
      8e284d02
    • Arthur Cohen's avatar
      gccrs: libgrust: Vendor Rust dependencies · 7e1d64a5
      Arthur Cohen authored
      This commits vendors and locks our dependencies so that our Rust components
      do not need internet access to be built anymore. Tested in a docker container
      with no network access.
      
      We can think about merging the vendor directory once we have more than one
      Rust component, e.g. when we add polonius to the mix.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/.cargo/config: New file.
      	* libformat_parser/vendor.NOTES: New file.
      	* libformat_parser/vendor/libc/.cargo-checksum.json: New file.
      	* libformat_parser/vendor/libc/CONTRIBUTING.md: New file.
      	* libformat_parser/vendor/libc/Cargo.toml: New file.
      	* libformat_parser/vendor/libc/LICENSE-APACHE: New file.
      	* libformat_parser/vendor/libc/LICENSE-MIT: New file.
      	* libformat_parser/vendor/libc/README.md: New file.
      	* libformat_parser/vendor/libc/build.rs: New file.
      	* libformat_parser/vendor/libc/rustfmt.toml: New file.
      	* libformat_parser/vendor/libc/src/fixed_width_ints.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/align.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/riscv64.rs: New file.
      	* libformat_parser/vendor/libc/src/fuchsia/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/hermit/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/hermit/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/hermit/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/lib.rs: New file.
      	* libformat_parser/vendor/libc/src/macros.rs: New file.
      	* libformat_parser/vendor/libc/src/psp.rs: New file.
      	* libformat_parser/vendor/libc/src/sgx.rs: New file.
      	* libformat_parser/vendor/libc/src/solid/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/solid/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/solid/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/switch.rs: New file.
      	* libformat_parser/vendor/libc/src/teeos/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/aix/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/aix/powerpc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/aarch64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/b64/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/long_array.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/apple/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/errno.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/dragonfly/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd11/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd12/x86_64.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd13/x86_64.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd14/x86_64.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/freebsd15/x86_64.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/powerpc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/riscv64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/freebsd/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/freebsdlike/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mips.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/riscv64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/sparc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/netbsd/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mips64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/powerpc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/riscv64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/sparc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/bsd/netbsdlike/openbsd/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/haiku/b32.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/haiku/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/haiku/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/haiku/native.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/haiku/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/hurd/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/hurd/b32.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/hurd/b64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/hurd/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/hurd/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b32/x86/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/int128.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/aarch64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/riscv64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/b64/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/android/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/lfs64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/emscripten/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/generic/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mips/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/powerpc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/arch/sparc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/arm/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/csky/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/m68k/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mips/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/riscv32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b32/x86/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/fallback.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/ilp32.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/int128.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/lp64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/aarch64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/loongarch64/mod.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mips64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/riscv64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/s390x.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/not_x32.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/b64/x86_64/x32.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/gnu/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/arm/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/hexagon.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mips/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/riscv32/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b32/x86/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/int128.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/aarch64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mips64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/powerpc64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/riscv64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/s390x.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/b64/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/lfs64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/musl/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/non_exhaustive.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/arm/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/mod.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips32/no_align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/mod.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mips64/no_align.rs:
      	New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mips/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/l4re.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/linux/uclibc/x86_64/other.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/linux_like/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/aarch64/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/arm/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/espidf/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/generic.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/horizon/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/powerpc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/newlib/vita/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/no_align.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/nto/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/nto/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/nto/neutrino.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/nto/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/redox/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/compat.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/illumos.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/solaris.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/x86.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/unix/solarish/x86_common.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/aarch64.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/arm.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/powerpc.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/powerpc64.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/x86.rs: New file.
      	* libformat_parser/vendor/libc/src/vxworks/x86_64.rs: New file.
      	* libformat_parser/vendor/libc/src/wasi.rs: New file.
      	* libformat_parser/vendor/libc/src/windows/gnu/align.rs: New file.
      	* libformat_parser/vendor/libc/src/windows/gnu/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/windows/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/windows/msvc/mod.rs: New file.
      	* libformat_parser/vendor/libc/src/xous.rs: New file.
      	* libformat_parser/vendor/libc/tests/const_fn.rs: New file.
      	* libformat_parser/vendor/unicode-xid/.cargo-checksum.json: New file.
      	* libformat_parser/vendor/unicode-xid/COPYRIGHT: New file.
      	* libformat_parser/vendor/unicode-xid/Cargo.toml: New file.
      	* libformat_parser/vendor/unicode-xid/LICENSE-APACHE: New file.
      	* libformat_parser/vendor/unicode-xid/LICENSE-MIT: New file.
      	* libformat_parser/vendor/unicode-xid/README.md: New file.
      	* libformat_parser/vendor/unicode-xid/benches/xid.rs: New file.
      	* libformat_parser/vendor/unicode-xid/src/lib.rs: New file.
      	* libformat_parser/vendor/unicode-xid/src/tables.rs: New file.
      	* libformat_parser/vendor/unicode-xid/src/tests.rs: New file.
      	* libformat_parser/vendor/unicode-xid/tests/exhaustive_tests.rs: New file.
      7e1d64a5
    • Arthur Cohen's avatar
      gccrs: libgrust: Add format_parser library · 6fef4d6f
      Arthur Cohen authored
      Compile libformat_parser and link to it.
      
      gcc/rust/ChangeLog:
      
      	* Make-lang.in: Compile libformat_parser.
      	* ast/rust-fmt.cc: New FFI definitions.
      	* ast/rust-fmt.h: Likewise.
      	* expand/rust-macro-builtins.cc (MacroBuiltin::format_args_handler): Call
      	into libformat_parser.
      	* expand/rust-macro-builtins.h: Define format_args!() handler proper.
      
      libgrust/ChangeLog:
      
      	* libformat_parser/Cargo.lock: New file.
      	* libformat_parser/Cargo.toml: New file.
      	* libformat_parser/generic_format_parser/Cargo.toml: New file.
      	* libformat_parser/generic_format_parser/src/lib.rs: New file.
      	* libformat_parser/src/bin.rs: New file.
      	* libformat_parser/src/lib.rs: New file.
      6fef4d6f
  6. Feb 21, 2024
  7. Jan 17, 2024
  8. Jan 16, 2024
    • Pierre-Emmanuel Patry's avatar
      gccrs: Add an explicit value to proc macro enum kind · 10699fb3
      Pierre-Emmanuel Patry authored
      
      We'll need this value in the final binary, it should therefore be kept
      explicit.
      
      libgrust/ChangeLog:
      
      	* libproc_macro_internal/proc_macro.h (enum ProcmacroTag): Add
      	explicit value for proc macro tag enum.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      10699fb3
    • Pierre-Emmanuel Patry's avatar
      gccrs: Add license text to libproc_macro rust interface · 0a221966
      Pierre-Emmanuel Patry authored
      
      The license text was missing in rust files producing the libproc_macro
      interface to the libproc_macro_internal library.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/bridge.rs: Add license text.
      	* libproc_macro/bridge/ffistring.rs: Likewise.
      	* libproc_macro/bridge/group.rs: Likewise.
      	* libproc_macro/bridge/ident.rs: Likewise.
      	* libproc_macro/bridge/literal.rs: Likewise.
      	* libproc_macro/bridge/punct.rs: Likewise.
      	* libproc_macro/bridge/span.rs: Likewise.
      	* libproc_macro/bridge/token_stream.rs: Likewise.
      	* libproc_macro/group.rs: Likewise.
      	* libproc_macro/ident.rs: Likewise.
      	* libproc_macro/lib.rs: Likewise.
      	* libproc_macro/literal.rs: Likewise.
      	* libproc_macro/punct.rs: Likewise.
      	* libproc_macro/span.rs: Likewise.
      	* libproc_macro/token_stream.rs: Likewise.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      0a221966
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Split c++ and rust · b1c722d1
      Pierre-Emmanuel Patry authored
      
      Move the rust interface to the libproc_macro directory.
      
      libgrust/ChangeLog:
      
      	* libproc_macro_internal/rust/bridge.rs: Moved to...
      	* libproc_macro/bridge.rs: ...here.
      	* libproc_macro_internal/rust/bridge/ffistring.rs: Moved to...
      	* libproc_macro/bridge/ffistring.rs: ...here.
      	* libproc_macro_internal/rust/bridge/group.rs: Moved to...
      	* libproc_macro/bridge/group.rs: ...here.
      	* libproc_macro_internal/rust/bridge/ident.rs: Moved to...
      	* libproc_macro/bridge/ident.rs: ...here.
      	* libproc_macro_internal/rust/bridge/literal.rs: Moved to...
      	* libproc_macro/bridge/literal.rs: ...here.
      	* libproc_macro_internal/rust/bridge/punct.rs: Moved to...
      	* libproc_macro/bridge/punct.rs: ...here.
      	* libproc_macro_internal/rust/bridge/span.rs: Moved to...
      	* libproc_macro/bridge/span.rs: ...here.
      	* libproc_macro_internal/rust/bridge/token_stream.rs: Moved to...
      	* libproc_macro/bridge/token_stream.rs: ...here.
      	* libproc_macro_internal/rust/group.rs: Moved to...
      	* libproc_macro/group.rs: ...here.
      	* libproc_macro_internal/rust/ident.rs: Moved to...
      	* libproc_macro/ident.rs: ...here.
      	* libproc_macro_internal/rust/lib.rs: Moved to...
      	* libproc_macro/lib.rs: ...here.
      	* libproc_macro_internal/rust/literal.rs: Moved to...
      	* libproc_macro/literal.rs: ...here.
      	* libproc_macro_internal/rust/punct.rs: Moved to...
      	* libproc_macro/punct.rs: ...here.
      	* libproc_macro_internal/rust/span.rs: Moved to...
      	* libproc_macro/span.rs: ...here.
      	* libproc_macro_internal/rust/token_stream.rs: Moved to...
      	* libproc_macro/token_stream.rs: ...here.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      b1c722d1
    • Pierre-Emmanuel Patry's avatar
      gccrs: Rename libproc_macro to libproc_macro_internal · fd73cf8c
      Pierre-Emmanuel Patry authored
      
      The name was a bit misleading since libproc_macro is a rust library that
      should we should be able to link against some rust code. This cpp
      library was the layer below the libproc_macro library, the "real" gcc
      libproc_macro act as a translation layer for the internal library.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-macro-expand.h: Change include directive with the
      	new name.
      	* expand/rust-proc-macro.h (RUST_PROC_MACRO_H): Likewise.
      	* util/rust-hir-map.h: Likewise.
      	* util/rust-token-converter.h: Likewise.
      	* util/rust-token-converter.cc: Remove useless include
      	directive.
      	* Make-lang.in: Rename library.
      
      libgrust/ChangeLog:
      
      	* Makefile.am: Change library name.
      	* Makefile.in: Likewise.
      	* configure.ac: Likewise.
      	* configure: Regenerate.
      	* libproc_macro/Makefile.am: Moved to...
      	* libproc_macro_internal/Makefile.am: ...here.
      	* libproc_macro/Makefile.in: Moved to...
      	* libproc_macro_internal/Makefile.in: ...here.
      	* libproc_macro/bridge.h: Moved to...
      	* libproc_macro_internal/bridge.h: ...here.
      	* libproc_macro/ffistring.cc: Moved to...
      	* libproc_macro_internal/ffistring.cc: ...here.
      	* libproc_macro/ffistring.h: Moved to...
      	* libproc_macro_internal/ffistring.h: ...here.
      	* libproc_macro/group.cc: Moved to...
      	* libproc_macro_internal/group.cc: ...here.
      	* libproc_macro/group.h: Moved to...
      	* libproc_macro_internal/group.h: ...here.
      	* libproc_macro/ident.cc: Moved to...
      	* libproc_macro_internal/ident.cc: ...here.
      	* libproc_macro/ident.h: Moved to...
      	* libproc_macro_internal/ident.h: ...here.
      	* libproc_macro/literal.cc: Moved to...
      	* libproc_macro_internal/literal.cc: ...here.
      	* libproc_macro/literal.h: Moved to...
      	* libproc_macro_internal/literal.h: ...here.
      	* libproc_macro/proc_macro.cc: Moved to...
      	* libproc_macro_internal/proc_macro.cc: ...here.
      	* libproc_macro/proc_macro.h: Moved to...
      	* libproc_macro_internal/proc_macro.h: ...here.
      	* libproc_macro/punct.cc: Moved to...
      	* libproc_macro_internal/punct.cc: ...here.
      	* libproc_macro/punct.h: Moved to...
      	* libproc_macro_internal/punct.h: ...here.
      	* libproc_macro/registration.h: Moved to...
      	* libproc_macro_internal/registration.h: ...here.
      	* libproc_macro/rust/bridge.rs: Moved to...
      	* libproc_macro_internal/rust/bridge.rs: ...here.
      	* libproc_macro/rust/bridge/ffistring.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/ffistring.rs: ...here.
      	* libproc_macro/rust/bridge/group.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/group.rs: ...here.
      	* libproc_macro/rust/bridge/ident.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/ident.rs: ...here.
      	* libproc_macro/rust/bridge/literal.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/literal.rs: ...here.
      	* libproc_macro/rust/bridge/punct.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/punct.rs: ...here.
      	* libproc_macro/rust/bridge/span.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/span.rs: ...here.
      	* libproc_macro/rust/bridge/token_stream.rs: Moved to...
      	* libproc_macro_internal/rust/bridge/token_stream.rs: ...here.
      	* libproc_macro/rust/group.rs: Moved to...
      	* libproc_macro_internal/rust/group.rs: ...here.
      	* libproc_macro/rust/ident.rs: Moved to...
      	* libproc_macro_internal/rust/ident.rs: ...here.
      	* libproc_macro/rust/lib.rs: Moved to...
      	* libproc_macro_internal/rust/lib.rs: ...here.
      	* libproc_macro/rust/literal.rs: Moved to...
      	* libproc_macro_internal/rust/literal.rs: ...here.
      	* libproc_macro/rust/punct.rs: Moved to...
      	* libproc_macro_internal/rust/punct.rs: ...here.
      	* libproc_macro/rust/span.rs: Moved to...
      	* libproc_macro_internal/rust/span.rs: ...here.
      	* libproc_macro/rust/token_stream.rs: Moved to...
      	* libproc_macro_internal/rust/token_stream.rs: ...here.
      	* libproc_macro/span.cc: Moved to...
      	* libproc_macro_internal/span.cc: ...here.
      	* libproc_macro/span.h: Moved to...
      	* libproc_macro_internal/span.h: ...here.
      	* libproc_macro/tokenstream.cc: Moved to...
      	* libproc_macro_internal/tokenstream.cc: ...here.
      	* libproc_macro/tokenstream.h: Moved to...
      	* libproc_macro_internal/tokenstream.h: ...here.
      	* libproc_macro/tokentree.cc: Moved to...
      	* libproc_macro_internal/tokentree.cc: ...here.
      	* libproc_macro/tokentree.h: Moved to...
      	* libproc_macro_internal/tokentree.h: ...here.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      fd73cf8c
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Add literal_from_string callback · 0680907b
      Pierre-Emmanuel Patry authored
      
      The function to get a literal from a string missed an implementation.
      It did require a conversion function to achieve it, now that callback
      system has been merged this function can be easily implemented.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-proc-macro.cc (literal_from_string): Add callback
      	function.
      	(load_macros_array): Likewise.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/literal.cc (Literal__from_string): Add
      	implementation with call to constructor.
      	(Literal::make_literal): Add new constructor which calls the
      	callback.
      	* libproc_macro/literal.h: Add new constructor's
      	prototype.
      	* libproc_macro/proc_macro.cc (bridge_is_available):
      	Change symbol name to match convention.
      	* libproc_macro/registration.h: Add lit_from_str
      	symbol.
      	* libproc_macro/tokenstream.cc (TokenStream::make_tokenstream):
      	Change symbol name to disambiguate with literal from string.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      0680907b
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Remove useless typedef · 6e5d6c3f
      Pierre-Emmanuel Patry authored
      
      Initially a typedef was used to easily get the callback function pointer
      type. Since this type has changed to a simpler well defined type, this
      using declaration has no more purpose.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc: Remove type alias.
      	* libproc_macro/registration.h: Likewise.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      6e5d6c3f
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Delete unused prototype · ea0bd46e
      Pierre-Emmanuel Patry authored
      
      This function prototype was forgotten when the function was deleted.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.h (proc_macro_register_from_str):
      	Remove rogue function prototype.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      ea0bd46e
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Remode function indirection · 8db58652
      Pierre-Emmanuel Patry authored
      
      There was no need to register a function when the value could be
      registered directly.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-proc-macro.cc (available): Remove function.
      	(load_macros_array): There was no need for an indirection here.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc (not_available): Remove
      	function.
      	* libproc_macro/proc_macro.h (not_available): Remove
      	function prototype.
      	* libproc_macro/registration.h: Change symbol type.
      	* libproc_macro/bridge.h: New file.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      8db58652
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Add is_available function · ce094747
      Pierre-Emmanuel Patry authored
      
      Add is_available function to the C++ library.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc (bridge_is_available):
      	Add bridge function.
      	* libproc_macro/proc_macro.h (bridge_is_available):
      	Likewise.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      ce094747
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Add is_available callback · c0763eac
      Pierre-Emmanuel Patry authored
      
      Add a callback from gcc to determine wether the bridge is available or
      not.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-proc-macro.cc (available): Add symbol
      	registration.
      	(load_macros_array): Likewise.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc (not_available): Add a
      	function to express bridge unavailability.
      	* libproc_macro/proc_macro.h (not_available): Likewise.
      	* libproc_macro/registration.h: Add symbol type.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      c0763eac
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Rename from_string callback symbol · b190aaef
      Pierre-Emmanuel Patry authored
      
      The symbol had a different convention from rust standard naming
      convention (?) hence the change before adding new callback.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-proc-macro.cc (load_macros_array): Symbol rename.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc (Procmacro::make_bang):
      	Change symbol name.
      	* libproc_macro/registration.h: Likewise.
      	* libproc_macro/tokenstream.cc (TokenStream::make_tokenstream): Likewise.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      b190aaef
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Mirror FFIString changes in C++library · 973f4088
      Pierre-Emmanuel Patry authored
      
      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: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      973f4088
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Increase FFIString usage · f00f3837
      Pierre-Emmanuel Patry authored
      
      Two remaining structures in the rust interface were still using raw
      string pointer and length couples to communicate with the C++ library
      throught extern C functions. Using FFIString instead allow us to reduce
      the scope of potential errors using those raw pointers. As FFIString
      encapsulate raw pointer operations there will be only one locaiton to
      look after.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/rust/bridge/literal.rs: Change extern C
      	function argument from raw string pointer and length to
      	FFIString.
      	* libproc_macro/rust/bridge/token_stream.rs: Likewise.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      f00f3837
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Change rust Ident definition · 43208b6c
      Pierre-Emmanuel Patry authored
      
      Change rust interface Ident definition to match C++ struct definition.
      This structure now uses an FFIString instead of raw pointers.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/rust/bridge/ident.rs: Change raw
      	pointer string with an FFIString.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      43208b6c
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Change Ident structure · f7af0b90
      Pierre-Emmanuel Patry authored
      
      Use FFIString in Ident structure rather that a raw pointer and a
      length, this will reduce the size of the code dealing with raw
      pointers. Which should prevent some error.
      
      gcc/rust/ChangeLog:
      
      	* util/rust-token-converter.cc (from_ident): Adapt code to new
      	constructor.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/ident.cc (Ident__new): Constructor
      	accepts an FFIString now.
      	(Ident__new_raw): Likewise.
      	(Ident::clone): Internal members change means clone also change.
      	(Ident::make_ident): Change constructor call.
      	(Ident::drop): Add call to FFIString::clone.
      	* libproc_macro/ident.h (struct Ident): Remove raw
      	pointer and length, add an FFIString inside instead.
      	(Ident__new): Change constructor.
      	(Ident__new_raw): Change constructor.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      f7af0b90
    • Pierre-Emmanuel Patry's avatar
      gccrs: proc_macro: Add from string implementation · bee12555
      Pierre-Emmanuel Patry authored
      
      Add a callback registration function into the proc macro library so the
      compiler can register it's own lexing/parsing functions on load.
      
      gcc/rust/ChangeLog:
      
      	* expand/rust-proc-macro.cc (tokenstream_from_string): Add a
      	function that creates a tokenstream from a given string.
      	(load_macros_array): Add call to registration function.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.cc (proc_macro_register_from_str):
      	Add registration function.
      	* libproc_macro/proc_macro.h (proc_macro_register_from_str):
      	Add registration function prototype.
      	* libproc_macro/tokenstream.cc (TokenStream::make_tokenstream):
      	Add a new constructor from a string that uses the registered
      	callback.
      	(TokenStream__from_string): Add call to new constructor.
      	* libproc_macro/tokenstream.h: Add registration
      	declaration.
      	* libproc_macro/registration.h: New file.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      bee12555
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Fix Tokenstream growth · cf58150b
      Pierre-Emmanuel Patry authored
      
      TokenStream did not copy back enough old data to the new location. This
      commit also add more explicit memcpy usages in order to facilitate
      change to utf-8 later.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/ffistring.cc (FFIString::make_ffistring):
      	Add explicit sizeof and utf-8 warning.
      	(FFIString::clone): Add explicit sizeof and utf-8 warning.
      	* libproc_macro/ident.cc (Ident::clone): Likewise.
      	(Ident::make_ident): Likewise.
      	* libproc_macro/tokenstream.cc (TokenStream::grow):
      	Fix vector growth.
      	(TokenStream__clone): Add explicit sizeof.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      cf58150b
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Fix capacity update in tokenstream · 22ba7ea9
      Pierre-Emmanuel Patry authored
      
      The capacity was not updated on tokenstream grow. This commit also add a
      new mechanism to prevent a tokenstream to grow with a zero delta capacity.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/tokenstream.cc (TokenStream::grow): Add
      	minimum growing capacity.
      	(TokenStream::push): Change condition.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      22ba7ea9
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Rename Procmacro subtypes · f8880772
      Pierre-Emmanuel Patry authored
      
      Rename procedural macro specializations without the "payload" suffix.
      Those types will be reused in several places where the old suffix might
      be counterintuitive.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.h (struct CustomDerivePayload):
      	Rename from CustomDerivePayload to...
      	(struct CustomDerive): ... CustomDerive
      	(struct AttrPayload): Rename from AttrPayload to ...
      	(struct Attribute): ... Attribute
      	(struct BangPayload): Rename from BangPayload to ...
      	(struct Bang): ... Bang
      	(union ProcmacroPayload): Update union with new names.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      f8880772
    • Pierre-Emmanuel Patry's avatar
      gccrs: libproc_macro: Add procmacro array definition · 4ca2f203
      Pierre-Emmanuel Patry authored
      
      Standard types do not guarantee anything about their ABI and are
      therefore unconvenient to use as a primarily exposed container.
      With such asumption this commit introduces a container.
      
      libgrust/ChangeLog:
      
      	* libproc_macro/proc_macro.h (struct ProcmacroArray):
      	Add ProcmacroArray definition.
      
      Signed-off-by: default avatarPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
      4ca2f203
Loading