aboutsummaryrefslogtreecommitdiff
path: root/libgrust
AgeCommit message (Collapse)AuthorFilesLines
2025-08-06Daily bump.GCC Administrator1-0/+17
2025-08-05gccrs: Reindent using last clang-format configurationMarc Poulhiès5-28/+14
It changes declaration and switch case indentation to follow GNU coding style. gcc/rust/ChangeLog: * ast/rust-ast-builder-type.cc (ASTTypeBuilder::visit): Reindent. * ast/rust-ast-builder.cc (Builder::new_generic_args): Likewise. * ast/rust-ast-collector.cc (TokenCollector::visit): Likewise. * ast/rust-ast-dump.h (debug): Likewise. * ast/rust-ast-formatting.h (indent_spaces): Likewise. (get_string_in_delims): Likewise. (get_mode_dump_desc): Likewise. (append_attributes): Likewise. (unquote_string): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Likewise. * ast/rust-ast.cc (Attribute::get_traits_to_derive): Likewise. (UseTreeGlob::as_string): Likewise. (UseTreeList::as_string): Likewise. (AttributeParser::parse_path_meta_item): Likewise. (FormatArgs::set_outer_attrs): Likewise. * ast/rust-ast.h (operator<<): Likewise. * ast/rust-cond-compilation.h: Likewise. * ast/rust-desugar-apit.cc: Likewise. * ast/rust-fmt.h (collect_pieces): Likewise. (clone_pieces): Likewise. * ast/rust-pattern.h (tokenid_to_rangekind): Likewise. * backend/rust-compile-context.cc (Context::type_hasher): Likewise. * backend/rust-compile-expr.cc (CompileExpr::visit): Likewise. * backend/rust-compile-intrinsic.cc (get_identifier): Likewise. (offset_handler): Likewise. (sizeof_handler): Likewise. (transmute_handler): Likewise. (rotate_handler): Likewise. (wrapping_op_handler_inner): Likewise. (op_with_overflow_inner): Likewise. (uninit_handler): Likewise. (move_val_init_handler): Likewise. (assume_handler): Likewise. (discriminant_value_handler): Likewise. (variant_count_handler): Likewise. (prefetch_data_handler): Likewise. (atomic_store_handler_inner): Likewise. (atomic_load_handler_inner): Likewise. (unchecked_op_inner): Likewise. (copy_handler_inner): Likewise. (expect_handler_inner): Likewise. (try_handler_inner): Likewise. * backend/rust-compile-pattern.cc (compile_range_pattern_bound): Likewise. (CompilePatternCheckExpr::visit): Likewise. (CompilePatternBindings::visit): Likewise. (CompilePatternLet::visit): Likewise. * backend/rust-compile-var-decl.h: Likewise. * backend/rust-constexpr.cc (verify_constant): Likewise. (find_array_ctor_elt): Likewise. (array_index_cmp): Likewise. (potential_constant_expression_1): Likewise. (unshare_constructor): Likewise. (maybe_save_constexpr_fundef): Likewise. (returns): Likewise. (breaks): Likewise. (continues): Likewise. (switches): Likewise. (constant_value_1): Likewise. (decl_constant_value): Likewise. (non_const_var_error): Likewise. (eval_constant_expression): Likewise. (constexpr_fn_retval): Likewise. (eval_store_expression): Likewise. (eval_call_expression): Likewise. (eval_binary_expression): Likewise. (get_function_named_in_call): Likewise. (eval_statement_list): Likewise. (extract_string_elt): Likewise. (eval_conditional_expression): Likewise. (eval_bit_field_ref): Likewise. (eval_loop_expr): Likewise. (eval_switch_expr): Likewise. (eval_unary_expression): Likewise. (get_or_insert_ctor_field): Likewise. (eval_and_check_array_index): Likewise. * backend/rust-constexpr.h (maybe_save_constexpr_fundef): Likewise. * backend/rust-mangle-v0.cc (v0_path): Likewise. (v0_complex_type_prefix): Likewise. * backend/rust-mangle.h (legacy_mangle_item): Likewise. (v0_mangle_item): Likewise. * backend/rust-tree.cc (convert_to_void): Likewise. (find_parameter_packs_r): Likewise. (rs_tree_equal): Likewise. (publicly_uniquely_derived_p): Likewise. (instantiation_dependent_expression_p): Likewise. (type_has_nontrivial_copy_init): Likewise. (is_normal_capture_proxy): Likewise. (is_bitfield_expr_with_lowered_type): Likewise. (undeduced_auto_decl): Likewise. (require_deduced_type): Likewise. (gt_pch_nx): Likewise. (lvalue_kind): Likewise. * backend/rust-tree.h (LANG_DECL_MIN_CHECK): Likewise. (LANG_DECL_FN_CHECK): Likewise. (LANG_DECL_NS_CHECK): Likewise. (LANG_DECL_PARM_CHECK): Likewise. (LANG_DECL_DECOMP_CHECK): Likewise. (resort_type_member_vec): Likewise. (convert_to_void): Likewise. (mark_discarded_use): Likewise. (mark_exp_read): Likewise. (mark_use): Likewise. (mark_rvalue_use): Likewise. (mark_lvalue_use): Likewise. (mark_lvalue_use_nonread): Likewise. (convert_from_reference): Likewise. (maybe_warn_nodiscard): Likewise. (expr_loc_or_loc): Likewise. (expr_loc_or_input_loc): Likewise. (get_fndecl_from_callee): Likewise. (pointer_offset_expression): Likewise. (is_empty_class): Likewise. (is_really_empty_class): Likewise. (rs_type_quals): Likewise. (init_modules): Likewise. (lookup_add): Likewise. (ovl_make): Likewise. (struct c_fileinfo): Likewise. (get_fileinfo): Likewise. (cxx_make_type): Likewise. (build_cplus_array_type): Likewise. (comptypes): Likewise. (rs_build_qualified_type_real): Likewise. (vector_targets_convertible_p): Likewise. (get_class_binding_direct): Likewise. (lang_check_failed): Likewise. (check_for_uninitialized_const_var): Likewise. (cp_fold_maybe_rvalue): Likewise. (fold_offsetof): Likewise. (fold_non_dependent_expr): Likewise. (in_immediate_context): Likewise. (cxx_mark_addressable): Likewise. (decl_constant_value): Likewise. (is_class_type): Likewise. (fold_builtin_is_pointer_inverconvertible_with_class): Likewise. (c_common_type_for_mode): Likewise. (next_common_initial_seqence): Likewise. (fold_builtin_is_corresponding_member): Likewise. (maybe_constant_value): Likewise. (rs_walk_subtrees): Likewise. (make_tree_vector): Likewise. (release_tree_vector): Likewise. (location_of): Likewise. (maybe_constant_init): Likewise. (explain_invalid_constexpr_fn): Likewise. (literal_type_p): Likewise. (maybe_constexpr_fn): Likewise. (fold_non_dependent_init): Likewise. * checks/errors/borrowck/polonius/rust-polonius.h (polonius_run): Likewise. (FFIVector__new): Likewise. (FFIVector__new_vec_pair): Likewise. (FFIVector__new_vec_triple): Likewise. (FFIVector__push): Likewise. (FFIVector__push_vec_triple): Likewise. * checks/errors/borrowck/rust-bir-builder-expr-stmt.cc (ExprStmtBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-builder-pattern.cc (PatternBindingBuilder::visit): Likewise. * checks/errors/borrowck/rust-bir-dump.cc (Dump::visit): Likewise. * checks/errors/borrowck/rust-bir-fact-collector.h (points): Likewise. * checks/errors/borrowck/rust-bir-place.h: Likewise. * checks/errors/borrowck/rust-bir-visitor.h: Likewise. * checks/errors/privacy/rust-privacy-check.cc (saw_errors): Likewise. * checks/errors/privacy/rust-privacy-ctx.h (rust_privacy_ctx_test): Likewise. * checks/errors/privacy/rust-privacy-reporter.cc (PrivacyReporter::check_for_privacy_violation): Likewise. (PrivacyReporter::check_base_type_privacy): Likewise. (PrivacyReporter::visit): Likewise. * checks/errors/privacy/rust-reachability.cc (ReachabilityVisitor::visit): Likewise. * checks/errors/privacy/rust-visibility-resolver.cc (VisibilityResolver::resolve_visibility): Likewise. * checks/errors/rust-hir-pattern-analysis.cc (Constructor::is_covered_by): Likewise. (PlaceInfo::specialize): Likewise. (WitnessPat::to_string): Likewise. (WitnessMatrix::apply_constructor): Likewise. (lower_pattern): Likewise. (lower_tuple_pattern): Likewise. (lower_struct_pattern): Likewise. * checks/errors/rust-hir-pattern-analysis.h (check_match_usefulness): Likewise. * expand/rust-cfg-strip.cc (CfgStrip::maybe_strip_generic_args): Likewise. * expand/rust-derive-eq.cc (DeriveEq::visit_enum): Likewise. * expand/rust-derive.cc: Likewise. * expand/rust-expand-format-args.cc (expand_format_args): Likewise. * expand/rust-expand-visitor.h (is_derive): Likewise. (is_builtin): Likewise. * expand/rust-macro-builtins-asm.cc (expand_inline_asm_strings): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. (check_identifier): Likewise. (check_and_set): Likewise. (parse_label): Likewise. (parse_llvm_outputs): Likewise. (parse_llvm_inputs): Likewise. (parse_llvm_clobbers): Likewise. (parse_llvm_options): Likewise. * expand/rust-macro-builtins-helpers.h (make_macro_path_str): Likewise. (make_token): Likewise. (make_string): Likewise. (macro_end_token): Likewise. (parse_single_string_literal): Likewise. (source_relative_path): Likewise. (load_file_bytes): Likewise. * expand/rust-macro-expand.cc (MacroExpander::match_fragment): Likewise. (MacroExpander::match_matcher): Likewise. (MacroExpander::match_n_matches): Likewise. * expand/rust-macro-substitute-ctx.cc (SubstituteCtx::substitute_token): Likewise. * expand/rust-proc-macro.h (load_macros): Likewise. (generate_proc_macro_decls_symbol): Likewise. * hir/rust-ast-lower-base.cc (ASTLoweringBase::lower_generic_args): Likewise. (ASTLoweringBase::lower_range_pattern_bound): Likewise. * hir/rust-ast-lower-item.cc (ASTLoweringItem::visit): Likewise. * hir/rust-ast-lower-pattern.cc (ASTLoweringPattern::visit): Likewise. * hir/rust-ast-lower.h (struct_field_name_exists): Likewise. (translate_visibility): Likewise. * hir/rust-hir-dump.cc (Dump::visit): Likewise. * hir/rust-hir-dump.h (debug): Likewise. * hir/tree/rust-hir.cc (UseTreeGlob::as_string): Likewise. (UseTreeList::as_string): Likewise. * lex/rust-lex.cc (Lexer::parse_escape): Likewise. (Lexer::parse_utf8_escape): Likewise. * lex/rust-lex.h (rust_input_source_test): Likewise. * lex/rust-token.cc (RS_TOKEN_KEYWORD_2015): Likewise. * lex/rust-token.h (get_token_description): Likewise. (token_id_to_str): Likewise. (token_id_is_keyword): Likewise. (token_id_keyword_string): Likewise. (get_type_hint_string): Likewise. (nfc_normalize_token_string): Likewise. * metadata/rust-export-metadata.cc (PublicInterface::write_to_path): Likewise. * metadata/rust-import-archive.cc: Likewise. * metadata/rust-imports.h (add_search_path): Likewise. * parse/rust-cfg-parser.h (parse_cfg_option): Likewise. (rust_cfg_parser_test): Likewise. * parse/rust-parse-impl.h (Parser::skip_generics_right_angle): Likewise. (Parser::parse_attr_input): Likewise. (Parser::parse_macro_match): Likewise. (Parser::parse_visibility): Likewise. (Parser::parse_module): Likewise. (Parser::parse_use_tree): Likewise. (Parser::parse_generic_param): Likewise. (Parser::parse_struct): Likewise. (Parser::parse_enum_item): Likewise. (Parser::parse_inherent_impl_item): Likewise. (Parser::parse_external_item): Likewise. (Parser::parse_generic_arg): Likewise. (Parser::parse_type_path_segment): Likewise. (Parser::parse_expr_stmt): Likewise. (Parser::parse_if_expr): Likewise. (Parser::parse_if_let_expr): Likewise. (Parser::parse_type): Likewise. (Parser::parse_for_prefixed_type): Likewise. (Parser::parse_slice_or_array_type): Likewise. (Parser::parse_type_no_bounds): Likewise. (Parser::parse_range_pattern_bound): Likewise. (Parser::parse_pattern_no_alt): Likewise. (Parser::parse_grouped_or_tuple_pattern): Likewise. (Parser::parse_ident_leading_pattern): Likewise. (Parser::parse_tuple_struct_items): Likewise. (Parser::parse_stmt_or_expr): Likewise. (Parser::parse_struct_expr_field): Likewise. (Parser::null_denotation): Likewise. (Parser::left_denotation): Likewise. (Parser::parse_closure_expr_pratt): Likewise. * parse/rust-parse.cc (peculiar_fragment_match_compatible): Likewise. (is_match_compatible): Likewise. * parse/rust-parse.h (extract_module_path): Likewise. (is_match_compatible): Likewise. * resolve/rust-ast-resolve-expr.cc (translate_operand): Likewise. * resolve/rust-ast-resolve-item.cc (flatten_glob): Likewise. (flatten_rebind): Likewise. (flatten_list): Likewise. (flatten): Likewise. * resolve/rust-ast-resolve-item.h (rust_simple_path_resolve_test): Likewise. * resolve/rust-ast-resolve-pattern.cc (PatternDeclaration::visit): Likewise. (resolve_range_pattern_bound): Likewise. * resolve/rust-ast-resolve-type.cc (ResolveRelativeTypePath::go): Likewise. (ResolveTypeToCanonicalPath::visit): Likewise. * resolve/rust-ast-resolve.cc (saw_errors): Likewise. * resolve/rust-early-name-resolver-2.0.cc (Early::finalize_rebind_import): Likewise. * resolve/rust-late-name-resolver-2.0.cc (Late::visit): Likewise. * resolve/rust-toplevel-name-resolver-2.0.cc (flatten_glob): Likewise. * rust-backend.h (init): Likewise. (debug): Likewise. (get_identifier_node): Likewise. (wchar_type): Likewise. (get_pointer_size): Likewise. (raw_str_type): Likewise. (integer_type): Likewise. (float_type): Likewise. (pointer_type): Likewise. (reference_type): Likewise. (immutable_type): Likewise. (function_type): Likewise. (function_type_variadic): Likewise. (function_ptr_type): Likewise. (struct_type): Likewise. (union_type): Likewise. (array_type): Likewise. (named_type): Likewise. (type_field_offset): Likewise. (var_expression): Likewise. (float_constant_expression): Likewise. (string_constant_expression): Likewise. (char_constant_expression): Likewise. (wchar_constant_expression): Likewise. (boolean_constant_expression): Likewise. (convert_expression): Likewise. (struct_field_expression): Likewise. (compound_expression): Likewise. (conditional_expression): Likewise. (negation_expression): Likewise. (arithmetic_or_logical_expression): Likewise. (arithmetic_or_logical_expression_checked): Likewise. (comparison_expression): Likewise. (lazy_boolean_expression): Likewise. (constructor_expression): Likewise. (array_constructor_expression): Likewise. (array_initializer): Likewise. (array_index_expression): Likewise. (call_expression): Likewise. (init_statement): Likewise. (assignment_statement): Likewise. (return_statement): Likewise. (if_statement): Likewise. (loop_expression): Likewise. (exit_expression): Likewise. (statement_list): Likewise. (exception_handler_statement): Likewise. (block): Likewise. (block_add_statements): Likewise. (global_variable): Likewise. (global_variable_set_init): Likewise. (local_variable): Likewise. (parameter_variable): Likewise. (static_chain_variable): Likewise. (temporary_variable): Likewise. (label): Likewise. (function): Likewise. (function_defer_statement): Likewise. (function_set_parameters): Likewise. (write_global_definitions): Likewise. (fill_in_fields): Likewise. * rust-diagnostics.cc (expand_format): Likewise. (expand_message): Likewise. (va_constructor): Likewise. * rust-diagnostics.h (RUST_ATTRIBUTE_GCC_DIAG): Likewise. (rust_open_quote): Likewise. (rust_close_quote): Likewise. (rust_debug_loc): Likewise. * rust-gcc.cc (non_zero_size_type): Likewise. * rust-object-export.h (rust_field_alignment): Likewise. (rust_read_export_data): Likewise. (rust_write_export_data): Likewise. * rust-session-manager.cc (saw_errors): Likewise. (rust_get_linemap): Likewise. (validate_crate_name): Likewise. (Session::load_extern_crate): Likewise. * rust-session-manager.h (rust_crate_name_validation_test): Likewise. * rust-system.h (rust_preserve_from_gc): Likewise. (rust_localize_identifier): Likewise. * rust-target.h (rust_add_target_info): Likewise. * typecheck/rust-autoderef.cc: * typecheck/rust-casts.cc (TypeCastRules::cast_rules): Likewise. * typecheck/rust-coercion.cc (TypeCoercionRules::do_coercion): Likewise. (TypeCoercionRules::coerce_unsafe_ptr): Likewise. (TypeCoercionRules::coerce_borrowed_pointer): Likewise. * typecheck/rust-hir-trait-resolve.cc (TraitResolver::resolve_trait): Likewise. (TraitItemReference::is_object_safe): Likewise. * typecheck/rust-hir-type-check-base.cc (TypeCheckBase::resolve_literal): Likewise. * typecheck/rust-hir-type-check-expr.cc (TypeCheckExpr::visit): Likewise. (typecheck_inline_asm_operand): Likewise. * typecheck/rust-hir-type-check-implitem.cc (TypeCheckImplItem::visit): Likewise. (TypeCheckImplItemWithTrait::visit): Likewise. * typecheck/rust-hir-type-check-pattern.cc (TypeCheckPattern::visit): Likewise. * typecheck/rust-hir-type-check-struct.cc (TypeCheckStructExpr::visit): Likewise. * typecheck/rust-hir-type-check-type.cc (TypeResolveGenericParam::apply_trait_bounds): Likewise. (ResolveWhereClauseItem::visit): Likewise. * typecheck/rust-hir-type-check.cc (saw_errors): Likewise. (TraitItemReference::get_type_from_fn): Likewise. * typecheck/rust-type-util.h (query_type): Likewise. (types_compatable): Likewise. (unify_site): Likewise. (unify_site_and): Likewise. (coercion_site): Likewise. (try_coercion): Likewise. (cast_site): Likewise. * typecheck/rust-tyty-bounds.cc: * typecheck/rust-tyty-call.cc (TypeCheckCallExpr::visit): Likewise. * typecheck/rust-tyty-cmp.h: * typecheck/rust-tyty-variance-analysis.h (query_field_regions): Likewise. * typecheck/rust-tyty.cc (BaseType::is_unit): Likewise. (BaseType::has_substitutions_defined): Likewise. (BaseType::needs_generic_substitutions): Likewise. (BaseType::get_subst_argument_mappings): Likewise. (InferType::default_type): Likewise. (InferType::apply_primitive_type_hint): Likewise. * typecheck/rust-tyty.h (is_primitive_type_kind): Likewise. * typecheck/rust-unify.cc (UnifyRules::expect_inference_variable): Likewise. (UnifyRules::expect_adt): Likewise. (UnifyRules::expect_str): Likewise. (UnifyRules::expect_reference): Likewise. (UnifyRules::expect_pointer): Likewise. (UnifyRules::expect_param): Likewise. (UnifyRules::expect_array): Likewise. (UnifyRules::expect_slice): Likewise. (UnifyRules::expect_fndef): Likewise. (UnifyRules::expect_fnptr): Likewise. (UnifyRules::expect_tuple): Likewise. (UnifyRules::expect_bool): Likewise. (UnifyRules::expect_char): Likewise. (UnifyRules::expect_int): Likewise. (UnifyRules::expect_uint): Likewise. (UnifyRules::expect_float): Likewise. (UnifyRules::expect_isize): Likewise. (UnifyRules::expect_usize): Likewise. (UnifyRules::expect_never): Likewise. (UnifyRules::expect_placeholder): Likewise. (UnifyRules::expect_projection): Likewise. (UnifyRules::expect_dyn): Likewise. (UnifyRules::expect_closure): Likewise. (UnifyRules::expect_opaque): Likewise. * util/rust-abi.h (get_abi_from_string): Likewise. (get_string_from_abi): Likewise. * util/rust-attributes.cc (check_doc_attribute): Likewise. * util/rust-base62.h (base62_integer): Likewise. * util/rust-dir-owner.h (get_file_subdir): Likewise. * util/rust-edition.h (get_rust_edition): Likewise. * util/rust-punycode.h (encode_punycode): Likewise. (rust_punycode_encode_test): Likewise. * util/rust-token-converter.cc (convert): Likewise. (from_tokenstream): Likewise. * util/rust-token-converter.h (convert): Likewise. (convert_literal): Likewise. * util/rust-unicode.h (is_alphabetic): Likewise. (is_ascii_only): Likewise. (is_numeric): Likewise. (is_nfc_qc_no): Likewise. (is_nfc_qc_maybe): Likewise. (nfc_quick_check): Likewise. (rust_nfc_qc_test): Likewise. (rust_utf8_normalize_test): Likewise. (rust_utf8_property_test): Likewise. * util/rust-unwrap-segment.h (unwrap_segment_node_id): Likewise. libgrust/ChangeLog: * libproc_macro_internal/ffistring.h (FFIString__new): Likewise. (FFIString__drop): Likewise. * libproc_macro_internal/ident.h (Ident__new): Likewise. (Ident__new_raw): Likewise. (Ident__drop): Likewise. (Ident__clone): Likewise. * libproc_macro_internal/literal.h (Literal__from_string): Likewise. * libproc_macro_internal/proc_macro.h (bridge_is_available): Likewise. * libproc_macro_internal/tokenstream.h (TokenStream__new): Likewise. (TokenStream__with_capacity): Likewise. (TokenSream__push): Likewise. (TokenStream__from_string): Likewise. (TokenStream__clone): Likewise. (TokenStream__drop): Likewise.
2025-04-01Daily bump.GCC Administrator1-0/+10
2025-03-31rust: Lower minimum supported Rust version to 1.49Arthur Cohen5-14/+32
gcc/rust/ChangeLog: * checks/errors/borrowck/ffi-polonius/Cargo.lock: Regenerate. * checks/errors/borrowck/ffi-polonius/Cargo.toml: Update to use source patching instead of vendoring, lower edition to 2018. * checks/errors/borrowck/ffi-polonius/vendor/log/Cargo.toml: Change edition to 2018. * checks/errors/borrowck/ffi-polonius/vendor/log/src/lib.rs: Remove uses of unstable feature. * checks/errors/borrowck/ffi-polonius/.cargo/config.toml: Removed. libgrust/ChangeLog: * libformat_parser/Makefile.am: Avoid using --config as it is unsupported by cargo 1.49. * libformat_parser/Makefile.in: Regenerate. * libformat_parser/generic_format_parser/src/lib.rs: Use extension trait for missing features. * libformat_parser/src/lib.rs: Likewise. * libformat_parser/.cargo/config: Moved to... * libformat_parser/.cargo/config.toml: ...here.
2025-03-18Daily bump.GCC Administrator1-0/+22
2025-03-17gccrs: Fix ffi and enum conventionsbadumbatish3-22/+24
gcc/rust/ChangeLog: * ast/rust-fmt.h (enum ParseMode): Drop typedef in Cpp libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Remove repr(C) * libformat_parser/src/bin.rs: Use ffi * libformat_parser/src/lib.rs: pub ffi, create ParseMode and match rustc's parse mode
2025-03-17gccrs: Added options for ParseModebadumbatish3-3/+8
gcc/rust/ChangeLog: * ast/rust-fmt.cc (Pieces::collect): Added options for ParseMode * ast/rust-fmt.h (collect_pieces): Likewise. (struct Pieces): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Likewise. * libformat_parser/src/bin.rs: Likewise. * libformat_parser/src/lib.rs: Likewise.
2025-03-17gccrs: Fix nightly rustc warningsKushal Pal3-31/+1
libgrust/ChangeLog: * libformat_parser/Cargo.toml: Used crate-type instead of depricated crate_type. * libformat_parser/generic_format_parser/src/lib.rs: Remove dead code. * libformat_parser/src/lib.rs: Likewise. Signed-off-by: Kushal Pal <kushalpal109@gmail.com>
2025-01-02Update Copyright year in ChangeLog filesJakub Jelinek1-2/+1
2024 -> 2025
2024-12-10Daily bump.GCC Administrator1-0/+19
2024-12-09Rust: libformat_parser: Lower minimum Rust version to 1.49Arthur Cohen4-23/+42
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.
2024-12-09Rust: Work around 'error[E0599]: no method named `leak` found for struct ↵Thomas Schwinge1-3/+10
`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'.
2024-12-09Rust: Work around 'error[E0658]: `let...else` statements are unstable'Thomas Schwinge1-2/+5
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'.
2024-08-02Daily bump.GCC Administrator1-0/+344
2024-08-01gccrs: format-args: Start storing string in Rust memoryArthur Cohen1-25/+80
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.
2024-08-01gccrs: format-args: Fix Rust interface and add input parsing.Arthur Cohen2-20/+48
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.
2024-08-01gccrs: format-parser: Add `is_some_and` method for Option<T>Arthur Cohen1-0/+16
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>.
2024-08-01gccrs: libformat_parser: Fix Rust warnings.Arthur Cohen2-3/+1
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.
2024-08-01gccrs: rust-fmt: Store parsed string in Pieces structArthur Cohen1-0/+1
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.
2024-08-01gccrs: libformat_parser: Send boxed values across FFI properlyArthur Cohen1-48/+46
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.
2024-08-01gccrs: libformat_parser: Update header and remove old interfaceArthur Cohen2-237/+43
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.
2024-08-01gccrs: libformat_parser: Start experimenting with cbindgenArthur Cohen2-0/+224
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.
2024-08-01gccrs: libformat_parser: Add FFI safe interfaceArthur Cohen2-5/+298
libgrust/ChangeLog: * libformat_parser/generic_format_parser/src/lib.rs: Add generic library. * libformat_parser/src/lib.rs: Add base for FFI interface.
2024-08-01Rust: Move 'libformat_parser' build into libgrustThomas Schwinge6-5/+485
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.
2024-08-01gccrs: libgrust: Vendor Rust dependenciesArthur Cohen256-0/+123838
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.
2024-08-01gccrs: libgrust: Add format_parser libraryArthur Cohen6-0/+1210
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.
2024-02-21Update copyright years.Sahil Yeole35-35/+35
Signed-off-by: Sahil Yeole <sahilyeole93@gmail.com>
2024-01-17Daily bump.GCC Administrator1-0/+676
2024-01-16gccrs: Add an explicit value to proc macro enum kindPierre-Emmanuel Patry1-1/+1
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: Add license text to libproc_macro rust interfacePierre-Emmanuel Patry15-0/+330
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Split c++ and rustPierre-Emmanuel Patry15-0/+0
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: Rename libproc_macro to libproc_macro_internalPierre-Emmanuel Patry41-11/+12
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Add literal_from_string callbackPierre-Emmanuel Patry5-11/+25
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Remove useless typedefPierre-Emmanuel Patry2-3/+2
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Delete unused prototypePierre-Emmanuel Patry1-3/+0
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Remode function indirectionPierre-Emmanuel Patry4-15/+43
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Add is_available functionPierre-Emmanuel Patry2-0/+9
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Add is_available callbackPierre-Emmanuel Patry3-0/+14
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Rename from_string callback symbolPierre-Emmanuel Patry3-3/+3
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Mirror FFIString changes in C++libraryPierre-Emmanuel Patry4-8/+7
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Increase FFIString usagePierre-Emmanuel Patry2-20/+5
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Change rust Ident definitionPierre-Emmanuel Patry1-18/+7
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Change Ident structurePierre-Emmanuel Patry2-27/+14
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: proc_macro: Add from string implementationPierre-Emmanuel Patry5-2/+57
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Fix Tokenstream growthPierre-Emmanuel Patry3-8/+12
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Fix capacity update in tokenstreamPierre-Emmanuel Patry1-2/+3
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Rename Procmacro subtypesPierre-Emmanuel Patry1-6/+6
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Add procmacro array definitionPierre-Emmanuel Patry1-0/+6
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: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Add cpp Span representationPierre-Emmanuel Patry12-39/+134
Add Span representation in libproc_macro cpp part of the library. Integrate spans to existing types. gcc/rust/ChangeLog: * util/rust-token-converter.cc (convert): Update call to constructors with location information. (handle_suffix): Convert token locus to a Span and use it in the literal. libgrust/ChangeLog: * libproc_macro/Makefile.am: Add span.cc * libproc_macro/Makefile.in: Regenerate. * libproc_macro/span.cc: New file. * libproc_macro/span.h: New file. * libproc_macro/group.cc (Group::make_group): Add span argument. * libproc_macro/group.h (GROUP_H): Add include directive for spans. * libproc_macro/ident.cc (Ident__new): Add span argument. (Ident__new_raw): Likewise. (Ident::make_ident): Likewise. * libproc_macro/ident.h (Ident__new): Likewise. (Ident__new_raw): Likewise. * libproc_macro/literal.cc (Literal::clone): Clone the span. (Literal::make_literal): Add span argument. (Literal::make_u8): Likewise. (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. * libproc_macro/literal.h (struct Literal): Add span to Literal structure. * libproc_macro/punct.cc (Punct::make_punct): Add span argument to punct constructor. * libproc_macro/punct.h (struct Punct): Add span to Punct structure. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
2024-01-16gccrs: libproc_macro: Add Span definitionPierre-Emmanuel Patry5-22/+48
Add Span type definition in the rust interface. libgrust/ChangeLog: * libproc_macro/rust/bridge/group.rs: Add span member to the Group structure. * libproc_macro/rust/bridge/ident.rs: Likewise with the Ident structure. * libproc_macro/rust/bridge/literal.rs: Likewise with the Literal structure. * libproc_macro/rust/bridge/punct.rs: Likewise with the Punct structure. * libproc_macro/rust/bridge/span.rs: Add span internals. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>