]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: expand: Add parser for offset_of!() and builtin resolution.
authorArthur Cohen <arthur.cohen@embecosm.com>
Thu, 24 Jul 2025 09:32:43 +0000 (11:32 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 5 Aug 2025 14:36:59 +0000 (16:36 +0200)
commit689f2ffb73cac20d5f0c64b50625573a46305392
treeef44bdfbd5cbdf3a362fefb0244ca2747ec932e0
parentaa57360f2631fb5a90bdf2976ec2bba35e962cc1
gccrs: expand: Add parser for offset_of!() and builtin resolution.

gcc/rust/ChangeLog:

* Make-lang.in: Compile the offset_of handler.
* lang.opt: Add -frust-assume-builtin-offset-of option.
* ast/rust-ast.h: Add has_str() for const_TokenPtr.
* expand/rust-macro-builtins.cc: Map offset_of as builtin.
* expand/rust-macro-builtins.h: Declare it.
* expand/rust-macro-expand.cc (MacroExpander::expand_invoc): Add hack for calling builtin
offset_of!().
* resolve/rust-early-name-resolver-2.0.cc (Early::visit):  Likewise.
* expand/rust-macro-builtins-offset-of.cc: New file.

gcc/testsuite/ChangeLog:

* rust/compile/offset_of1.rs: New test.
gcc/rust/Make-lang.in
gcc/rust/ast/rust-ast.h
gcc/rust/expand/rust-macro-builtins-offset-of.cc [new file with mode: 0644]
gcc/rust/expand/rust-macro-builtins.cc
gcc/rust/expand/rust-macro-builtins.h
gcc/rust/expand/rust-macro-expand.cc
gcc/rust/lang.opt
gcc/rust/resolve/rust-early-name-resolver-2.0.cc
gcc/testsuite/rust/compile/offset_of1.rs [new file with mode: 0644]