From: Owen Avery Date: Fri, 18 Aug 2023 21:01:34 +0000 (-0400) Subject: gccrs: Handle gengtype annotations in backend/rust-tree.{cc,h} X-Git-Tag: basepoints/gcc-15~2192 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9048f08f4e94594b837290ac26f3a5bbeb47f2c3;p=thirdparty%2Fgcc.git gccrs: Handle gengtype annotations in backend/rust-tree.{cc,h} gcc/rust/ChangeLog: * config-lang.in: Add "backend/rust-tree.h" and "backend/rust-tree.h" to gtfiles. * backend/rust-tree.cc: Include new header generated by gengtype. * backend/rust-tree.h (struct language_function): Add TODO. * rust-lang.cc: Include "rust-tree.h". (struct lang_type): Remove duplicate definition. (struct lang_decl): Likewise. (struct lang_identifier): Likewise. (struct language_function): Likewise. Signed-off-by: Owen Avery --- diff --git a/gcc/rust/backend/rust-tree.cc b/gcc/rust/backend/rust-tree.cc index 16023ff322c6..2a5ffcbf8956 100644 --- a/gcc/rust/backend/rust-tree.cc +++ b/gcc/rust/backend/rust-tree.cc @@ -6207,3 +6207,7 @@ array_string_literal_compatible_p (tree type, tree init) } } // namespace Rust + +using namespace Rust; + +#include "gt-rust-rust-tree.h" diff --git a/gcc/rust/backend/rust-tree.h b/gcc/rust/backend/rust-tree.h index dd3b611d53f4..26c8b653ac64 100644 --- a/gcc/rust/backend/rust-tree.h +++ b/gcc/rust/backend/rust-tree.h @@ -2289,7 +2289,8 @@ struct rust_named_label_hash : ggc_remove // forked from gcc/cp/cp-tree.h -/* Global state pertinent to the current function. */ +/* Global state pertinent to the current function. + TODO: remove vestigial fields */ struct GTY (()) language_function { diff --git a/gcc/rust/config-lang.in b/gcc/rust/config-lang.in index 3e9af1cc7c8d..6221ff451286 100644 --- a/gcc/rust/config-lang.in +++ b/gcc/rust/config-lang.in @@ -32,4 +32,7 @@ build_by_default="no" target_libs="target-libgrust" lang_dirs=libgrust -gtfiles="\$(srcdir)/rust/rust-lang.cc \$(srcdir)/rust/backend/rust-constexpr.cc" +gtfiles="\ +\$(srcdir)/rust/rust-lang.cc \$(srcdir)/rust/backend/rust-constexpr.cc \ +\$(srcdir)/rust/backend/rust-tree.h \$(srcdir)/rust/backend/rust-tree.cc \ +" diff --git a/gcc/rust/rust-lang.cc b/gcc/rust/rust-lang.cc index 6d40cc0697df..f9bec3f7c1e1 100644 --- a/gcc/rust/rust-lang.cc +++ b/gcc/rust/rust-lang.cc @@ -65,23 +65,7 @@ */ #include "rust-session-manager.h" - -// Language-dependent contents of a type. GTY() mark used for garbage collector. -struct GTY (()) lang_type -{ -}; - -// Language-dependent contents of a decl. -struct GTY (()) lang_decl -{ -}; - -// Language-dependent contents of an identifier. This must include a -// tree_identifier. -struct GTY (()) lang_identifier -{ - struct tree_identifier common; -}; +#include "rust-tree.h" // The resulting tree type. union GTY (( @@ -95,11 +79,6 @@ union GTY (( struct lang_identifier GTY ((tag ("1"))) identifier; }; -// We don't use language_function. -struct GTY (()) language_function -{ -}; - // has to be in same compilation unit as session, so here for now void rust_add_target_info (const char *key, const char *value)